To view the documentation evaluate:
HelpBrowser openOn: WebClientHelp.
The simplest form to use WebClient is by one of its convenience APIs:
WebClient httpGet: 'http://www.squeak.org/'.
WebClient httpPost: 'http://www.squeak.org/' content:'Hello Squeak' type: 'text/plain'.
.....
WebClient httpGet: 'http://wiki.squeak.org/squeak/1586'
The answer object is a WebResponse instance.
WebResponse(HTTP/1.1 200 OK
server: nginx/1.14.2
date: Sat, 16 Mar 2019 12:19:57 GMT
content-type: text/html; charset=iso-8859-1
transfer-encoding: chunked
connection: keep-alive
expires: 0
cache-control: no-cache
pragma: no-cache
x-clacks-overhead: GNU Terry Pratchett
content-encoding: gzip
)
WebClient uses HTTPSocket as the request handler, see method #registerHttpSocketRequestHandler.
WebClient uses the WebUtils class.
WebClient is included in the base image since April 2015 and thus with Squeak 4.6.
It was first released in May 2010: WebClient and WebServer 1.0 for Squeak 4.1.
So the WebClient core package includes as well a simple WebServer.
The package also has been ported to Cuis: https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev/blob/master/Packages/Features/WebClient.pck.st.
Example:
WebServer and WebClient hello world demo
Retrieve a Json object
SqueakMap uses WebClient: See
SMClient>>client
and
SMClient class>>assureWebClient.
See also
WebClient/ZnClient wrapper