| 
WebObjects 5.2.2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | 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(">");
 
 
 It is possible to set an InputStream as the content of the response as well,
 by invoking setContentStream. If setContentStream is
 invoked with a non-null InputStream, only the data in the InputStream will
 be returned to the client - any other content (set using the WOMessage APIs)
 will be ignored.
WOMessage.appendContentData(NSData dataObject), 
WOMessage.setContent(NSData someData), 
WOMessage.content(), 
WOMessage, 
setContentStream(InputStream, int, int)| Nested Class Summary | 
| Nested classes inherited from class com.webobjects.foundation.NSKeyValueCoding | 
NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.Utility, NSKeyValueCoding.ValueAccessor | 
| Nested classes inherited from class com.webobjects.foundation.NSKeyValueCodingAdditions | 
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility | 
| Field Summary | 
| Fields inherited from class com.webobjects.appserver.WOMessage | 
HTTP_STATUS_FORBIDDEN, HTTP_STATUS_FOUND, HTTP_STATUS_INTERNAL_ERROR, 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()
 | 
 InputStream | 
contentInputStream()
Returns the InputStream set in setContentStream. | 
 int | 
contentInputStreamBufferSize()
Returns the size of the transfer buffer set in setContentStream. | 
 int | 
contentInputStreamLength()
Returns the length of the content set in setContentStream. | 
 void | 
disableClientCaching()
Appends certain headers to the response to disable caching in the client (browser).  | 
 WOResponse | 
generateResponse()
WOResponse's implementation simply returns itself.  | 
 void | 
setContentStream(InputStream inputStream,
                 int bufferSize,
                 int contentSize)
This sets an InputStream as the source of the response content (rather than a String or an NSData).  | 
 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 WOMessagepublic InputStream contentInputStream()
setContentStream. If not stream was set, it returns null.
null.setContentSize(InputStream, int, int), 
contentInputStreamBufferSize(), 
contentInputStreamLength()public int contentInputStreamBufferSize()
setContentStream.
setContentSize(InputStream, int, int), 
contentInputStream(), 
contentInputStreamLength()public int contentInputStreamLength()
setContentStream.
setContentSize(InputStream, int, int), 
contentInputStreamBufferSize(), 
contentInputStream()public void disableClientCaching()
WOAllowsCacheControlHeader property is set to true,
 which is the default behavior), the response also includes the following cache-control headers:
 privateno-cacheno-storemust-revalidatemax-age=0
public WOResponse generateResponse()
generateResponse in interface WOActionResultsWOComponent.generateResponse()
public void setContentStream(InputStream inputStream,
                             int bufferSize,
                             int contentSize)
inputStream,
 using bufferSize as the size of the transport
 buffer in bytes. Note that the contentSize (also in bytes) must be accurate.close method. However, note
 that the close() will be invoked after the entire request-response loop has finished; thus references to
 resources that need to be cleaned up must be carefully managed. Also be cautious during the clean-up itself,
 as some resources may have changed state. For instance, the defaultEditingContext of a session may have
 already been unlocked.
inputStream - is the source of the response content.bufferSize - is the size of the buffer to use when streaming the content. Defaults to 4096.contentSize - is the size of the content in bytes.contentInputStream(), 
contentInputStreamBufferSize(), 
contentInputStreamLength()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(), 
WOMessagepublic int status()
By default, the status is 200 ("OK" status).
Consult RFC 2616 for the significance of status integers.
setStatus(int aStatus), 
WOMessagepublic String toString()
contentString method.
toString in class WOMessage
  | 
Last updated Mon Oct 13 15:42:52 PDT 2003. | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||