Java Code Examples for com.gargoylesoftware.htmlunit.WebResponse#getStatusMessage()

The following examples show how to use com.gargoylesoftware.htmlunit.WebResponse#getStatusMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FalsifyingWebConnection.java    From htmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Builds a WebResponse with new content, preserving all other information.
 * @param wr the web response to adapt
 * @param newContent the new content to place in the response
 * @return a web response with the new content
 * @throws IOException if an encoding problem occurred
 */
protected WebResponse replaceContent(final WebResponse wr, final String newContent) throws IOException {
    final byte[] body = newContent.getBytes(wr.getContentCharset());
    final WebResponseData wrd = new WebResponseData(body, wr.getStatusCode(), wr.getStatusMessage(),
        wr.getResponseHeaders());
    return new WebResponse(wrd, wr.getWebRequest().getUrl(), wr.getWebRequest().getHttpMethod(),
            wr.getLoadTime());
}
 
Example 2
Source File: FalsifyingWebConnection.java    From HtmlUnit-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Builds a WebResponse with new content, preserving all other information.
 * @param wr the web response to adapt
 * @param newContent the new content to place in the response
 * @return a web response with the new content
 * @throws IOException if an encoding problem occurred
 */
protected WebResponse replaceContent(final WebResponse wr, final String newContent) throws IOException {
    final byte[] body = newContent.getBytes(wr.getContentCharset());
    final WebResponseData wrd = new WebResponseData(body, wr.getStatusCode(), wr.getStatusMessage(),
        wr.getResponseHeaders());
    return new WebResponse(wrd, wr.getWebRequest().getUrl(), wr.getWebRequest().getHttpMethod(),
            wr.getLoadTime());
}