com.sun.lwuit.html
Class DocumentInfo

java.lang.Object
  extended by com.sun.lwuit.html.DocumentInfo

public class DocumentInfo
extends java.lang.Object

DocumentInfo holds important information about a document that is loading. This class is constructed internally by HTMLComponent and HTMLForm and is sent to the RequestHandler. It is intended for the RequestHandler to use and update (For example update encoding according to the HTTP response, update URL in case of a redirect etc.)


Field Summary
static java.lang.String ENCODING_ISO
          ISO-8859-1 encoding, the default one
static java.lang.String ENCODING_UTF8
          UTF8 encoding, very common
static int TYPE_CSS
          Indicates that the request is for a CSS file
static int TYPE_HTML
          Indicates that the request is for a page
static int TYPE_IMAGE
          Indicates that the request is for an image
 
Method Summary
 java.lang.String getBaseURL()
          Returns the base URL for this document
 java.lang.String getEncoding()
          Returns a string describing the document's encoding
 int getExpectedContentType()
          Returns the expected content type, one of TYPE_HTML, TYPE_IMAGE or TYPE_CSS
 java.lang.String getFullUrl()
          Returns the full url string including parameters in GET request
 java.lang.String getParams()
          Returns the request paramter as an percentage-encoded string
 java.lang.String getUrl()
          Returns the absolute URL associated with this DocumentInfo object
 boolean isPostRequest()
          Returns whether this document request is a POST request or not
 void setBaseURL(java.lang.String baseURL)
          Sets the base URL for this document.
 void setEncoding(java.lang.String encoding)
          Sets the document encoding (This can be determined via the charset attribute in the response)
 void setExpectedContentType(int requestType)
          Sets this expected content type to be either TYPE_HTML, TYPE_IMAGE or TYPE_CSS When the document itself is requested the type will be TYPE_HTML and when images in the document are requested the type will be TYPE_IMAGE The differentiation is important to handle cases in which the HTMLComponent expects one type but the URL is has a resource of another type
 void setParams(java.lang.String params)
          Sets the request paramters of this request
 void setPostRequest(boolean postRequest)
          Sets this DocumentInfo as using a POST request or not
 void setUrl(java.lang.String url)
          Sets the URL to the specified URL
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING_ISO

public static final java.lang.String ENCODING_ISO
ISO-8859-1 encoding, the default one

See Also:
Constant Field Values

ENCODING_UTF8

public static final java.lang.String ENCODING_UTF8
UTF8 encoding, very common

See Also:
Constant Field Values

TYPE_HTML

public static int TYPE_HTML
Indicates that the request is for a page


TYPE_IMAGE

public static int TYPE_IMAGE
Indicates that the request is for an image


TYPE_CSS

public static int TYPE_CSS
Indicates that the request is for a CSS file

Method Detail

getUrl

public java.lang.String getUrl()
Returns the absolute URL associated with this DocumentInfo object

Returns:
the absolute URL associated with this DocumentInfo object

getFullUrl

public java.lang.String getFullUrl()
Returns the full url string including parameters in GET request

Returns:
the full url string including parameters in GET request

setUrl

public void setUrl(java.lang.String url)
Sets the URL to the specified URL

Parameters:
url - the URL to set as the URL of the document

getExpectedContentType

public int getExpectedContentType()
Returns the expected content type, one of TYPE_HTML, TYPE_IMAGE or TYPE_CSS

Returns:
the expected content type, one of TYPE_HTML, TYPE_IMAGE or TYPE_CSS

setExpectedContentType

public void setExpectedContentType(int requestType)
Sets this expected content type to be either TYPE_HTML, TYPE_IMAGE or TYPE_CSS When the document itself is requested the type will be TYPE_HTML and when images in the document are requested the type will be TYPE_IMAGE The differentiation is important to handle cases in which the HTMLComponent expects one type but the URL is has a resource of another type

Parameters:
requestType - the requestType to set, one of TYPE_HTML, TYPE_IMAGE or TYPE_CSS

isPostRequest

public boolean isPostRequest()
Returns whether this document request is a POST request or not

Returns:
true if the document was requested via POST, false otherwise

setPostRequest

public void setPostRequest(boolean postRequest)
Sets this DocumentInfo as using a POST request or not

Parameters:
postRequest - true if this is a POST request, false otherwise

getParams

public java.lang.String getParams()
Returns the request paramter as an percentage-encoded string

Returns:
the request paramter as an encoded string

setParams

public void setParams(java.lang.String params)
Sets the request paramters of this request

Parameters:
params - The request paramters to set, should be as a percentage encoded string

getEncoding

public java.lang.String getEncoding()
Returns a string describing the document's encoding

Returns:
the document's encoding

setEncoding

public void setEncoding(java.lang.String encoding)
Sets the document encoding (This can be determined via the charset attribute in the response)

Parameters:
encoding - the encoding to set. It is recommended to use the ENCODING_* constants when possible to avoid typos

getBaseURL

public java.lang.String getBaseURL()
Returns the base URL for this document

Returns:
the baseURL

setBaseURL

public void setBaseURL(java.lang.String baseURL)
Sets the base URL for this document. Usually this is deduced automatically from the page URL, but in some cases this is different, for example when an HREF attribute is provided in the BASE tag

Parameters:
baseURL - the baseURL to set