|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RetrievalElement
Interface that represents a client/server exchange when a Web resource is being retrieved.
Depending on the scheme of the URI of the Web resource being retrieved, classes that implement the interface may provide much more details on the exchange, and in particular details on the request that was sent and/or on the headers of the response that was received.
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. |
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. |
Method Detail |
---|
byte[] getRawBody()
null
when the resource was too large,
or when a network error occurred.int getRawBodySize()
The size is computed even when the response was too large.
java.net.URI getUri()
java.lang.String getContentType()
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.
java.lang.String getContentTypeEncoding()
Content-Type
HTTP header
received in the HTTP Response)
Content-Type
header,
null
if not found.org.w3c.dom.Node toMokiNode(org.w3c.dom.Document document, org.w3c.dom.Node parent, ResourceContext context)
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.
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |