|
|
Class: HTTPRequest
Object
|
+--HTTPRequest
|
+--FCGIRequest
- Package:
- stx:goodies/webServer
- Category:
- Net-Communication-HTTP-Server
- Version:
- rev:
1.212
date: 2010/04/26 11:41:05
- user: sr
- file: HTTPRequest.st directory: goodies/webServer
- module: stx stc-classLibrary: webServer
- Author:
- Christian Penk
represents an HTTP request as received by the HTTPServer.
[instance variables:]
server the server from which this request was received
connection the socket conection from which this request was received
peer the sender of this request
peerName
rawRequestString: the whole request incl. any POST-data (required for com-swiki)
rawHeader the raw http-header (without data)
headerDictionary extracted fields
headerLines header lines
method ?
httpVersion httpVersion from the header
url the requests original url
postDataFields POST request arguments
urlParameters &-parameters as extracted from the URL
contentLength contentLength from the header
contentType contentType from the header
contentEncoding contentEncoding from the header
connectionAttributes connectionAttributes from the header (Keep/close etc.)
userAgent userAgent from the header (IE, mozilla etc.)
authorization authorization from the header
acceptedTypes acceptedTypes from the header
acceptedEncodings acceptedEncodings from the header
acceptedCharsets acceptedCharsets from the header
acceptedLanguages acceptedLanguages from the header
referer referer from the header
host host from the header
soapAction soapAction from the header
cookies cookies from the header
data the POST-data alone
postData ?
userId ?
serviceLinkName ?
service ?
relativePath URL relative to service-linkName
message the original message; split and preparsed
arguments additional arguments for object-requests (preparsed from the url)
selector ?
multipartBoundary ?
multiPartChunks ?
queryString url parameters - rest after any in { & ; ? }
response response object
http://www.w3.org/Protocols/rfc2616/rfc2616.html
HTTPResponse
HTTPServer
HTTPInterface
defaults
-
allowedRequestMethods
-
helpers
-
extractAcceptedFromLine: acceptLine
-
-
extractMultipartBoundaryFromContentType: contentTypeLine
-
instance creation
-
server: httpServer connection: connection
-
serving-helpers
-
controlCharacters
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
escape: arg
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
escapeCharacterEntities: arg
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
unEscape: arg
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
urlEncoded: arg
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
accessing
-
arguments
-
the arguments of a SelectorService
-
authenticator
-
-
authenticator: something
-
-
connection
-
-
multiPartChunks
-
-
pathRelativeToService
-
set the path relative to the services root path.
- without a leading /
-
pathRelativeToService: aString
-
set the path relative to the services root path.
- without a leading /
-
queryString
-
-
rawUrl
-
-
rawUrl: something
-
-
relativePath
-
Obsolete: use #pathRelativeToService.
get the path relative to the services root path.
- with a leading /
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
replyPresenter
-
-
response
-
-
selector
-
the selector of a SelectorService
-
service
-
-
service: serviceArg serviceLinkName: serviceLinkNameArg
-
-
serviceRequestContext
-
-
serviceRequestContext: something
-
accessing-http request data
-
cookiesAt: aString
-
Selects all the cookies with the name aString.
<return: Collection>
-
data
-
-
getURLQueryString
-
-
hasUrlParameter: key
-
true, if key is present in the url-param (after the urls path, separated by &'s)
-
multiPartChunkDataAt: key
-
-
multiPartChunkDataAt: key ifAbsent: replacement
-
-
multiPartChunkFilenameAt: key
-
-
multiPartChunkFilenameAt: key ifAbsent: aBlock
-
-
peer
-
-
peer: something
-
set the value of the instance variable 'peer' (automatically generated)
-
peerName
-
-
peerName: something
-
set the value of the instance variable 'peerName' (automatically generated)
-
postData
-
-
postDataFieldAt: key
-
a field (typically of a POST request)
-
postDataFieldAt: key ifAbsent: replacement
-
a field (typically of a POST request)
-
postDataFields
-
the fields (typically of a POST request).
Nil if there are none.
-
postDataVectorAt: key
-
all url parameters for key (after the urls path, separated by &'s)
-
postDataVectorAt: key ifAbsent: replacement
-
all url parameters for key (after the urls path, separated by &'s)
-
rawRequestString
-
-
selector: selectorArg arguments: argumentsArg
-
remember selector and arguments of a SelectorService (for the service)
-
server
-
-
serverHostName
-
-
serviceLinkName
-
-
serviceLinkName: something
-
-
socketAddress
-
answer the address that received the request.
This is one of the addresses assigned to the server
-
urlParameterAt: key
-
a scalar url-param (after the urls path, separated by &'s).
For example, if the url is 'foo?bar=1?baz=2', then
urlParameterAt:'bar'
would return '1' (a string)
-
urlParameterAt: key ifAbsent: replacement
-
a scalar url-param (after the urls path, separated by &'s)
-
urlParameterAt: key put: aString
-
-
urlParameterVectorAt: key
-
all url parameters for key (after the urls path, separated by &'s)
-
urlParameterVectorAt: key ifAbsent: replacement
-
all url parameters for key (after the urls path, separated by &'s)
-
urlParameters
-
the url-params (after the urls path, separated by &'s).
Nil if there are none.
-
valueOfNumericPostDataField: fieldName
-
accessing-http request header
-
acceptedCharsets
-
as extracted from the http-header,
returns key-value associations
-
acceptedEncodings
-
as extracted from the http-header
-
acceptedLanguages
-
return the value of the instance variable 'acceptedLanguages' (automatically generated)
-
acceptedTypes
-
as extracted from the http-header, if no Accept: field is present,
then it is assumed that text/plain and text/html are accepted.
-
authorizationHeader
-
as extracted from the http-header
-
connectionAttributes
-
-
contentEncoding
-
-
contentLength
-
return the value of the instance variable 'contentLength' (automatically generated)
-
contentType
-
-
cookies
-
-
fieldValueFor: aFieldKey
-
-
fieldValues
-
answer all the header fields as a Dictionary
-
header
-
the header as a dictionary
-
host
-
-
httpVersion
-
-
method
-
-
method: aString
-
-
multipartBoundary
-
-
rawHeader
-
-
referer
-
yes, I know that 'referer' is a misspelling of 'referrer'.
However, somehow it made it into the HTTP standard, and is called 'referer' there - sigh.
-
referrer
-
the referring page - if known.
Notice the mispelling below - due to the fact that the misspelling made it into
the HTTP standard
-
soapAction
-
-
url
-
-
userAgent
-
accessing-http response data
-
binary: aBoolean
-
-
expirationTime: aTimeStamp
-
the responses expirationTimestamp; consider to use response maxAge:
-
replyData: aStringOrBytes
-
-
replyHeader
-
return the value of the instance variable 'replyHeader' (automatically generated)
-
resetResponseData
-
start anew collecting response data
(i.e. throw away what has been already collected)
-
responseContentType: something
-
set the value of the instance variable 'contentType' (automatically generated)
accessing-sessions
-
getSession
-
-
getSession: shouldCreateIfNone
-
Get the current valid session associated with the request.
If shouldCreateIfNone is true then either a new session will be created
or the current one will be returned if one exists.
Answer nil, if shouldCreateIfNone is false and there is no session.
The session's scope is a single service (over all of its possible linkNames).
<return: HTTPSession | nil>
authentication
-
authenticateForRealm: aRealm
-
authenticate myself for a realm.
Raise an error, if authentication fails
-
authenticatedUsername
-
get the user, that has been authenticated
or nil, if there is none
-
isForbiddenUserAgent: aUserAgentString
-
there are certain user agents which we definitely do not want in our house:
error reporting
-
reportBadRequest: msg
-
bad request.
-
reportException: ex
-
Write an error report.
-
reportForbidden: msg
-
access forbidden
-
reportHTTPVersionNotSupported: msg
-
-
reportMethodNotAllowed: msg method: badMethod url: badURL
-
method (such as POST, PUT etc.) is not allowed.
-
reportMovedPermanently: newUrl
-
page has been permanently moved to another location, newUrl.
-
reportNotAcceptable: typeAvailable
-
not acceptable - content-type not in accept list.
-
reportNotFound: msg
-
document/object was not found.
Take care: IE6 will not show this message, but its own message,
if the whole repsonse is shorter than 512 bytes and
'Show Short HTTP Error Messages' is on in Internet Settings
-
reportRequestTimeout: message
-
request timeout - the request was transmitted too slowly.
-
reportServerError: msg moreInfo: aStringOrNil
-
server error.
-
reportServiceUnavailable: msg
-
report temporary down - will not return (i.e. aborts).
-
reportUnauthorized: messageText
-
no authorization - ask for authorization.
-
reportUnsupportedFeature: msg
-
bad request.
-
sendErrorResponseForResponseCode: aStatusCode
-
-
sendErrorResponseForResponseCode: aStatusCode body: bodyText
-
-
sendErrorResponseForResponseCode: aStatusCode message: messageString
-
Send an error for aStatusCode (e.g. 440 - Not found).
messageString may contain additional information
-
sendErrorResponseForResponseCode: aStatusCode title: titleText body: bodyText
-
-
sendErrorResponseForStatusCode: aStatusCode
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
sendErrorResponseForStatusCode: aStatusCode body: bodyText
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
header parsing
-
extractCookiesFrom: line
-
-
headerParser
-
-
parseFirstLine
-
-
parseHeader
-
-
rawRequestString: rawRequestStringArg rawHeader: rawHeaderArg data: dataArg
-
html reply composition
-
bodyEnd
-
Write </BODY>
-
bodyStart
-
Write <BODY>
-
formEnd
-
append the standard footer for a form.
-
formFooter
-
Write the standard footer for a form.
-
formResetButton
-
generate a reset button for a form.
-
formSubmitButton
-
-
formSubmitButtonForString: aString
-
-
formSubmitButtonForString: aString name: aName
-
-
formSubmitButtonStringForString: aString name: aName
-
-
htmlEnd
-
-
htmlStart
-
-
imageFor: anImageOrImageFilename
-
generate an IMG tag for a real image (or an image file name)
-
imageFor: anImageOrImageFilename alt: alt
-
an IMG tag for a real image (or an image file name)
-
imageLinkTextFor: anImageOrImageFilename alt: alt
-
return an IMG tag for a real image (or an image file name)
-
inputFieldFor: varName label: label initialValue: value
-
an input field - must be within a form
-
inputFieldFor: varName size: size label: label initialValue: value
-
an input field - must be within a form
-
inputFieldFor: varName type: aType size: size label: label initialValue: value
-
an input field - must be within a form
-
inputFieldFor: varName type: aType size: size label: label initialValue: value append: aString
-
an input field - must be within a form.
type: 'password' | 'checkbox' | 'submit' | 'reset' | nil
-
inputFieldStringFor: varName type: aType size: size label: label initialValue: value append: aString
-
an input field - must be within a form.
type: 'password' | 'checkbox' | 'submit' | 'reset' | nil
-
label: labelString id: idString value: anObject
-
Add a table row for the given data to the reply.
-
label: labelString text: aString id: idString rows: rows cols: cols
-
Build a textarea form field.
-
refreshStringFor: aService selector: aSelector arguments: arguments time: seconds
-
-
refreshStringFor: aService selector: aSelector time: seconds
-
-
table: aBlock
-
-
table: aBlock attributes: attrString
-
-
tableEnd
-
-
tableFormFooter
-
Close the table and write the standard footer for a form.
-
tableRow: aBlock
-
-
tableRow: aBlock attributes: attrString
-
-
tableRowEnd
-
-
tableRowStart: attrString
-
-
tableStart: attrString
-
-
titleAndHeader: aString
-
Write a standard header and set the document title.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
unformattedCodeTextEnd
-
end some plainText.
-
unformattedCodeTextStart
-
start some plainText.
-
unformattedText: aString
-
add some plainText.
-
unformattedTextEnd
-
end some plainText.
-
unformattedTextStart
-
start some plainText.
html reply composition stx
-
pageFinish
-
finish the page.
-
pageSTXFooter
-
Write the standard page footer.
-
stxBodyEnd
-
-
stxBodyStart: aString
-
Write a standard stx body with a headline #f6feff
-
stxBodyStart: aString homeLink: aHomeLink
-
Write a standard stx body with a headline #f6feff
-
stxBodyStart: aString homeLink: aHomeLink afterButtons: afterButtonsString
-
Write a standard stx body with a headline #f6feff
-
stxPageFinish
-
finish the page.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
stxPageParameters
-
-
stxPoweredByString
-
-
stxReply: aString
-
-
title: aString
-
Write a standard header and set the document title.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
title: aString with: someMoreHeaderStuff
-
Write a standard header and set the document title. Also used for logging purposes.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
html reply composition-stream protocol
-
nextPutAll: aString
-
append aString to the collected reply.
-
nextPutAllEscaped: aString
-
append aString to the collected reply.
The string is processed, by replacing html-special characters by there html-equivalent (such as '>' into <)
-
nextPutLine: aString
-
append aString to the collected reply and append a lineBreak.
-
nextPutLineEscaped: aString
-
append aString to the collected reply and append a cr.
The string is processed, by replacing html-special characters by there html-equivalent (such as '>' into <)
links-html generation
-
homeWebLinkForText: nameString
-
Return HTML code for a link to anObject using the given name and message selector.
-
linkIdFor: aService
-
Return the linkId to send aMessage to anObject.
if the request is for another service, answer the first link for the service
-
linkIdFor: aService argument: argumentString
-
Return the linkId to send aMessage to anObject.
Create a new linkId if necessary.
-
linkIdFor: aService selector: aSelector
-
Return the linkId to send aMessage to anObject.
Create a new linkId if necessary.
-
linkIdFor: aService selector: aSelector argument: argumentString
-
Return the linkId to send aMessage to anObject.
Create a new linkId if necessary.
-
webLinkForImage: imageOrImageFilename service: aService argument: aSelector
-
Return HTML code for a link to anObject using the given name and message selector.
-
webLinkForImage: imageOrImageFilename service: aService selector: aSelector
-
Return HTML code for a link to anObject using the given name and message selector.
-
webLinkForText: nameString link: aLinkId
-
Return HTML code for a linkId using the given name
and message selector. When the link is followed,
aSelector plus argument will be sent to anObject.
-
webLinkForText: nameString service: aService argument: anArgument
-
Return HTML code for a link to aService using the given nameString
and aSelector. When the link is followed,
aSelector plus argument will be sent to aService.
-
webLinkForText: nameString service: aService selector: aSelector
-
Return HTML code for a link to anObject using the given name and message selector.
-
webLinkForText: nameString service: aService selector: aSelector argument: anArgument
-
Return HTML code for a link to aService using the given nameString
and aSelector. When the link is followed,
aSelector plus argument will be sent to aService.
-
webLinkText: nameString target: targetString service: aService selector: aSelector
-
Return HTML code for a link to aService using the given name and message selector.
logging
-
logAccess
-
-
logError: aString
-
misc
-
environmentValueFor: aFieldKey
-
return the value of an environment value.
We have none, so return nil here. This is defined for FastCGI compatibility
obsolete
-
escape: aString
-
use class escape:
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
unEscape: aString
-
use class unEscape:
** This is an obsolete interface - do not use it (it may vanish in future versions) **
printing
-
printOn: aStream
-
queries
-
fullPath
-
-
isGET
-
return true, if the request was a HEAD request
-
isHEAD
-
return true, if the request was a HEAD request
-
isPOST
-
return true, if the request was a POST request
-
isSecure
-
answer true, if this request was issued over an secure channel (SSL/TLS)
-
startReadRequestTime
-
-
timeToPerform
-
in milliseconds
response collecting
-
addCookie: cookie
-
send a cokkie with the response.
Remember the cookie in the request, so that session cookies
will not be created twice
-
addToReplyHeader: aString
-
collect part of a header (i.e. append aString to the reply header).
-
reply: aString
-
collect part of a reply (i.e. append aString to the reply buffer).
-
replyCR
-
Append a cr to the reply buffer
-
replyEscaped: aStringOrCharacter
-
collect part of a reply (i.e. append aString to the reply buffer).
Special character (lt, gt) are escaped.
-
replyHeader: aString
-
-
replyURLEscaped: aStringOrCharacter
-
collect part of a reply (i.e. append aString to the reply buffer).
URL-Special characters (&, space etc.) are escaped.
response sending
-
redirectTo: link
-
redirect both per META and per 302-location-redirect.
(because content-location redirection doesn't work for most of the browsers)
-
sendBinary: aStreamOrBytes type: contentType
-
send some binary data as a response.
Typically used with images and non-text documents
-
sendBinaryData: binaryData type: contentType
-
send some binary data as a response.
Typically used with images and non-text documents
-
sendBinaryStream: aStreamOrBytes type: contentType
-
send some binary data as a response.
Typically used with images and non-text documents
-
sendImage: inImage
-
reply with a bitmap image.
For now, must send it as gif ... (could do jpg as well),
or even better, remember what types are supported by the browser
-
sendResponse
-
send the response
-
sendResponseWithType: aContentType
-
send the response
serving-helpers
-
checkAcceptableType: type
-
-
decodeFields: aString
-
Convert the form fields in Collection of strings into a dictionary.
collection is needed because e.g. (on <SELECT name=FOO MULTIPLE> by client selects more than one
FOO comes with same key and different values)
Each field should be of the form: &nameKey=collection of values
-
extractPostDataFields
-
-
extractURLParametersFromPath: path
-
answer the local part of the path without parameters.
As a side effect the parameters are stored in the instVar urlParameters
serving-processing
-
handleSOAPAction
-
-
reprocess
-
-
reprocessWithInternalURL: aNewInternalURL
-
-
reprocessWithServiceURL: aNewInternalServiceURL
-
-
robotPolicy
-
Return a text specifying our robots policy.
This is the answer to be given to webCrawlers and tells them,
which URLs (subtrees) should not be visited.
See
http://info.webcrawler.com/mak/projects/robots/norobots.html
for details.
The default here is to disallow everything.
-
url: aNewURL
-
serving-requests
-
generateReply
-
handle a request; generate the reply.
-
generateReplyForGetRequest
-
Generate the reply to a GET request.
-
generateReplyForHeadRequest
-
Generate the reply to a HEAD request (same as GET, but no data is sent at the end).
-
generateReplyForPostRequest
-
handle a post-request; generate the reply.
serving-serverState
-
checkMaintenanceMode
-
if server is in mainenance mode, no files are served to normal users.
Access to a server in maintenance mode is only possibly to a user
that has authenticated for maintenance service
setup from connection
-
initializeForServer: serverArg connection: connectionArg
-
-
postData: something
-
MultipartChunk
ReprocessRequest
|