HTTP/en: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Cg (Diskussion | Beiträge) |
|||
Zeile 2: | Zeile 2: | ||
Also, the standard library contains blocks to send HTTP requests and to setup a server which responds to incoming HTTP requests. |
Also, the standard library contains blocks to send HTTP requests and to setup a server which responds to incoming HTTP requests. |
||
Programmatic API: |
|||
From within an elementary action, HTTP requests are initiated via the HTTPInterface class, which |
|||
provides (among many more) the following protocol: |
|||
*'''get:''''url'<br>Retrieve a document. Returns a response object containing detailed status info and (if OK) the retrieved data. This is a convenience entry for the basic request: below. |
|||
*'''get:'''urlOrPath '''fromHost:'''host '''port:'''portNrOrNil '''accept:'''acceptedMimeTypes '''fromDocument:'''documentURL '''userName:'''user '''password:'''passwd '''cookies:'''aCollectionOfCookiesOrNil '''maxCountFollowMoved:'''maxCountFollowed |
|||
*'''request:'''getOrPostOrHead<br>'''url:'''urlOrPathArg '''fromHost:'''hostOrNil '''port:'''portNrOrNil <br>'''proxy:'''(HTTPProxyQuery isNil ifTrue:[nil] ifFalse:[HTTPProxyQuery query])<br>'''accept:'''acceptedMimeTypes '''fromDocument:'''documentURL<br>'''userName:'''userOrNil '''password:'''passwordOrNil<br>'''cookies:'''aCollectionOfCookiesOrNil<br>'''contentType:'''contentType '''contents:'''contents<br>'''destinationFile:'''destinationFilenameOrNil<br>'''additionalHeaderLines:'''nil |
Version vom 23. März 2018, 10:33 Uhr
For HTTP, the underlying Smalltalk/X framework already provides classes to implement both HTTP-client and HTTP-server code. Detailed information is found in the online documentation and/or the source code itself.
Also, the standard library contains blocks to send HTTP requests and to setup a server which responds to incoming HTTP requests.
Programmatic API:
From within an elementary action, HTTP requests are initiated via the HTTPInterface class, which provides (among many more) the following protocol:
- get:'url'
Retrieve a document. Returns a response object containing detailed status info and (if OK) the retrieved data. This is a convenience entry for the basic request: below.
- get:urlOrPath fromHost:host port:portNrOrNil accept:acceptedMimeTypes fromDocument:documentURL userName:user password:passwd cookies:aCollectionOfCookiesOrNil maxCountFollowMoved:maxCountFollowed
- request:getOrPostOrHead
url:urlOrPathArg fromHost:hostOrNil port:portNrOrNil
proxy:(HTTPProxyQuery isNil ifTrue:[nil] ifFalse:[HTTPProxyQuery query])
accept:acceptedMimeTypes fromDocument:documentURL
userName:userOrNil password:passwordOrNil
cookies:aCollectionOfCookiesOrNil
contentType:contentType contents:contents
destinationFile:destinationFilenameOrNil
additionalHeaderLines:nil