クラス DelegatingWebConnection

java.lang.ObjectSE
org.springframework.test.web.servlet.htmlunit.DelegatingWebConnection
実装されているすべてのインターフェース:
AutoCloseableSE, org.htmlunit.WebConnection

public final class DelegatingWebConnection extends ObjectSE implements org.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 org.htmlunit.WebResponse getResponse(org.htmlunit.WebRequest request) throws IOExceptionSE
      次で指定:
      インターフェース org.htmlunit.WebConnectiongetResponse 
      例外:
      IOExceptionSE
    • close

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