|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.ibm.wbi.protocol.http.HttpBase
|
+--com.ibm.wbi.protocol.http.HttpResponse
HttpRequestHeader, HttpResponseHeader,
HttpHeaderAscii).
This class is used to manipulate HTTP 1.0 responses. It can be constructed
with default values, from a response header string, or from a
MegInputStream (that comes from a RequestEvent).
The response can then be manipulated through various properties.
Finally, the response can be produced as a String, or written to the output stream. associated with a RequestEvent. see writeResponse(RequestEvent). HttpResponse does not support creating headers with multiple keys of the same name. For example, if you do two add calls on the same HttpResponse object with the same field name, the second add will override the first.
HttpHeaderAscii,
HttpRequestHeader,
HttpResponseHeader| Field Summary | |
static java.lang.String |
COPYRIGHT
Deprecated. |
protected static java.lang.String |
DEFAULT_CONTENT_TYPE
Deprecated. |
protected static java.lang.String |
DEFAULT_RESPONSE_CODE
Deprecated. |
protected static java.lang.String |
DEFAULT_RESPONSE_MESSAGE
Deprecated. |
protected static java.lang.String |
DEFAULT_SERVER
Deprecated. |
protected HttpResponseHeader |
rheader
Deprecated. |
| Fields inherited from class com.ibm.wbi.protocol.http.HttpBase |
content, header |
| Constructor Summary | |
HttpResponse()
Deprecated. Construct a default HTTP 1.0 response, which has the default parameters. |
|
HttpResponse(ResponseToRequest rtr,
boolean loadContent)
Deprecated. Construct an HTTP 1.0 response from the given MegInputStream. |
|
HttpResponse(java.lang.String header)
Deprecated. Construct an HTTP 1.0 response from the given header string. |
|
HttpResponse(SystemContext sct)
Deprecated. Construct a default HTTP 1.0 response, which has the default parameters. |
|
| Method Summary | |
void |
addCookie(java.lang.String name,
java.lang.String value,
java.util.Date expires,
java.lang.String domain,
java.lang.String path,
boolean secure)
Deprecated. Add a cookie to this response, which will then be stored in the browser. |
int |
getResponseCode()
Deprecated. Access the HTTP response code (e.g. |
java.lang.String |
getResponseText()
Deprecated. Access the HTTP response text (e.g. |
java.lang.String |
getServer()
Deprecated. Access the name of the server that produced the response. |
boolean |
isCache()
Deprecated. Access the Cache property. |
void |
loadResponseContent(ResponseToRequest rtr)
Deprecated. Load the response content from the given RequestEvent
into the Content property of this HTTP Response object. |
static void |
main(java.lang.String[] args)
Deprecated. Test Driver. |
void |
parseResponseHeader(java.lang.String h)
Deprecated. Parse the response header in the given string and set the various properties to reflect its contents. |
protected java.lang.String |
produceCurrentDate()
Deprecated. Produce the current date in String format. |
java.lang.String |
produceHeader()
Deprecated. Use produceResponseWithoutContent instead. |
java.lang.String |
produceResponseWithContent()
Deprecated. Produces response header up through the double \r\n, plus any response content. |
java.lang.String |
produceResponseWithoutContent()
Deprecated. Produce the HTTP header in the form of a String. |
void |
removeContentLength()
Deprecated. Removes the "content-length" header field. |
void |
removeWindowTarget()
Deprecated. Removes the "window-target" header field. |
void |
setCache(boolean c)
Deprecated. Set the Cache property, which indicates to the browser whether this page should be cached or not. |
void |
setResponseCode(int c)
Deprecated. Set the HTTP response code (e.g. |
void |
setResponseText(java.lang.String t)
Deprecated. Set the HTTP response text (e.g. |
void |
setServer(java.lang.String s)
Deprecated. Set the name of the server producing the document. |
void |
writeHeader(RequestEvent e)
Deprecated. Use writeResponse( RequestEvent e ) instead. |
void |
writeResponse(RequestEvent e)
Deprecated. Produce the HTTP header and store it in the MegOutputStream
associated with this RequestEvent. |
| Methods inherited from class com.ibm.wbi.protocol.http.HttpBase |
add, change, get, getAll, getContent, getContentLength, getContentType, getKeys, getProtocolVersion, initialize, remove, remove, removeAll, set, setContent, setContentLength, setContentType, setProtocolVersion |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String COPYRIGHT
protected static final java.lang.String DEFAULT_SERVER
protected static final java.lang.String DEFAULT_CONTENT_TYPE
protected static final java.lang.String DEFAULT_RESPONSE_CODE
protected static final java.lang.String DEFAULT_RESPONSE_MESSAGE
protected HttpResponseHeader rheader
| Constructor Detail |
public HttpResponse()
public HttpResponse(SystemContext sct)
sct - The SystemContext.
public HttpResponse(ResponseToRequest rtr,
boolean loadContent)
MegInputStream.rtr - The ResponseToRequest containing the header fields
for the response. E.g., ServiceResult or RequestEvent.loadContent - If true, the content (if any) will
be loaded from the input stream and loaded into
the Content property of this object. Otherwise,
any content will be left in the input stream.
Since the content can be arbitrarily large,
caution should be exercised to make sure that
you don't load too much stuff into memory.public HttpResponse(java.lang.String header)
header - An HTTP 1.0 response header, such as:
HTTP/1.0 200 Ok \r\n
content-length: 500 \r\n
content-type: text/html \r\n
\r\n
| Method Detail |
public void removeContentLength()
public void removeWindowTarget()
public void setResponseCode(int c)
c - The ResponseCode.public void setResponseText(java.lang.String t)
t - The ResponseText.public void setServer(java.lang.String s)
s - The name of the server.public void setCache(boolean c)
c - if true, the browser is allowed to cache the
page; if false, the browser should notpublic boolean isCache()
setCache(boolean)
public void addCookie(java.lang.String name,
java.lang.String value,
java.util.Date expires,
java.lang.String domain,
java.lang.String path,
boolean secure)
name - Name of the cookie (required)value - Value of the cookie (required)expires - When the cookie expires (may be null)domain - The domain over which the cookie should be sent back to
the server (may be null)path - The path for which the cookie should be sent back to the
server (may be null)secure - If true, the cookie will only be passed back over secure
linkspublic int getResponseCode()
public java.lang.String getResponseText()
public java.lang.String getServer()
protected java.lang.String produceCurrentDate()
public java.lang.String produceResponseWithoutContent()
public java.lang.String produceHeader()
produceResponseWithoutContent()public java.lang.String produceResponseWithContent()
public void writeResponse(RequestEvent e)
MegOutputStream
associated with this RequestEvent. Replaces the deprecated method
writeHeader(...).e - The request event.public void writeHeader(RequestEvent e)
MegOutputStream
associated with this RequestEvent.e - The request event.writeResponse( RequestEvent )public void parseResponseHeader(java.lang.String h)
header - The header.public void loadResponseContent(ResponseToRequest rtr)
RequestEvent
into the Content property of this HTTP Response object.rtr - ResponseToRequest (RequestEvent or ServiceResult)public static void main(java.lang.String[] args)
args - Command line arguments.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||