|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.w3c.mwi.mobileok.basic.FragmentRetrievalElement
public class FragmentRetrievalElement
An instance of the class represents a textual fragment of a retrieved resource.
The goal of the class is to define specific resources that are contained within another resource. As a typical example, this class is used to represent embedded and inline CSS styles within an XHTML page.
Field Summary | |
---|---|
private FragmentBoxType |
boxType
Box type of the fragment (block or inline). |
private java.lang.String |
contentType
Fragment Content-Type |
private int |
line
Starting line number of the fragment within the original resource. |
private byte[] |
rawBody
Fragment, encoded as UTF-8. |
private int |
rawBodySize
Fragment size. |
private java.net.URI |
uri
URI of the retrieved resource. |
Constructor Summary | |
---|---|
FragmentRetrievalElement(java.net.URI uri,
java.lang.String fragment,
java.lang.String contentType,
FragmentBoxType boxType,
int line)
Creates a class instance from the given textual section. |
Method Summary | |
---|---|
FragmentBoxType |
getBoxType()
Returns the box type of the fragment (block or inline). |
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. |
int |
getLine()
Returns the starting line of the fragment within its containing resource. |
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, and in practice returns null because fragment content is by
definition embedded in some other resource, and thus was not retrieved per
se. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.net.URI uri
private byte[] rawBody
private final int rawBodySize
private final java.lang.String contentType
private final FragmentBoxType boxType
private final int line
Constructor Detail |
---|
public FragmentRetrievalElement(java.net.URI uri, java.lang.String fragment, java.lang.String contentType, FragmentBoxType boxType, int line)
uri
- Absolute URI of the underlying resource.fragment
- Textual fragment to representcontentType
- Content-Type of the fragmentboxType
- Box type of the fragmentline
- Line where the section starts, -1
means not set.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 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.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 int getLine()
-1
means not set.public FragmentBoxType getBoxType()
public org.w3c.dom.Node toMokiNode(org.w3c.dom.Document document, org.w3c.dom.Node parent, ResourceContext context)
null
because fragment content is by
definition embedded in some other resource, and thus was not retrieved per
se.
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |