public final class DelegatingWebConnection
extends java.lang.Object
implements com.gargoylesoftware.htmlunit.WebConnection
Implementation of WebConnection that allows delegating to various WebConnection implementations. For example, if you host your JavaScript on the domain code.jquery.com, you might want to use the following:
WebClient webClient = new WebClient(); MockMvc mockMvc = ... MockMvcWebConnection mockConnection = new MockMvcWebConnection(mockMvc); WebRequestMatcher cdnMatcher = new UrlRegexRequestMatcher(".*?//code.jquery.com/.*"); WebConnection httpConnection = new HttpWebConnection(webClient); WebConnection webConnection = new DelegatingWebConnection(mockConnection, new DelegateWebConnection(cdnMatcher, httpConnection)); webClient.setWebConnection(webConnection); WebClient webClient = new WebClient(); webClient.setWebConnection(webConnection);
Modifier and Type | Class and Description |
---|---|
static class |
DelegatingWebConnection.DelegateWebConnection |
Constructor and Description |
---|
DelegatingWebConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection,
DelegatingWebConnection.DelegateWebConnection... connections) |
DelegatingWebConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection,
java.util.List<DelegatingWebConnection.DelegateWebConnection> connections) |
Modifier and Type | Method and Description |
---|---|
com.gargoylesoftware.htmlunit.WebResponse |
getResponse(com.gargoylesoftware.htmlunit.WebRequest request) |
public DelegatingWebConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection, java.util.List<DelegatingWebConnection.DelegateWebConnection> connections)
public DelegatingWebConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection, DelegatingWebConnection.DelegateWebConnection... connections)