类 DelegatingWebConnection
- java.lang.Object
- org.springframework.test.web.servlet.htmlunit.DelegatingWebConnection
- 所有已实现的接口:
com.gargoylesoftware.htmlunit.WebConnection,AutoCloseable
public final class DelegatingWebConnection extends Object implements com.gargoylesoftware.htmlunit.WebConnection
Implementation ofWebConnectionthat allows delegating to variousWebConnectionimplementations.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, webClient); 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);- 从以下版本开始:
- 4.2
- 作者:
- Rob Winch, Sam Brannen
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classDelegatingWebConnection.DelegateWebConnection
构造器概要
构造器 构造器 说明 DelegatingWebConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection, List<DelegatingWebConnection.DelegateWebConnection> connections)DelegatingWebConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection, DelegatingWebConnection.DelegateWebConnection... connections)
构造器详细资料
DelegatingWebConnection
public DelegatingWebConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection, List<DelegatingWebConnection.DelegateWebConnection> connections)
DelegatingWebConnection
public DelegatingWebConnection(com.gargoylesoftware.htmlunit.WebConnection defaultConnection, DelegatingWebConnection.DelegateWebConnection... connections)
方法详细资料
getResponse
public com.gargoylesoftware.htmlunit.WebResponse getResponse(com.gargoylesoftware.htmlunit.WebRequest request) throws IOException
- 指定者:
getResponse在接口中com.gargoylesoftware.htmlunit.WebConnection- 抛出:
IOException
close
public void close()
- 指定者:
close在接口中AutoCloseable