|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.impl.http.AbstractHTTPResponse
public abstract class AbstractHTTPResponse
An AbstractHTTPResponse
consists of a SSWAPDocument as the
return pay load of an invocation, along with the network response object.
Methods are supplied to get the SSWAPDocument and the response, for example
to query the return code or header information.
If a document is successfully stored, then the underlying connection is
closed and the document may be read from getDocument
. Otherwise
(on error), the connection is left open for reading and should be closed by
the caller.
The class is marked abstract to indicate that getDocument
should
be overridden to return a specific type of document, such as:
RDG getRDG() {
return (RDG) getDocument();
}
SSWAPDocument
Field Summary | |
---|---|
private java.lang.Exception |
exception
|
private com.clarkparsia.utils.web.Response |
response
|
private static java.lang.String |
SSWAP_HTTP_EXCEPTION_HEADER
|
private SSWAPDocument |
sswapDocument
|
Constructor Summary | |
---|---|
AbstractHTTPResponse(SSWAPDocument sswapDocument,
com.clarkparsia.utils.web.Response response)
The constructor sets the SSWAPDocument and response object. |
|
AbstractHTTPResponse(SSWAPDocument sswapDocument,
com.clarkparsia.utils.web.Response response,
java.lang.Exception exception)
The constructor sets the SSWAPDocument and response object. |
Method Summary | |
---|---|
void |
close()
Close this response |
java.io.InputStream |
getContent()
Return the response content from the server |
protected SSWAPDocument |
getDocument()
Concrete class should use this method and cast to return a specific type of SSWAPModel. |
java.io.InputStream |
getErrorStream()
Return the error stream from the connection |
java.lang.Exception |
getException()
Not currently exposed in the RRGResponse interface. |
java.util.Collection<java.lang.String> |
getHeaders()
Return all headers returned by the server |
java.lang.String |
getHeaderValue(java.lang.String headerName)
Returns the unparsed value of the HTTP header |
java.util.Collection<java.lang.String> |
getHeaderValues(java.lang.String headerName)
Returns the values of the HTTP header parsed on the comma delimiter |
java.lang.String |
getMessage()
Return the response message from the server |
int |
getResponseCode()
Return the response code |
java.lang.String |
getSSWAPExceptionHeader()
Returns the header being used for SSWAP Exceptions. |
java.util.Collection<java.lang.String> |
getSSWAPExceptionValues()
Returns values, if any, for the SSWAP Exception Header(s). |
boolean |
hasErrorCode()
Return whether or not this has an error result |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String SSWAP_HTTP_EXCEPTION_HEADER
private com.clarkparsia.utils.web.Response response
private SSWAPDocument sswapDocument
private java.lang.Exception exception
Constructor Detail |
---|
public AbstractHTTPResponse(SSWAPDocument sswapDocument, com.clarkparsia.utils.web.Response response)
sswapDocument
- the resultant SSWAPDocument from the invocation (e.g., RDG);
may be null to indicate a failure to create a SSWAPDocument.
In that case, the response object may be interrogated and
should be closed when finished.response
- the network Response object from the invocation; may be
null if it was impossible to establish an HTTP connectionpublic AbstractHTTPResponse(SSWAPDocument sswapDocument, com.clarkparsia.utils.web.Response response, java.lang.Exception exception)
sswapDocument
- the resultant SSWAPDocument from the invocation (e.g., RDG);
may be null to indicate a failure to create a SSWAPDocument.
In that case, the response object may be interrogated and
should be closed when finished.response
- the network Response object from the invocation; may be
null if it was impossible to establish an HTTP connectionexception
- the exception that occurred during the invocation (may be null
for successful invocations).Method Detail |
---|
protected SSWAPDocument getDocument()
public java.io.InputStream getErrorStream()
HTTPResponse
getErrorStream
in interface HTTPResponse
public java.lang.String getMessage()
HTTPResponse
getMessage
in interface HTTPResponse
public java.util.Collection<java.lang.String> getHeaders()
HTTPResponse
getHeaders
in interface HTTPResponse
public java.lang.String getHeaderValue(java.lang.String headerName)
HTTPResponse
getHeaderValue
in interface HTTPResponse
headerName
- the header name
headerName
does not existpublic java.util.Collection<java.lang.String> getHeaderValues(java.lang.String headerName)
HTTPResponse
getHeaderValues
in interface HTTPResponse
headerName
- the header name
headerName
does not existpublic java.util.Collection<java.lang.String> getSSWAPExceptionValues()
HTTPResponse
getSSWAPExceptionValues
in interface HTTPResponse
HTTPResponse.getSSWAPExceptionHeader()
public java.lang.String getSSWAPExceptionHeader()
HTTPResponse
getSSWAPExceptionHeader
in interface HTTPResponse
HTTPResponse.getSSWAPExceptionValues()
public java.lang.Exception getException()
getException
in interface HTTPResponse
public int getResponseCode()
HTTPResponse
getResponseCode
in interface HTTPResponse
public java.io.InputStream getContent()
HTTPResponse
getContent
in interface HTTPResponse
public boolean hasErrorCode()
HTTPResponse
hasErrorCode
in interface HTTPResponse
public void close() throws java.io.IOException
HTTPResponse
close
in interface HTTPResponse
java.io.IOException
- if there is an error while closing
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |