PATH |
WOResponse
Inherits from: WOResponse
Implements: WOActionResults Cloneable
Package: com.appserver.webobjects
Class Description
A WOResponse object represents an HTTP response that an application returns to a Web server to complete a cycle of the request-response loop. The composition of a response occurs during the third and final phase of this loop, a phase marked by the propagation of the appendToResponse message through the objects of the application. The WOApplication object first sends this message, passing in a newly-created WOResponse object as an argument. WOElement objects, which represent the dynamic and static HTML elements on a page, respond to the message by appending their HTML representation to the content of the WOResponse object. WOApplication, WOSession, and WOComponent objects can also respond to the message by adding information to the WOResponse object.
A WOResponse has two major parts: HTML content and HTTP information. The content is what is displayed in a Web browser; it can include escaped HTML, which is HTML code shown "as is," uninterpreted. The other information encapsulated by a WOResponse object is used when handling the response. This HTTP data includes headers, status codes, and version string. See the HTTP specification or HTTP documentation for descriptions of these items.
The WOResponse class-from which WOResponse inherits-declares most of the methods you use when constructing a response. These methods can be divided into two groups, those that add to a response's HTML content and those that read and set HTTP information. For images and other binary data, use appendContentData (declared in the WOResponse class). You can obtain and set the entire content of the response with WOResponse's content and setContent methods. The following example shows a sequence of appendContent... messages that compose an HTTP "POST" message:
aResponse.appendContentString("<form method=\"POST\" action=\""); aResponse.appendContentHTMLAttributeValue(aContext.url()); aResponse.appendContentCharacter('"'); aResponse.appendContentString(">");
The remaining WOResponse instance methods set and read the the HTTP status code. WOResponse also provides two class methods that allow you to escape string objects.
Interfaces Implemented
WOActionResults generateResponse
Method Types
Creation WOResponse Working with HTTP status setStatus status Working with HTML content generateResponse Controlling Client Caching disableClientCaching
Constructors
WOResponse
public WOResponse()
Instance Methods
clone
public Object clone()
disableClientCaching
public void disableClientCaching()
Attempts to disable caching in the client browser by appending a "no-cache" Cache-Control response directive to the HTTP response and by appending Expires and Date values that equal (they are both set to the current date and time).
This method shouldn't be invoked more than once for a given response.
generateResponse
public WOResponse generateResponse()
See Also: generateResponse (WOComponent)
setStatus
public void setStatus(int anInt)
See Also: status
status
public int status()
By default, the status is 200 ("OK" status).
See Also: setStatus
toString
public String toString()
© 2001 Apple Computer, Inc. (Last Published April 15, 2001)