Package org.richfaces.test.staging

Examples of org.richfaces.test.staging.StagingConnection$ConnectionResponse


  /* (non-Javadoc)
   * @see com.gargoylesoftware.htmlunit.WebConnection#getResponse(com.gargoylesoftware.htmlunit.WebRequestSettings)
   */
  public WebResponse getResponse(WebRequestSettings settings)
      throws IOException {
    StagingConnection connection = localServer.getConnection(settings.getUrl());
    // Propagate web request settings to the local connection.
    for (NameValuePair param : settings.getRequestParameters()) {
      connection.addRequestParameter(param.getName(), param.getValue());
    }
    HttpMethod httpMethod = HttpMethod.valueOf(settings.getHttpMethod().toString());
    connection.setRequestMethod(httpMethod);
    connection.setRequestCharacterEncoding(settings.getCharset());
    String body = settings.getRequestBody();
    String contentType = settings.getEncodingType().getName();
    connection.setRequestBody(body);
    connection.setRequestContentType(contentType);
    connection.addRequestHeaders(settings.getAdditionalHeaders());
    // HtmlUnit uses request parameters map for the form submit, but does not parse
    // XMLHttpRequest content.
    if(null != body && FormEncodingType.URL_ENCODED.getName().equals(contentType)){
      connection.parseFormParameters(body);
    }
    long startTime = System.currentTimeMillis();
    connection.execute();
    return new LocalWebResponse(settings,connection,System.currentTimeMillis()-startTime);
  }
View Full Code Here

TOP

Related Classes of org.richfaces.test.staging.StagingConnection$ConnectionResponse

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.