Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.WebResponseImpl


          response.setOutputStream(new MockServletOutputStream(baos));
         
          resource.sendHeaders(resourceContext);
          resource.send(resourceContext);
         
          return new WebResponseImpl(
              new WebResponseData(
                  new ByteArrayInputStream(baos.toByteArray()),
                  HttpServletResponse.SC_OK,
                  "OK",
                  resourceContext.getHeaders()),
View Full Code Here


          response.setOutputStream(new MockServletOutputStream(baos));
         
          resource.sendHeaders(resourceContext);
          resource.send(resourceContext);
         
          return new WebResponseImpl(
              new WebResponseData(
                  new ByteArrayInputStream(baos.toByteArray()),
                  HttpServletResponse.SC_OK,
                  "OK",
                  resourceContext.getHeaders()),
View Full Code Here

        try {
            final String decompileScript = (String) factory.call(action);
            final WebResponseData wrd = new WebResponseData(decompileScript.getBytes(), response.getStatusCode(),
                response.getStatusMessage(), response.getResponseHeaders());
            return new WebResponseImpl(wrd, response.getRequestSettings().getUrl(),
                response.getRequestSettings().getHttpMethod(), response.getLoadTime());
        }
        catch (final Exception e) {
            LOG.warn("Failed to decompress JavaScript response. Delivering as it.", e);
        }
View Full Code Here

     */
    public boolean jsxFunction_loadXML(final String strXML) {
        try {
            final List<NameValuePair> emptyList = Collections.emptyList();
            final WebResponseData data = new WebResponseData(strXML.getBytes(), HttpStatus.SC_OK, null, emptyList);
            final WebResponse webResponse = new WebResponseImpl(data, (URL) null, (HttpMethod) null, 0);
            final XmlPage page = new XmlPage(webResponse, getWindow().getWebWindow());
            setDomNode(page);
            return true;
        }
        catch (final IOException e) {
View Full Code Here

     */
    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 WebResponseImpl(wrd, wr.getRequestSettings().getUrl(), wr.getRequestSettings().getHttpMethod(),
                wr.getLoadTime());
    }
View Full Code Here

        final List<NameValuePair> headers = new ArrayList<NameValuePair>();
        final String encoding = "UTF-8";
        headers.add(new NameValuePair("content-type", contentType + "; charset=" + encoding));
        final byte[] body = content.getBytes(encoding);
        final WebResponseData wrd = new WebResponseData(body, responseCode, responseMessage, headers);
        return new WebResponseImpl(wrd, wr.getUrl(), wr.getHttpMethod(), 0);
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.WebResponseImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.