[top] / zope / publisher / interfaces / http / IHTTPResponse
An object representation of an HTTP response.
The Response type encapsulates all possible responses to HTTP requests. Responses are normally created by the object publisher. A published object may recieve the response object as an argument named 'RESPONSE'. A published object may also create its own response object. Normally, published objects use response objects to:
If stream oriented output is used, then the response object passed into the object must be used.
authUser
(Attribute)
The authenticated user message.
* = required
reset()
Reset the output result.
Reset the response by nullifying already set variables.
setCookie(name, value, **kw)
Sets an HTTP cookie on the browser
The response will include an HTTP header that sets a cookie on cookie-enabled browsers with a key "name" and value "value". This overwrites any previously set value for the cookie in the Response object. If the value of a keyword argument is None, it will be ignored.
retry()
Returns a retry response
Returns a response suitable for repeating the publication attempt.
getCookie(name, default=None)
Gets HTTP cookie data as a dict
Returns the dict of values associated with an HTTP cookie set in the response, or 'default' if no such cookie has been set in the response yet.
expireCookie(name, **kw)
Causes an HTTP cookie to be removed from the browser
The response will include an HTTP header that will remove the cookie corresponding to "name" on the client, if one exists. This is accomplished by sending a new cookie with an expiration date that has already passed. Note that some clients require a path to be specified - this path must exactly match the path given when creating the cookie. The path can be specified as a keyword argument. If the value of a keyword argument is None, it will be ignored.
setStatus(status, reason=None)
Sets the HTTP status code of the response
The argument may either be an integer or a string from { OK, Created, Accepted, NoContent, MovedPermanently, MovedTemporarily, NotModified, BadRequest, Unauthorized, Forbidden, NotFound, InternalError, NotImplemented, BadGateway, ServiceUnavailable } that will be converted to the correct integer value.
getHeader(name, default=None)
Gets a header value
Returns the value associated with a HTTP return header, or 'default' if no such header has been set in the response yet.
getStatus()
Returns the current HTTP status code as an integer.
addHeader(name, value)
Add an HTTP Header
Sets a new HTTP return header with the given value, while retaining any previously set headers with the same name.
getHeaders()
Returns a list of header name, value tuples.
getStatusString()
Return the status followed by the reason.
consumeBody()
Returns the response body as a string.
Note that this function can be only requested once, since it is constructed from the result.
internalError()
Called when the exception handler bombs.
Should report back to the client that an internal error occurred.
handleException(exc_info)
Handles an otherwise unhandled exception.
The publication object gets the first chance to handle an exception, and if it doesn't have a good way to do it, it defers to the response. Implementations should set the reponse body.
consumeBodyIter()
Returns the response body as an iterable.
Note that this function can be only requested once, since it is constructed from the result.
setResult(result)
Sets response result value based on input.
Input is usually a unicode string, a string, None, or an object that can be adapted to IResult with the request. The end result is an iterable such as WSGI prefers, determined by following the process described below.
Try to adapt the given input, with the request, to IResult (found above in this file). If this fails, and the original value was a string, use the string as the result; or if was None, use an empty string as the result; and if it was anything else, raise a TypeError.
If the result of the above (the adaptation or the default handling of string and None) is unicode, encode it (to the preferred encoding found by adapting the request to zope.i18n.interfaces.IUserPreferredCharsets, usually implemented by looking at the HTTP Accept-Charset header in the request, and defaulting to utf-8) and set the proper encoding information on the Content-Type header, if present. Otherwise (the end result was not unicode) application is responsible for setting Content-Type header encoding value as necessary.
If the result of the above is a string, set the Content-Length header, and make the string be the single member of an iterable such as a tuple (to send large chunks over the wire; see discussion in the IResult interface). Otherwise (the end result was not a string) application is responsible for setting Content-Length header as necessary.
Set the result of all of the above as the response's result. If the status has not been set, set it to 200 (OK).
setHeader(name, value, literal=False)
Sets an HTTP return header "name" with value "value"
The previous value is cleared. If the literal flag is true, the case of the header name is preserved, otherwise word-capitalization will be performed on the header name on output.
appendToCookie(name, value)
Append text to a cookie value
If a value for the cookie has previously been set, the new value is appended to the old one separated by a colon.
There are no specific adapters registered for this interface.
There are no extended adapters registered for this interface.
zope.viewlet.metaconfigure.JavaScriptViewlet
(name: boston.js)
zope.viewlet.manager.<ViewletManager providing IJavaScript>
(name: zope.app.boston.IJavaScript)
zope.viewlet.viewlet.SimpleViewletClass from /opt/zope/sr/apidoc/src/zope/app/boston/viewlets/toolbar/viewlet.pt
(name: toolbar)
zope.traversing.namespace.lang
(name: lang)
zope.viewlet.manager.<ViewletManager providing ICSS>
(name: zope.app.boston.ICSS)
zope.traversing.namespace.acquire
(name: acquire)
zope.traversing.namespace.acquire
(name: acquire)
zope.traversing.namespace.acquire
(name: acquire)
zope.traversing.namespace.acquire
(name: acquire)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.viewlet.metaconfigure.CSSViewlet
(name: xmltree.css)
zope.app.pagetemplate.urlquote.URLQuote
(name: url)
zope.viewlet.viewlet.SimpleViewletClass from /opt/zope/sr/apidoc/src/zope/app/boston/viewlets/xmltree/xmltree.pt
(name: xmltree)
zope.viewlet.metaconfigure.CSSViewlet
(name: skin.css)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.preference.default.DefaultPreferences
(name: preferences)
zope.traversing.namespace.attr
(name: attribute)
zope.traversing.namespace.attr
(name: attribute)
zope.traversing.namespace.attr
(name: attribute)
zope.traversing.namespace.attr
(name: attribute)
zope.viewlet.manager.<ViewletManager providing IHead>
(name: zope.app.boston.IHead)
zope.app.component.back35.RegistrationManagerNamespace
(name: registrations)
zope.viewlet.manager.<ViewletManager providing ILeft>
(name: zope.app.boston.ILeft)
zope.traversing.namespace.resource
(name: resource)
zope.traversing.namespace.resource
(name: resource)
zope.traversing.namespace.resource
(name: resource)
zope.traversing.namespace.resource
(name: resource)
zope.traversing.namespace.etc
(name: etc)
zope.traversing.namespace.etc
(name: etc)
zope.traversing.namespace.etc
(name: etc)
zope.traversing.namespace.etc
(name: etc)
zope.traversing.namespace.etc
(name: etc)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.traversing.namespace.acquire
(name: acquire)
zope.traversing.namespace.lang
(name: lang)
zope.traversing.namespace.lang
(name: lang)
zope.traversing.namespace.lang
(name: lang)
zope.traversing.namespace.lang
(name: lang)
zope.traversing.namespace.item
(name: item)
zope.traversing.namespace.item
(name: item)
zope.traversing.namespace.item
(name: item)
zope.traversing.namespace.item
(name: item)
zope.traversing.namespace.item
(name: item)
zope.viewlet.metaconfigure.JavaScriptViewlet
(name: xmltree)
zope.viewlet.metaconfigure.CSSViewlet
(name: toolbar-css)
zope.traversing.namespace.adapter
(name: adapter)
zope.app.apidoc.apidoc.apidocNamespace
(name: apidoc)
zope.traversing.namespace.vh
(name: vh)
zope.traversing.namespace.vh
(name: vh)
zope.traversing.namespace.vh
(name: vh)
zope.traversing.namespace.vh
(name: vh)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.app.onlinehelp.helpNamespace
(name: help)
zope.traversing.namespace.adapter
(name: adapter)
zope.traversing.namespace.adapter
(name: adapter)
zope.traversing.namespace.adapter
(name: adapter)
zope.traversing.namespace.adapter
(name: adapter)
zope.traversing.namespace.debug
(name: debug)
zope.traversing.namespace.debug
(name: debug)
zope.traversing.namespace.debug
(name: debug)
zope.traversing.namespace.debug
(name: debug)
zope.app.pagetemplate.talesapi.ZopeTalesAPI
(name: zope)
zope.traversing.namespace.attr
(name: attribute)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.preference.preference.preferencesNamespace
(name: preferences)
zope.app.apidoc.codemodule.browser.introspector.annotationsNamespace
(name: annotations)
zope.traversing.namespace.view
(name: view)
zope.traversing.namespace.view
(name: view)
zope.traversing.namespace.view
(name: view)
zope.traversing.namespace.view
(name: view)
zope.formlib.namedtemplate.NamedTemplatePathAdapter
(name: template)
zope.viewlet.manager.<ViewletManager providing IToolBar>
(name: zope.app.boston.IToolBar)
zope.viewlet.metaconfigure.CSSViewlet
(name: widget.css)
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.
There are no views available.