|
WebObjects 5.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.appserver.WOMessage | +--com.webobjects.appserver.WOResponse
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
method through the objects of the application. The WOApplication object
first invokes this method, 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 method by appending their HTML
representation to the content of the WOResponse object. WOApplication,
WOSession, and WOComponent objects can also respond to the method by
adding information to the WOResponse object.
A WOResponse has two major parts: HTML content and HTTP information. The HTML content is what is displayed in a Web browser; it can include escaped HTML, which is HTML code shown "as is," uninterpreted. The HTTP information encapsulated by a WOResponse object is used when handling the response. This HTTP data includes headers, status codes, and an HTTP version string.
The WOMessage 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, the user should use the method appendContentData
declared in the
WOMessage class. You can obtain and set the entire content of the message using WOResponse's
content
and setContent
methods. The following
example shows a sequence of appendContent
invocations that compose
an HTTP "POST" message:
aResponse.appendContentString("<form method=\"POST \"action=\"");
aResponse.appendContentHTMLAttributeValue(aContext.url());
aResponse.appendContentCharacter('"');
aResponse.appendContentString(">");
WOMessage.appendContentData(NSData dataObject)
,
WOMessage.setContent(NSData someData)
,
WOMessage.content()
,
WOMessage
Inner classes inherited from class com.webobjects.foundation.NSKeyValueCoding |
NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.Utility, NSKeyValueCoding.ValueAccessor |
Inner classes inherited from class com.webobjects.foundation.NSKeyValueCodingAdditions |
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility |
Fields inherited from class com.webobjects.appserver.WOMessage |
HTTP_STATUS_FORBIDDEN, HTTP_STATUS_FOUND, HTTP_STATUS_MOVED_PERMANENTLY, HTTP_STATUS_NO_CONTENT, HTTP_STATUS_NOT_FOUND, HTTP_STATUS_OK, TheDefaultResponseEncoding |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding |
NullValue |
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
KeyPathSeparator |
Constructor Summary | |
WOResponse()
Creates a WOResponse with HTTP status set to 200 (OK), client caching enabled, and the default string encoding set to ISO Latin 1. |
Method Summary | |
Object |
clone()
|
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 are equal and set to the current date and time. |
WOResponse |
generateResponse()
WOResponse's implementation simply returns itself. |
void |
setStatus(int aStatus)
Sets the HTTP status to aStatus . |
int |
status()
Returns the HTTP return status of the WOResponse. |
String |
toString()
Returns a String representation of the receiver. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public WOResponse()
Method Detail |
public Object clone()
clone
in class WOMessage
public void disableClientCaching()
This method should not be invoked more than once for a given response.
public WOResponse generateResponse()
generateResponse
in interface WOActionResults
WOComponent.generateResponse()
public void setStatus(int aStatus)
aStatus
. The most commonly useful
status codes are defined in static fields on WOMessage. Consult RFC 2616 for the significance of status integers.
aStatus
- the integer stating the status of the HTTPstatus()
,
WOMessage
public int status()
By default, the status is 200 ("OK" status).
Consult RFC 2616 for the significance of status integers.
setStatus(int aStatus)
,
WOMessage
public String toString()
contentString
method.toString
in class WOMessage
|
Last updated Thu Jan 10 18:10:21 PST 2002. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |