eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTTPInterface::HTTPResponse':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: HTTPResponse (private in HTTPInterface

This class is only visible from within HTTPInterface.

Inheritance:

   Object
   |
   +--HTTPInterface::HTTPResponse
      |
      +--HTTPInterface::WebSocketResponse

Package:
stx:goodies/communication
Category:
Net-Communication-HTTP-Client
Owner:
HTTPInterface
Author:
Stefan Vogel

Description:


a response received from an HTTPInterface request.


[instance variables:]

[class variables:]


Related information:



Class protocol:

instance creation
o  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.

o  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.


Instance protocol:

Compatibility-Squeak
o  contents
for squeak ZnRequest compatibility

o  headers
for squeak ZnRequest compatibility

o  status
for squeak ZnRequest compatibility

accessing
o  contentType

o  contentType: aString
Modified (format): / 21-05-2021 / 12:26:29 / cg

o  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

o  data: something

o  dataFile

o  dataFile: something

o  dataFromFileOrData
returns the data either from the data file (which is used if too big) or data directly

o  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.

o  encoding

o  encoding: aString
Modified (format): / 21-05-2021 / 12:26:41 / cg

o  headerInfo

o  headerInfo: something

o  headerInfoAt: aKeyString
get the header info for aKeyString (alway lower case)

o  mimeType

o  mimeType: aMimeTypeString
set the mimetype of the response

o  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) **

o  mimeType: mimeTypeArg encoding: encodingArg rawData: dataArg

o  peerAddress

o  peerAddress: something

o  rawData
return the data as bytes, as they were received (no decoding by character set, etc)

o  rawData: aByteArray

o  rawHeader

o  rawHeader: aCollectionOfLines

o  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) **

o  response

o  response: something

o  responseCode

o  responseCode: anInteger
anInteger >= 500 ifTrue:[self breakPoint:#cg].

o  responseText
answer the text returned with the response, or the empty string

o  responseText: aString

o  socketAddress

o  socketAddress: something

o  suppressUnicode

o  suppressUnicode: aBoolean
set this to true to return only single-byte strings as data

o  url

o  url: aString
Modified (format): / 21-05-2021 / 12:27:02 / cg

inspecting
o  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
o  setupFromRawHeader: rawHeaderArg

printing
o  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
o  date

o  expires

o  isAuthenticationRequiredResponse

o  isErrorResponse
return true, if this is an error-response

o  isFileErrorResponse
return true, if this is a file-error-response

o  isForbiddenResponse

o  isMovedResponse

o  isNotFoundResponse

o  isOKResponse
return true, if this is a 200-response

o  location



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 15:58:54 GMT