|
Oracle Application Server HTTPClient Java API Reference 10g Release 3 (10.1.3.1.0) B32117-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
HTTPClient.Response
This class represents an intermediate response. It's used internally by the modules. When all modules have handled the response then the HTTPResponse fills in its fields with the data from this class.
| Field Summary | |
static int |
CD_0Content delimiter - no body |
static int |
CD_CHUNKEDContent delimiter - via chunked transfer encoding |
static int |
CD_CLOSEContent delimiter - by closing connection |
static int |
CD_CONTLENContent delimiter - via the Content-Length header |
static int |
CD_HDRSContent delimiter - reading headers/trailers |
static int |
CD_MP_BRContent delimiter - via multipart/byteranges |
static int |
CD_NONEContent delimiter - raw read from the stream |
static int |
HTTPplain http |
static int |
HTTP_1_0HTTP 1.0 |
static int |
HTTP_1_1HTTP 1.1 |
static int |
HTTP_NGhttp next-generation |
static int |
HTTPShttp on top of SSL |
java.io.InputStream |
inp_streamour input stream (usually from the stream demux). |
static int |
SHTTPsecure http |
| Constructor Summary | |
Response(java.lang.String version, int status, java.lang.String reason, NVPair[] headers, byte[] data, java.io.InputStream is, int cont_len)Create a new response with the given info. |
|
| Method Summary | |
java.lang.Object |
clone() |
void |
deleteHeader(java.lang.String header)Removes a header field from the list of headers. |
void |
deleteTrailer(java.lang.String trailer)Removes a trailer field from the list of trailers. |
byte[] |
getData()Reads all the response data into a byte array. |
URI |
getEffectiveURI()get the final URI of the document. |
java.net.URL |
getEffectiveURL()Deprecated. use getEffectiveURI() instead |
java.lang.String |
getHeader(java.lang.String hdr)retrieves the field for a given header. |
java.util.Date |
getHeaderAsDate(java.lang.String hdr)retrieves the field for a given header. |
int |
getHeaderAsInt(java.lang.String hdr)retrieves the field for a given header. |
java.io.InputStream |
getInputStream()Gets an input stream from which the returned data can be read. |
int |
getPhysicalConnections()Accessor for the number of physical connections created for this response, should be 0 or 1 in most cases |
java.lang.String |
getReasonLine()give the reason line associated with the status code. |
int |
getStatusCode()give the status code for this request. |
java.lang.String |
getTrailer(java.lang.String trailer)Retrieves the field for a given trailer. |
java.util.Date |
getTrailerAsDate(java.lang.String trailer)Retrieves the field for a given trailer. |
int |
getTrailerAsInt(java.lang.String trailer)Retrieves the field for a given tailer. |
java.lang.String |
getVersion()get the HTTP version used for the response. |
boolean |
hasEntity()Some responses such as those from a HEAD or with certain status codes don't have an entity. |
boolean |
retryRequest() |
void |
setEffectiveURI(URI final_uri)set the final URI of the document. |
void |
setEffectiveURL(java.net.URL final_url)Deprecated. use setEffectiveURI() instead |
void |
setHeader(java.lang.String header, java.lang.String value)Set a header field in the list of headers. |
void |
setRetryRequest(boolean flag)Should the request be retried by the application? This can be used by modules to signal to the application that it should retry the request. |
void |
setTrailer(java.lang.String trailer, java.lang.String value)Set a trailer field in the list of trailers. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public java.io.InputStream inp_stream
public static final int HTTP
public static final int HTTPS
public static final int SHTTP
public static final int HTTP_NG
public static final int HTTP_1_0
public static final int HTTP_1_1
public static final int CD_NONE
public static final int CD_HDRS
public static final int CD_0
public static final int CD_CLOSE
public static final int CD_CONTLEN
public static final int CD_CHUNKED
public static final int CD_MP_BR
| Constructor Detail |
public Response(java.lang.String version,
int status,
java.lang.String reason,
NVPair[] headers,
byte[] data,
java.io.InputStream is,
int cont_len)
If data is not null then that is used; else if the is is not null that is used; else the entity is empty. If the input stream is used then cont_len specifies the length of the data that can be read from it, or -1 if unknown.
version - the response version (such as "HTTP/1.1")status - the status codereason - the reason lineheaders - the response headersdata - the response entityis - the response entity as an InputStreamcont_len - the length of the data in the InputStream| Method Detail |
public final int getStatusCode()
throws java.io.IOException
getStatusCode in interface RoResponsejava.io.IOException - If any exception occurs on the socket.
public final java.lang.String getReasonLine()
throws java.io.IOException
getReasonLine in interface RoResponsejava.io.IOException - If any exception occurs on the socket.
public final java.lang.String getVersion()
throws java.io.IOException
getVersion in interface RoResponsejava.io.IOException - If any exception occurs on the socket.public int getPhysicalConnections()
public final URI getEffectiveURI()
throws java.io.IOException
java.io.IOException - If any exception occurs on the socket.public void setEffectiveURI(URI final_uri)
public final java.net.URL getEffectiveURL()
throws java.io.IOException
java.io.IOException - If any exception occurs on the socket.getEffectiveURI()public void setEffectiveURL(java.net.URL final_url)
setEffectiveURI(HTTPClient.URI)
public java.lang.String getHeader(java.lang.String hdr)
throws java.io.IOException
getHeader in interface RoResponsehdr - the header name.java.io.IOException - If any exception occurs on the socket.
public int getHeaderAsInt(java.lang.String hdr)
throws java.io.IOException,
java.lang.NumberFormatException
getHeaderAsInt in interface RoResponsehdr - the header name.java.lang.NumberFormatException - if the header's value is not a number or if the header does not exist.java.io.IOException - if any exception occurs on the socket.
public java.util.Date getHeaderAsDate(java.lang.String hdr)
throws java.io.IOException,
java.lang.IllegalArgumentException
Note: When sending dates use Util.httpDate().
getHeaderAsDate in interface RoResponsehdr - the header name.java.io.IOException - If any exception occurs on the socket.java.lang.IllegalArgumentException - If the header cannot be parsed as a date or time.
public void setHeader(java.lang.String header,
java.lang.String value)
header - The name of header field to set.value - The value to set the field to.public void deleteHeader(java.lang.String header)
header - The name of header field to remove.
public java.lang.String getTrailer(java.lang.String trailer)
throws java.io.IOException
getData().getTrailer in interface RoResponsetrailer - the trailer name.java.io.IOException - If any exception occurs on the socket.
public int getTrailerAsInt(java.lang.String trailer)
throws java.io.IOException,
java.lang.NumberFormatException
getTrailerAsInt in interface RoResponsetrailer - the tailer name.java.lang.NumberFormatException - if the trailer's value is not a number or if the trailer does not exist.java.io.IOException - if any exception occurs on the socket.
public java.util.Date getTrailerAsDate(java.lang.String trailer)
throws java.io.IOException,
java.lang.IllegalArgumentException
Note: When sending dates use Util.httpDate().
getTrailerAsDate in interface RoResponsetrailer - the trailer name.java.lang.IllegalArgumentException - if the trailer's value is neither a legal date nor a number.java.io.IOException - if any exception occurs on the socket.java.lang.IllegalArgumentException - If the header cannot be parsed as a date or time.
public void setTrailer(java.lang.String trailer,
java.lang.String value)
trailer - The name of trailer field to set.value - The value to set the field to.public void deleteTrailer(java.lang.String trailer)
trailer - The name of trailer field to remove.
public byte[] getData()
throws java.io.IOException
getData in interface RoResponsejava.io.IOException - If any io exception occured while reading the datagetInputStream()
public java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in interface RoResponsejava.io.IOException - If any exception occurs on the socket.getData()
public boolean hasEntity()
throws java.io.IOException
java.io.IOExceptionpublic void setRetryRequest(boolean flag)
If a module sets this flag then it must also reset() the the HttpOutputStream so it may be reused by the application. It should then also use this HttpOutputStream to recognize the retried request in the requestHandler().
flag - indicates whether the application should retry the request.public boolean retryRequest()
public java.lang.Object clone()
|
Oracle Application Server HTTPClient Java API Reference 10g Release 3 (10.1.3.1.0) B32117-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||