Class DocumentInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringISO-8859-1 encoding, the default onestatic final StringUTF8 encoding, very commonstatic final intIndicates that the request is for a CSS filestatic final intIndicates that the request is for a pagestatic final intIndicates that the request is for an image -
Method Summary
Modifier and TypeMethodDescriptionReturns the base URL for this documentReturns a string describing the document's encodingintReturns the expected content type, one of TYPE_HTML, TYPE_IMAGE or TYPE_CSSReturns the full url string including parameters in GET requestReturns the request paramter as a percentage-encoded stringgetUrl()Returns the absolute URL associated with this DocumentInfo objectbooleanReturns whether this document request is a POST request or notvoidsetBaseURL(String baseURL) Sets the base URL for this document.static voidsetDefaultEncoding(String encoding) Sets the default encoding for the document e.g.voidsetEncoding(String encoding) Sets the document encoding (This can be determined via the charset attribute in the response)voidsetExpectedContentType(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 typevoidSets the request paramters of this requestvoidsetPostRequest(boolean postRequest) Sets this DocumentInfo as using a POST request or notvoidSets the URL to the specified URL
-
Field Details
-
ENCODING_ISO
-
ENCODING_UTF8
-
TYPE_HTML
public static final int TYPE_HTMLIndicates that the request is for a page- See Also:
-
TYPE_IMAGE
public static final int TYPE_IMAGEIndicates that the request is for an image- See Also:
-
TYPE_CSS
public static final int TYPE_CSSIndicates that the request is for a CSS file- See Also:
-
-
Method Details
-
setDefaultEncoding
Sets the default encoding for the document e.g. ENCODING_UTF8
Parameters
encoding: the encoding string matching ISO standards
-
getUrl
Returns the absolute URL associated with this DocumentInfo object
Returns
the absolute URL associated with this DocumentInfo object
-
setUrl
Sets the URL to the specified URL
Parameters
url: the URL to set as the URL of the document
-
getFullUrl
Returns the full url string including parameters in GET request
Returns
the full url string including parameters in GET request
-
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
Returns the request paramter as a percentage-encoded string
Returns
the request paramter as an encoded string
-
setParams
Sets the request paramters of this request
Parameters
params: The request paramters to set, should be as a percentage encoded string
-
getEncoding
Returns a string describing the document's encoding
Returns
the document's encoding
-
setEncoding
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
Returns the base URL for this document
Returns
the baseURL
-
setBaseURL
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
-