Package org.htmlunit.javascript.host.xml
Class XMLHttpRequest.NetworkErrorWebResponse
java.lang.Object
org.htmlunit.WebResponse
org.htmlunit.javascript.host.xml.XMLHttpRequest.NetworkErrorWebResponse
- All Implemented Interfaces:
Serializable
- Enclosing class:
XMLHttpRequest
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the response content as an input stream.Returns the response content as a string, using the charset/encoding specified in the server response.Returns the content charset for this response, even if no charset was specified explicitly.Returns the content charset specified explicitly in the header or in the content, ornull
if none was specified.Returns the content type returned from the server, e.g.getError()
long
Returns the time it took to load this web response, in milliseconds.Returns the response headers as a list ofNameValuePair
s.getResponseHeaderValue
(String headerName) Returns the value of the specified response header.int
Returns the status code that was returned by the server.Returns the status message that was returned from the server.Returns the request used to load this response.Methods inherited from class org.htmlunit.WebResponse
cleanUp, defaultCharsetUtf8, getBlockReason, getContentAsStreamWithBomIfApplicable, getContentAsString, getContentLength, getHeaderContentCharset, isSuccess, isSuccessOrUseProxy, isSuccessOrUseProxyOrNotModified, markAsBlocked, wasBlocked, wasContentCharsetTentative
-
Field Details
-
request_
-
error_
-
-
Constructor Details
-
NetworkErrorWebResponse
NetworkErrorWebResponse(WebRequest webRequest, IOException error)
-
-
Method Details
-
getStatusCode
public int getStatusCode()Description copied from class:WebResponse
Returns the status code that was returned by the server.- Overrides:
getStatusCode
in classWebResponse
- Returns:
- the status code that was returned by the server
-
getStatusMessage
Description copied from class:WebResponse
Returns the status message that was returned from the server.- Overrides:
getStatusMessage
in classWebResponse
- Returns:
- the status message that was returned from the server
-
getContentType
Description copied from class:WebResponse
Returns the content type returned from the server, e.g. "text/html".- Overrides:
getContentType
in classWebResponse
- Returns:
- the content type returned from the server, e.g. "text/html"
-
getContentAsString
Description copied from class:WebResponse
Returns the response content as a string, using the charset/encoding specified in the server response.- Overrides:
getContentAsString
in classWebResponse
- Returns:
- the response content as a string, using the charset/encoding specified in the server response or null if the content retrieval was failing
-
getContentAsStream
Description copied from class:WebResponse
Returns the response content as an input stream.- Overrides:
getContentAsStream
in classWebResponse
- Returns:
- the response content as an input stream
-
getResponseHeaders
Description copied from class:WebResponse
Returns the response headers as a list ofNameValuePair
s.- Overrides:
getResponseHeaders
in classWebResponse
- Returns:
- the response headers as a list of
NameValuePair
s
-
getResponseHeaderValue
Description copied from class:WebResponse
Returns the value of the specified response header.- Overrides:
getResponseHeaderValue
in classWebResponse
- Parameters:
headerName
- the name of the header whose value is to be returned- Returns:
- the header value,
null
if no response header exists with this name
-
getLoadTime
public long getLoadTime()Description copied from class:WebResponse
Returns the time it took to load this web response, in milliseconds.- Overrides:
getLoadTime
in classWebResponse
- Returns:
- the time it took to load this web response, in milliseconds
-
getContentCharset
Description copied from class:WebResponse
Returns the content charset for this response, even if no charset was specified explicitly.This method always returns a valid charset. This method first checks the
Content-Type
header or in the content BOM for viable charset. If not found, it attempts to determine the charset based on the type of the content. As a last resort, this method returns the value ofWebRequest.getDefaultResponseContentCharset()
which isStandardCharsets.UTF_8
by default.- Overrides:
getContentCharset
in classWebResponse
- Returns:
- the content charset for this response
-
getContentCharsetOrNull
Description copied from class:WebResponse
Returns the content charset specified explicitly in the header or in the content, ornull
if none was specified.- Overrides:
getContentCharsetOrNull
in classWebResponse
- Returns:
- the content charset specified explicitly in the header or in the content,
or
null
if none was specified
-
getWebRequest
Description copied from class:WebResponse
Returns the request used to load this response.- Overrides:
getWebRequest
in classWebResponse
- Returns:
- the request used to load this response
-
getError
- Returns:
- the error
-