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:
java.io.Serializable
- Enclosing class:
- XMLHttpRequest
private static final class XMLHttpRequest.NetworkErrorWebResponse extends WebResponse
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.IOExceptionerror_private WebRequestrequest_
-
Constructor Summary
Constructors Constructor Description NetworkErrorWebResponse(WebRequest webRequest, java.io.IOException error)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStreamgetContentAsStream()Returns the response content as an input stream.java.lang.StringgetContentAsString()Returns the response content as a string, using the charset/encoding specified in the server response.java.nio.charset.CharsetgetContentCharset()Returns the content charset for this response, even if no charset was specified explicitly.java.nio.charset.CharsetgetContentCharsetOrNull()Returns the content charset specified explicitly in the header or in the content, ornullif none was specified.java.lang.StringgetContentType()Returns the content type returned from the server, e.g.java.io.IOExceptiongetError()longgetLoadTime()Returns the time it took to load this web response, in milliseconds.java.util.List<NameValuePair>getResponseHeaders()Returns the response headers as a list ofNameValuePairs.java.lang.StringgetResponseHeaderValue(java.lang.String headerName)Returns the value of the specified response header.intgetStatusCode()Returns the status code that was returned by the server.java.lang.StringgetStatusMessage()Returns the status message that was returned from the server.WebRequestgetWebRequest()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 Detail
-
request_
private final WebRequest request_
-
error_
private final java.io.IOException error_
-
-
Constructor Detail
-
NetworkErrorWebResponse
NetworkErrorWebResponse(WebRequest webRequest, java.io.IOException error)
-
-
Method Detail
-
getStatusCode
public int getStatusCode()
Description copied from class:WebResponseReturns the status code that was returned by the server.- Overrides:
getStatusCodein classWebResponse- Returns:
- the status code that was returned by the server
-
getStatusMessage
public java.lang.String getStatusMessage()
Description copied from class:WebResponseReturns the status message that was returned from the server.- Overrides:
getStatusMessagein classWebResponse- Returns:
- the status message that was returned from the server
-
getContentType
public java.lang.String getContentType()
Description copied from class:WebResponseReturns the content type returned from the server, e.g. "text/html".- Overrides:
getContentTypein classWebResponse- Returns:
- the content type returned from the server, e.g. "text/html"
-
getContentAsString
public java.lang.String getContentAsString()
Description copied from class:WebResponseReturns the response content as a string, using the charset/encoding specified in the server response.- Overrides:
getContentAsStringin 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
public java.io.InputStream getContentAsStream()
Description copied from class:WebResponseReturns the response content as an input stream.- Overrides:
getContentAsStreamin classWebResponse- Returns:
- the response content as an input stream
-
getResponseHeaders
public java.util.List<NameValuePair> getResponseHeaders()
Description copied from class:WebResponseReturns the response headers as a list ofNameValuePairs.- Overrides:
getResponseHeadersin classWebResponse- Returns:
- the response headers as a list of
NameValuePairs
-
getResponseHeaderValue
public java.lang.String getResponseHeaderValue(java.lang.String headerName)
Description copied from class:WebResponseReturns the value of the specified response header.- Overrides:
getResponseHeaderValuein classWebResponse- Parameters:
headerName- the name of the header whose value is to be returned- Returns:
- the header value,
nullif no response header exists with this name
-
getLoadTime
public long getLoadTime()
Description copied from class:WebResponseReturns the time it took to load this web response, in milliseconds.- Overrides:
getLoadTimein classWebResponse- Returns:
- the time it took to load this web response, in milliseconds
-
getContentCharset
public java.nio.charset.Charset getContentCharset()
Description copied from class:WebResponseReturns 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-Typeheader 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_8by default.- Overrides:
getContentCharsetin classWebResponse- Returns:
- the content charset for this response
-
getContentCharsetOrNull
public java.nio.charset.Charset getContentCharsetOrNull()
Description copied from class:WebResponseReturns the content charset specified explicitly in the header or in the content, ornullif none was specified.- Overrides:
getContentCharsetOrNullin classWebResponse- Returns:
- the content charset specified explicitly in the header or in the content,
or
nullif none was specified
-
getWebRequest
public WebRequest getWebRequest()
Description copied from class:WebResponseReturns the request used to load this response.- Overrides:
getWebRequestin classWebResponse- Returns:
- the request used to load this response
-
getError
public java.io.IOException getError()
- Returns:
- the error
-
-