WebKit.HTTPRequest | index /usr/local/share/webware/WebKit/HTTPRequest.py

Modules

``

Cookie WebUtils.FieldStorage WebKit.HTTPResponse | WebUtils cgi os | sys time traceback |

Classes

``

WebKit.Request.Request(WebKit.Message.Message)
  HTTPRequest

class HTTPRequest(WebKit.Request.Request)
`` | `A type of Message for HTTP requests. FUTURE * How about some documentation? * The "Information" section is a bit screwed up. Because the WebKit server adapter is a CGI script, these values are oriented towards that rather than the servlet.`

Method resolution order:
  HTTPRequest
  WebKit.Request.Request
  WebKit.Message.Message
  WebKit.Object.Object
  __builtin__.object
  MiscUtils.NamedValueAccess.NamedValueAccess

Methods defined here:

__init__(self, dict={})

adapterName(self)
  `Return the name of the adapter as it appears in the URL.
  Example: '/WebKit.cgi'
  This is useful in special cases when you are constructing URLs.
  See Testing/Main.py for an example use.`

addParent(self, servlet)

contextName(self)
  `Return the name of the context of this request.
  This isn't necessarily the same as the name of the directory containing the context.`

contextPath(self)
  `Return the portion of the request URI that is the context of the request.`

cookie(self, name, default=<class MiscUtils.NoDefault>)
  `Return the value of the specified cookie.`

cookies(self)
  `Return a dictionary-style object of all Cookie objects the client sent with this request.`

delField(self, name)

environ(self)

extraURLPath(self)

field(self, name, default=<class MiscUtils.NoDefault>)

fieldStorage(self)

fields(self)

fsPath(self)
  `The filesystem path of the request, using the webserver's docroot.`

getstate(self)
  `Debugging and testing code. This will likely be removed in the future.`

hasCookie(self, name)

hasCookieSession(self)

hasField(self, name)

hasPathSession(self)

hasValue(self, name)

htmlInfo(self)
  `Return a single HTML string that represents info().
  Useful for inspecting objects via web browsers.`

info(self)
  `Return request info.
  Return a list of tuples where each tuple has a key/label (a string)
  and a value (any kind of object).
  Values are typically atomic values such as numbers and strings
  or another list of tuples in the same fashion. This is for debugging only.`

isSessionExpired(self)
  `Return whether or not this request originally contained an expired session ID.
  Only works if the Application.config setting "IgnoreInvalidSession" is set to 1;
  otherwise you get a canned error page on an invalid session,
  so your servlet never gets processed.`

method(self)
  `Return the HTTP request method (in all uppercase).
  Typically from the set GET, POST, PUT, DELETE, OPTIONS and TRACE.`

originalURLPath(self)
  `Return the URL path of the _original_ servlet before any forwarding.`

parent(self)
  `Get the servlet that passed this request to us, if any.`

parents(self)
  `Return the parents list.`

pathInfo(self)
  `Return any extra path information associated with the URL the client sent with this request.
  Equivalent to CGI variable PATH_INFO.`

pathTranslated(self)
  `Return any extra path information after the servlet name but before the query string.
  The path is translated to a file system path.
  Equivalent to CGI variable PATH_TRANSLATED.`

popParent(self)

queryString(self)
  `Return the query string portion of the URL for this request.
  Taken from the CGI variable QUERY_STRING.`

rawInput(self, rewind=0)
  `Get the raw input from the request.
  This gives you a file-like object for the data that was
  sent with the request (e.g., the body of a POST request,
  or the documented uploaded in a PUT request).
  The file might not be rewound to the beginning if there
  was valid, form-encoded POST data. Pass rewind=1 if
  you want to be sure you get the entire body of the request.`

rawRequest(self)
  `Return the raw request that was used to initialize this request object.`

relativePath(self, joinPath)
  `deprecated: HTTPRequest.relativePath() on 01/24/01 in 0.5.
  use serverSidePath() instead.@
  Return a new path which includes the servlet's path appended by 'joinPath'.
  Note that if 'joinPath' is an absolute path, then only 'joinPath' is returned.`

remoteAddress(self)
  `Return a string containing the IP address of the client that sent the request.`

remoteName(self)
  `Return the fully qualified name of the client that sent the request.
  Returns the IP address of the client if the name cannot be determined.`

remoteUser(self)
  `Always returns None since authentication is not yet supported.
  Take from CGI variable REMOTE_USER.`

requestID(self)
  `Return the request ID.
  The request ID is a serial number unique to this request
  (at least unique for one run of the AppServer).`

responseClass(self)

serverDictionary(self)
  `Return a dictionary with the data the web server gave us.
  This data includes HTTP_HOST and HTTP_USER_AGENT, for example.`

serverSideContextPath(self, path=None)
  `Return the absolute server-side path of the context of this request.
  If the optional path is passed in, then it is joined with the server side
  context directory to form a path relative to the object.
  This directory could be different from the result of serverSidePath() if the request
  is in a subdirectory of the main context directory.`

serverSideDir(self)
  `deprecated: HTTPRequest.serverSideDir() on 01/24/01 in 0.5.
  use serverSidePath() instead.@
  Return the directory of the Servlet (as given through __init__()'s path).`

serverSidePath(self, path=None)
  `Return the absolute server-side path of the request.
  If the optional path is passed in, then it is joined with the
  server side directory to form a path relative to the object.`

serverURL(self)
  `Return the full internet path to this request.
  The path is returned without any extra path info or query strings,
  i.e. www.my.own.host.com/WebKit/TestPage.py`

serverURLDir(self)
  `Return the Directory of the URL in full internet form.
  This is the same as serverURL,
  but removes the actual page name if it was included.`

servletPath(self)

servletPathFromSiteRoot(self)
  `Returns the "servlet path" of this servlet relative to the siteRoot.
  In other words, everything after the name of the context (if present).
  If you append this to the result of siteRoot() you get back to the
  current servlet. This is useful for saving the path to the current servlet
  in a database, for example.`

servletURI(self)
  `Return the URI of the servlet, without any query strings or extra path info.`

session(self)
  `Return the session associated with this request.
  The session is either as specified by sessionId() or newly created.
  This is a convenience for transaction.session()`

sessionId(self)
  `Return a string with the session id specified by the client, or None if there isn't one.`

setField(self, name, value)

setSessionExpired(self, sessionExpired)

setSessionId(self, sessionID, force=False)
  `Allows you to set the session id.
  This needs to be called _before_ attempting to use the session.
  This would be useful if the session ID is being passed in through
  unusual means, for example via a field in an XML-RPC request.
  Pass in force=True if you want to force this session ID to be used
  even if the session doesn't exist. This would be useful in unusual
  circumstances where the client is responsible for creating the unique
  session ID rather than the server.
  Be sure to use only legal filename characters in the session ID --
  0-9, a-z, A-Z, _, -, and . are OK but everything else will be rejected,
  as will identifiers longer than 80 characters.
  (Without passing in force=True, a random session ID will be generated
  if that session ID isn't already present in the session store.)`

setTransaction(self, trans)
  `This method should be invoked after the transaction is created for this request.`

setURLPath(self, path)
  `Set the URL path of the request."
  There is rarely a need to do this. Proceed with caution.
  The only known current use for this is Application.forwardRequest().`

siteRoot(self)
  `Return the URL path components necessary to get back home from the current location.
  Examples:
  ''
  '../'
  '../../'
  You can use this as a prefix to a URL that you know is based off
  the home location. Any time you are in a servlet that may have been
  forwarded to from another servlet at a different level,
  you should prefix your URL's with this. That is, if servlet "Foo/Bar"
  forwards to "Qux", then the qux servlet should use siteRoot() to construct all
  links to avoid broken links. This works properly because this method
  computes the path based on the _original_ servlet, not the location of the
  servlet that you have forwarded to.`

siteRootFromCurrentServlet(self)
  `Return the URL path componentes necessary to get back home from the current servlet.
  Similar to siteRoot() but instead, it returns the site root
  relative to the _current_ servlet, not the _original_ servlet.`

time(self)
  `Return the time that the request was received.`

transaction(self)

uri(self)
  `Returns the request URI, which is the entire URL except for the query string.
  @@TR 2003-03-22: I think this docstring is wrong, as REQUEST_URI
  does contain the query string with Apache.`

uriWebKitRoot(self)

urlPath(self)
  `Return the URL path of the servlet sans host, adapter and query string.
  For example, http://host/WebKit.cgi/Context/Servlet?x=1 yields '/Context/Servlet'.`

urlPathDir(self)
  `Same as urlPath, but only gives the directory.`

value(self, name, default=<class MiscUtils.NoDefault>)
  `Return the value with the given name.
  Values are fields or cookies.
  Use this method when you're field/cookie agnostic.`

Data and other attributes defined here:

exceptionReportAttrNames = ['args', 'uri', 'servletPath', 'serverSidePath', 'pathInfo', 'pathTranslated', 'queryString', 'method', 'sessionId', 'parents', 'fields', 'cookies', 'environ']

Methods inherited from WebKit.Request.Request:

clearTransaction(self)

input(self)
  `Return a file-style object that the contents can be read from.
  # @@ 2000-05-03 ce: This is bogus. Disregard for now.`

isSecure(self)
  `Check whether this is a secure channel.
  Returns true if request was made using a secure channel,
  such as HTTPS. This currently always returns false,
  since secure channels are not yet supported.`

localAddress(self)
  `Get local address.
  Returns a string containing the Internet Protocol (IP) address
  of the local host (e.g., the server) that received the request.`

localName(self)
  `Get local name.
  Returns the fully qualified name of the local host (e.g., the server)
  that received the request.`

localPort(self)
  `Get local port.
  Returns the port of the local host (e.g., the server)
  that received the request.`

timeStamp(self)
  `Return time() as a human readable string, useful for logging and debugging.`

Methods inherited from WebKit.Message.Message:

arg(self, name, default=<class MiscUtils.NoDefault>)

argNames(self)
  `Returns a list of argument names.`

clearArgs(self)

contentLength(self)
  `Returns the length of the message body or -1 if not known.`

contentType(self)
  `Returns the MIME type of the message body or None if not known.`

deleteArg(self, name)

hasArg(self, name)

protocol(self)
  `Return the protocol-
  Returns the name and version of the protocol the message uses
  in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.`

setArg(self, name, value)

writeExceptionReport(self, handler)

Methods inherited from WebKit.Object.Object:

deprecated(self, method)
  `Output a deprecation warning.
  The implementation of WebKit sometimes invokes this method which prints
  a warning that the method you are using has been deprecated.
  This method expects that deprecated methods say so at the beginning of
  their doc string and terminate that msg with @. For example:
  DEPRECATED: Class.foo() on 01/24/01 in ver 0.5. Use Class.bar() instead. @
  Putting this information in the doc string is important for accuracy
  in the generated docs.
  Example call:
  deprecated(self.foo)`

Data and other attributes inherited from WebKit.Object.Object:

__dict__ = <dictproxy object>
  `dictionary for instance variables (if defined)`

__weakref__ = <attribute '__weakref__' of 'Object' objects>
  `list of weak references to the object (if defined)`

Methods inherited from MiscUtils.NamedValueAccess.NamedValueAccess:

hasValueForKey(self, key)
  `Returns true if the key is available, although that does not
  guarantee that there will not be errors caused by retrieving the key.`

hasValueForName(self, keysString)

resetKeyBindings(self)

setValueForKey(self, key, value)
  `Suppose key is 'foo'. This method sets the value with the following precedence:
  1. Public attributes before private attributes
  2. Methods before non-methods
  More specifically, this method then uses one of the following:
  @@ 2000-03-04 ce: fill in
  ...or invokes handleUnknownSetKey().`

valueForKey(self, key, default=<class MiscUtils.NoDefault>)
  `Suppose key is 'foo'. This method returns the value with the following precedence:
  1. Methods before non-methods
  2. Public attributes before private attributes
  More specifically, this method then returns one of the following:
  * foo()
  * _foo()
  * self.foo
  * self._foo
  ...or default, if it was specified,
  otherwise invokes and returns result of valueForUnknownKey().
  Note that valueForUnknownKey(), normally returns an exception.
  See valueForName() which is a more advanced version of this method that allows
  multiple, qualified keys.`

valueForKeySequence(self, listOfKeys, default=None)

valueForName(self, keysString, default=None)
  `Returns the value for the given keysString. This is the more advanced version of
  valueForKey(), which can only handle single names. This method can handle
  'foo', 'foo1.foo2', 'a.b.c.d', etc. It will traverse dictionaries if needed.`

valueForUnknownKey(self, key, default)
  `# Errors`

valuesForNames(self, keys, default=None, defaults=None, forgive=0, includeNames=0)
  `Returns a list of values that match the given keys, each of which is passed
  through valueForName() and so could be of the form 'a.b.c'.
  keys is a sequence. default is any kind of object. defaults is a sequence.
  forgive and includeNames is a flag.
  If default is not None, then it is substituted when a key is not found.
  Otherwise, if defaults is not None, then it's corresponding/parallel value
  for the current key is substituted when a key is not found.
  Otherwise, if forgive=1, then unknown keys simply don't produce any values.
  Otherwise, if default and defaults are None, and forgive=0, then the unknown
  keys will probably raise an exception through valueForUnknownKey() although
  that method can always return a final, default value.
  if keys is None, then None is returned. If keys is an empty list, then None
  is returned.
  Often these last four arguments are specified by key.
  Examples:
  names = ['origin.x', 'origin.y', 'size.width', 'size.height']
  obj.valuesForNames(names)
  obj.valuesForNames(names, default=0.0)
  obj.valuesForNames(names, defaults=[0.0, 0.0, 100.0, 100.0])
  obj.valuesForNames(names, forgive=0)
  @@ 2000-03-04 ce: includeNames is only supported when forgive=1.
  It should be supported for the other cases.
  It should be documented.
  It should be included in the test cases.`

Functions

``

StringIO(...)
  `StringIO([s]) -- Return a StringIO-like stream for reading or writing`

htmlInfo(info)
  `Return a single HTML string that represents the info structure.
  Useful for inspecting objects via web browsers.`

Data
`` |  | debug = 0