eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Comanche::HttpRequest':

Home

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

Class: HttpRequest (in Comanche)


Inheritance:

   Object
   |
   +--Comanche::NetworkRequest
      |
      +--Comanche::HttpRequest

Package:
stx:goodies/webServer/comanche/swiki
Category:
Comanche-Kom-Protocol-HTTP
Version:
rev: 1.26 date: 2005/12/01 16:09:33
user: stefan
file: HttpRequest.st directory: goodies/webServer/comanche/swiki
module: stx stc-classLibrary: swiki

Description:


kom/4.12 (Comanche/4.12)
bolot 2/20/2002 13:53
- rawUrl = the entire request string
- url = rawUrl up to ?
- queryString = rawUrl after the first ?
- rawUrl == url?queryString

HttpRequest (bolot 4/2/2001 18:51)
- HTTP request object wrapper
- handles details of HTTP
-- headers, formats, etc.
- as of kom47, handles multipart posts
- in kom49 (or kom50) a minor refactoring will happen


Class protocol:

accessing
o  endOfRequestHeaderMarker
This marks the end of an HTTP request (two consecutive CR-LFs)

authentication
o  hashPassword: aPassword

o  secretWord
a string used in hashing passwords

defaults
o  defaultContentType

o  defaultMethod

o  defaultProtocol

o  defaultUrl

initialize-release
o  initialize
(comment from inherited method)
called only once - initialize signals

instance creation
o  readFromStream: aStream


Instance protocol:

accessing
o  contentLength

o  contentType
get rid of charset field

o  cookies
answer a dictionary with the cookies in the request

o  endOfRequestHeaderMarker

o  getFields
retrieve fields encoded in the URL: http://aha/ha?a=1&b=2

o  header

o  header: aDict

o  host

o  localAddress
Answer the address of the request originator

o  localPort
Answer the address of the request originator

o  method

o  method: aString

o  multiValueFormFields

o  multiValueFormFieldsDisable
disable use of multi-value form fields

o  multiValueFormFieldsEnable
enable use of multi-value form fields

o  postFields
Answer the multipart fields for a post request (if in fact this is a
POST request

o  protocol

o  queryString

o  queryString: aString

o  rawPostFields
save the POST form fields as is, for future processing, see #postFields

o  rawUrl

o  referer

o  remoteAddress

o  remoteAddress: aRemoteAddress

o  stream

o  stream: something

o  stxHttpRequest

o  stxHttpRequest: something

o  timestamp

o  timestamp: aTimestamp

o  url

o  url: aUrl

o  user
currently, only basic authentication is supported

connection mgt
o  isPersistentConnection

defaults
o  defaultContentType

o  defaultMethod

o  defaultProtocol

o  defaultUrl

initialize-release
o  destroy

o  initRemoteAddress

o  initStatusString: aString
self protocol: statusLine third

o  initUrl: aString

o  initializeFromStream: aStream
[(self readRequestHeaderFrom: stream)

o  readRequestHeaderFrom: aStream
force reading/parsing post fields

multipart forms
o  multipartBoundary
boundary specification in the HTTP header looks like:
Content-Type: multipart/form-data; boundary=BOUNDARY

o  multipartFormFieldsDo: aBlock
USAGE:
request multipartFormFieldsDo: [:chunk |
chunk saveToStream: aStream].

o  nextChunkHeader
Read the next multipart data chunk's header

printing
o  printOn: printStream
(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.

o  writeOn: aStream
this can be used to form a client-side request and send it over network

private
o  parseCookies: aString
PRIVATE: Parse a string in the format:
Cookie: NAME1=OPAQUE_STRING1; NAME2=OPAQUE_STRING2 ...

response
o  badRequest

o  redirectTo: aUrl

o  unauthorizedFor: realm

response cookies
o  responseCookies
cookies that need to be set

o  setCookieName: nameString value: valueString expiresDate: expiresDate expiresTime: expiresTime path: pathString domain: domainString secure: secureBoolean
set a cookie in the Response

o  setCookieName: nameString value: valueString path: pathString
set a cookie in the Response

testing
o  isGetRequest

o  isHeaderRequest

o  isPostRequest

user authentication
o  clearPassword

o  getUsername

o  hashPassword: aPassword

o  isUsername: aUsername password: aPassword

o  secretWord

o  setUsername: aUsername
save the username in a cookie

o  setUsername: aUsername password: aPassword
save the username/password in cookies

o  userObject

o  userObject: anObject



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:44:46 GMT