|
Class: HTTPResponse (private in HTTPInterface
This class is only visible from within
HTTPInterface.
Object
|
+--HTTPInterface::HTTPResponse
|
+--HTTPInterface::WebSocketResponse
- Package:
- stx:goodies/communication
- Category:
- Net-Communication-HTTP-Client
- Owner:
- HTTPInterface
- Author:
- Stefan Vogel
a response received from an HTTPInterface request.
[instance variables:]
[class variables:]
instance creation
-
> error:">error: errCode
-
create a synthetic error response.
Done for errors happening here (i.e. not generated by a contacted server);
for example: unknown host, etc.
-
> error:responseText:">error: errCode responseText: textOrNil
-
create a synthetic error response.
Done for errors happening here (i.e. not generated by a contacted server);
for example: unknown host, etc.
Compatibility-Squeak
-
> contents">contents
-
for squeak ZnRequest compatibility
-
> headers">headers
-
for squeak ZnRequest compatibility
-
> status">status
-
for squeak ZnRequest compatibility
accessing
-
> contentType">contentType
-
-
> contentType:">contentType: aString
-
Modified (format): / 21-05-2021 / 12:26:29 / cg
-
> data">data
-
return the data converted to a string and decoded by the encoding.
If you need the undecoded bytes, please use #rawData
Usage example(s):
-
> data:">data: something
-
-
> dataFile">dataFile
-
-
> dataFile:">dataFile: something
-
-
> dataFromFileOrData">dataFromFileOrData
-
returns the data either from the data file (which is used if too big) or data directly
-
> dataStream">dataStream
-
in preparation for a future stream interface (i.e. not loading the data into memory
and returning it, but instead return a stream directly reading from the socket),
use this interface.
However, it is currently not yet avoiding big garbage data in memory.
-
> encoding">encoding
-
-
> encoding:">encoding: aString
-
Modified (format): / 21-05-2021 / 12:26:41 / cg
-
> headerInfo">headerInfo
-
-
> headerInfo:">headerInfo: something
-
-
> headerInfoAt:">headerInfoAt: aKeyString
-
get the header info for aKeyString (alway lower case)
-
> mimeType">mimeType
-
-
> mimeType:">mimeType: aMimeTypeString
-
set the mimetype of the response
-
> mimeType:encoding:data:">mimeType: mimeTypeArg encoding: encodingArg data: dataArg
-
marked as obsolete by Stefan Vogel at 28-Sep-2022
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
> mimeType:encoding:rawData:">mimeType: mimeTypeArg encoding: encodingArg rawData: dataArg
-
-
> peerAddress">peerAddress
-
-
> peerAddress:">peerAddress: something
-
-
> rawData">rawData
-
return the data as bytes, as they were received (no decoding by character set, etc)
-
> rawData:">rawData: aByteArray
-
-
> rawHeader">rawHeader
-
-
> rawHeader:">rawHeader: aCollectionOfLines
-
-
> rawHeader:infoHeader:data:">rawHeader: rawHeaderString infoHeader: parsedheader data: dataBytes
-
marked as obsolete by Stefan Vogel at 28-Sep-2022
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
> response">response
-
-
> response:">response: something
-
-
> responseCode">responseCode
-
-
> responseCode:">responseCode: anInteger
-
anInteger >= 500 ifTrue:[self breakPoint:#cg].
-
> responseText">responseText
-
answer the text returned with the response, or the empty string
-
> responseText:">responseText: aString
-
-
> socketAddress">socketAddress
-
-
> socketAddress:">socketAddress: something
-
-
> suppressUnicode">suppressUnicode
-
-
> suppressUnicode:">suppressUnicode: aBoolean
-
set this to true to return only single-byte strings as data
-
> url">url
-
-
> url:">url: aString
-
Modified (format): / 21-05-2021 / 12:27:02 / cg
inspecting
-
> inspectorExtraAttributes">inspectorExtraAttributes
-
(comment from inherited method)
extra (pseudo instvar) entries to be shown in an inspector.
Answers a dictionary of aString -> aBlock.
aString is name of extra attribute and MUST start with minus ($-).
aBlock returns the object representing extra attribute
parsing
-
> setupFromRawHeader:">setupFromRawHeader: rawHeaderArg
-
printing
-
> printOn:">printOn: aStream
-
(comment from inherited method)
append a user printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.
The default here is to output the receiver's class name.
BUT: this method is heavily redefined for objects which
can print prettier.
queries
-
> date">date
-
-
> expires">expires
-
-
> isAuthenticationRequiredResponse">isAuthenticationRequiredResponse
-
-
> isErrorResponse">isErrorResponse
-
return true, if this is an error-response
-
> isFileErrorResponse">isFileErrorResponse
-
return true, if this is a file-error-response
-
> isForbiddenResponse">isForbiddenResponse
-
-
> isMovedResponse">isMovedResponse
-
-
> isNotFoundResponse">isNotFoundResponse
-
-
> isOKResponse">isOKResponse
-
return true, if this is a 200-response
-
> location">location
-
|