|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.mwi.mobileok.basic.FailedRetrievalElement
public class FailedRetrievalElement
An instance of the class represents an exchange that failed during while trying to retrieve a resource
Field Summary | |
---|---|
private java.lang.Exception |
exception
Exception that was raised when retrieval failed. |
Constructor Summary | |
---|---|
FailedRetrievalElement(java.lang.Exception exception)
Creates an instance from the given exception. |
Method Summary | |
---|---|
java.lang.String |
getContentType()
Returns the content-type of the retrieved resource. |
java.lang.String |
getContentTypeEncoding()
Extracts the encoding defined along with the content-type of the resource (e.g. |
java.lang.Exception |
getException()
Returns the exception that was raised when retrieval failed. |
byte[] |
getRawBody()
Returns the body of the retrieved resource as binary data. |
int |
getRawBodySize()
Returns the size of the retrieved resource. |
java.net.URI |
getUri()
Returns the absolute URI of the retrieved resource. |
org.w3c.dom.Node |
toMokiNode(org.w3c.dom.Document document,
org.w3c.dom.Node parent,
ResourceContext context)
Serializes the retrieval element to its moki representation as a DOM node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.lang.Exception exception
Constructor Detail |
---|
public FailedRetrievalElement(java.lang.Exception exception)
exception
- exception that was raised when retrieval failed.Method Detail |
---|
public java.lang.String getContentType()
RetrievalElement
The Content-Type may either be explicitly defined, e.g. in a Content-Type HTTP header, or guessed from whatever means. The Content-Type will be used to select the most appropriate parser for the resource.
getContentType
in interface RetrievalElement
public byte[] getRawBody()
RetrievalElement
getRawBody
in interface RetrievalElement
null
when the resource was too large,
or when a network error occurred.public int getRawBodySize()
RetrievalElement
The size is computed even when the response was too large.
getRawBodySize
in interface RetrievalElement
public java.net.URI getUri()
RetrievalElement
getUri
in interface RetrievalElement
public java.lang.Exception getException()
public org.w3c.dom.Node toMokiNode(org.w3c.dom.Document document, org.w3c.dom.Node parent, ResourceContext context)
RetrievalElement
Note that in an ideal world, there should be no need to pass the context that gave birth to the creation of the retrieval element as an argument, but HTTP error codes defined in mobileOK depend on the context, so it seems easier to issue the appropriate error code in the serialization rather than having to compute it afterwards depending on the location of the error code in the moki representation.
toMokiNode
in interface RetrievalElement
document
- DOM document the created node should belong toparent
- DOM node to which the representation should be appended.context
- context under which the retrieval element was created.
The context is needed to return the appropriate error
messages when the resource could not be retrieved.
public java.lang.String getContentTypeEncoding()
RetrievalElement
Content-Type
HTTP header
received in the HTTP Response)
getContentTypeEncoding
in interface RetrievalElement
Content-Type
header,
null
if not found.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |