# Class DocumentInfo

java.lang.Object
com.codename1.ui.html.DocumentInfo

public class DocumentInfo extends 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

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ENCODING_ISO`
  ISO-8859-1 encoding, the default one
  `static final String`
  `ENCODING_UTF8`
  UTF8 encoding, very common
  `static final int`
  `TYPE_CSS`
  Indicates that the request is for a CSS file
  `static final int`
  `TYPE_HTML`
  Indicates that the request is for a page
  `static final int`
  `TYPE_IMAGE`
  Indicates that the request is for an image

- ## Method Summary

  Modifier and Type
  Method
  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

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### ENCODING_ISO

    public static final String ENCODING_ISO
    ISO-8859-1 encoding, the default one
    See Also:
      - Constant Field Values

  - ### ENCODING_UTF8

    public static final String ENCODING_UTF8
    UTF8 encoding, very common
    See Also:
      - Constant Field Values

  - ### TYPE_HTML

    public static final int TYPE_HTML
    Indicates that the request is for a page
    See Also:
      - Constant Field Values

  - ### TYPE_IMAGE

    public static final int TYPE_IMAGE
    Indicates that the request is for an image
    See Also:
      - Constant Field Values

  - ### TYPE_CSS

    public static final int TYPE_CSS
    Indicates that the request is for a CSS file
    See Also:
      - Constant Field Values

- ## Method Details

  - ### setDefaultEncoding

    public static void setDefaultEncoding(String encoding)

    Sets the default encoding for the document e.g. ENCODING_UTF8

    ###### Parameters

    - `encoding`: the encoding string matching ISO standards

  - ### getUrl

    public String getUrl()

    Returns the absolute URL associated with this DocumentInfo object

    ###### Returns

    the absolute URL associated with this DocumentInfo object

  - ### setUrl

    public void setUrl(String url)

    Sets the URL to the specified URL

    ###### Parameters

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

  - ### getFullUrl

    public String 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

    public String getParams()

    Returns the request paramter as a percentage-encoded string

    ###### Returns

    the request paramter as an encoded string

  - ### setParams

    public void setParams(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 String getEncoding()

    Returns a string describing the document's encoding

    ###### Returns

    the document's encoding

  - ### setEncoding

    public void setEncoding(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 String getBaseURL()

    Returns the base URL for this document

    ###### Returns

    the baseURL

  - ### setBaseURL

    public void setBaseURL(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