クラス DelegatingWebConnection

java.lang.ObjectSE
org.springframework.test.web.servlet.htmlunit.DelegatingWebConnection
実装されたすべてのインターフェース:
com.gargoylesoftware.htmlunit.WebConnectionAutoCloseableSE

public final class DelegatingWebConnection extends ObjectSE implements com.gargoylesoftware.htmlunit.WebConnection
さまざまな WebConnection 実装への委譲を可能にする WebConnection の実装。

例: ドメイン code.jquery.com で JavaScript をホストしている場合、以下を使用できます。

 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
  • コンストラクターの詳細

  • メソッドの詳細

    • getResponse

      public com.gargoylesoftware.htmlunit.WebResponse getResponse(com.gargoylesoftware.htmlunit.WebRequest request) throws IOExceptionSE
      次で指定:
      インターフェース com.gargoylesoftware.htmlunit.WebConnectiongetResponse 
      例外:
      IOExceptionSE
    • close

      public void close()
      次で指定:
      インターフェース AutoCloseableSEclose 
      次で指定:
      インターフェース com.gargoylesoftware.htmlunit.WebConnectionclose