public class DocumentInfo extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ENCODING_ISO
ISO-8859-1 encoding, the default one
|
static 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
|
Modifier and Type | Method and Description |
---|---|
String |
getBaseURL()
Returns the base URL for this document
|
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
|
String |
getFullUrl()
Returns the full url string including parameters in GET request
|
String |
getParams()
Returns the request paramter as a percentage-encoded string
|
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(String baseURL)
Sets the base URL for this document.
|
static void |
setDefaultEncoding(String encoding)
Sets the default encoding for the document e.g.
|
void |
setEncoding(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(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(String url)
Sets the URL to the specified URL
|
public static final String ENCODING_ISO
public static final String ENCODING_UTF8
public static int TYPE_HTML
public static int TYPE_IMAGE
public static int TYPE_CSS
public static void setDefaultEncoding(String encoding)
encoding
- the encoding string matching ISO standardspublic String getUrl()
public String getFullUrl()
public void setUrl(String url)
url
- the URL to set as the URL of the documentpublic int getExpectedContentType()
public void setExpectedContentType(int requestType)
requestType
- the requestType to set, one of TYPE_HTML, TYPE_IMAGE or TYPE_CSSpublic boolean isPostRequest()
public void setPostRequest(boolean postRequest)
postRequest
- true if this is a POST request, false otherwisepublic String getParams()
public void setParams(String params)
params
- The request paramters to set, should be as a percentage encoded stringpublic String getEncoding()
public void setEncoding(String encoding)
encoding
- the encoding to set. It is recommended to use the ENCODING_* constants when possible to avoid typospublic String getBaseURL()
public void setBaseURL(String baseURL)
baseURL
- the baseURL to set