use of com.gargoylesoftware.htmlunit.WebResponseData in project spring-framework by spring-projects.
the class MockWebResponseBuilder method build.
public WebResponse build() throws IOException {
WebResponseData webResponseData = webResponseData();
long endTime = System.currentTimeMillis();
return new WebResponse(webResponseData, this.webRequest, endTime - this.startTime);
}
use of com.gargoylesoftware.htmlunit.WebResponseData in project saga by timurstrekalov.
the class WebClientFactory method newInstance.
// New version allows for creation of web drivers without the need for a config object
// which may not be readily available if the driver is created by third-party code.
public static WebClient newInstance(final BrowserVersion version) {
final WebClient client = new WebClient(version) {
@Override
public WebResponse loadWebResponse(final WebRequest webRequest) throws IOException {
return new WebResponseProxy(super.loadWebResponse(webRequest));
}
};
client.setIncorrectnessListener(quietIncorrectnessListener);
client.setJavaScriptErrorListener(loggingJsErrorListener);
client.setHTMLParserListener(quietHtmlParserListener);
client.setCssErrorHandler(quietCssErrorHandler);
client.getOptions().setJavaScriptEnabled(true);
client.setAjaxController(new NicelyResynchronizingAjaxController());
client.getOptions().setThrowExceptionOnScriptError(false);
client.getOptions().setThrowExceptionOnFailingStatusCode(false);
client.getOptions().setPrintContentOnFailingStatusCode(false);
client.setWebConnection(new HttpWebConnection(client) {
@Override
protected WebResponse newWebResponseInstance(final WebResponseData responseData, final long loadTime, final WebRequest request) {
return new WebResponseProxy(super.newWebResponseInstance(responseData, loadTime, request));
}
});
return client;
}
use of com.gargoylesoftware.htmlunit.WebResponseData in project spring-security by spring-projects.
the class MockWebResponseBuilder method build.
WebResponse build() throws IOException {
WebResponseData webResponseData = webResponseData();
long endTime = System.currentTimeMillis();
return new WebResponse(webResponseData, this.webRequest, endTime - this.startTime);
}
use of com.gargoylesoftware.htmlunit.WebResponseData in project spring-security by spring-projects.
the class MockWebResponseBuilder method webResponseData.
private WebResponseData webResponseData() {
List<NameValuePair> responseHeaders = responseHeaders();
HttpStatus status = this.exchangeResult.getStatus();
return new WebResponseData(this.exchangeResult.getResponseBodyContent(), status.value(), status.getReasonPhrase(), responseHeaders);
}
use of com.gargoylesoftware.htmlunit.WebResponseData in project spring-framework by spring-projects.
the class DelegatingWebConnectionTests method setup.
@BeforeEach
public void setup() throws Exception {
request = new WebRequest(new URL("http://localhost/"));
WebResponseData data = new WebResponseData("".getBytes("UTF-8"), 200, "", Collections.emptyList());
expectedResponse = new WebResponse(data, request, 100L);
webConnection = new DelegatingWebConnection(defaultConnection, new DelegateWebConnection(matcher1, connection1), new DelegateWebConnection(matcher2, connection2));
}
Aggregations