类 MockMvcWebClientBuilder


public class MockMvcWebClientBuilder extends MockMvcWebConnectionBuilderSupport<MockMvcWebClientBuilder>
MockMvcWebClientBuilder simplifies the creation of an HtmlUnit WebClient that delegates to a MockMvc instance.

The MockMvc instance used by the builder may be supplied directly or created transparently from a WebApplicationContext.

从以下版本开始:
4.0
作者:
Rob Winch, Sam Brannen
另请参阅:
  • 字段详细资料

    • webClient

      @Nullable private org.htmlunit.WebClient webClient
  • 构造器详细资料

    • MockMvcWebClientBuilder

      protected MockMvcWebClientBuilder(MockMvc mockMvc)
    • MockMvcWebClientBuilder

      protected MockMvcWebClientBuilder(cn.taketoday.web.servlet.WebApplicationContext context)
    • MockMvcWebClientBuilder

      protected MockMvcWebClientBuilder(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer)
  • 方法详细资料

    • mockMvcSetup

      public static MockMvcWebClientBuilder mockMvcSetup(MockMvc mockMvc)
      Create a new MockMvcWebClientBuilder based on the supplied MockMvc instance.
      参数:
      mockMvc - the MockMvc instance to use; never null
      返回:
      the MockMvcWebClientBuilder to customize
    • webAppContextSetup

      public static MockMvcWebClientBuilder webAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context)
      Create a new MockMvcWebClientBuilder based on the supplied WebApplicationContext.
      参数:
      context - the WebApplicationContext to create a MockMvc instance from; never null
      返回:
      the MockMvcWebClientBuilder to customize
    • webAppContextSetup

      public static MockMvcWebClientBuilder webAppContextSetup(cn.taketoday.web.servlet.WebApplicationContext context, MockMvcConfigurer configurer)
      Create a new MockMvcWebClientBuilder based on the supplied WebApplicationContext and MockMvcConfigurer.
      参数:
      context - the WebApplicationContext to create a MockMvc instance from; never null
      configurer - the MockMvcConfigurer to apply; never null
      返回:
      the MockMvcWebClientBuilder to customize
    • withDelegate

      public MockMvcWebClientBuilder withDelegate(org.htmlunit.WebClient webClient)
      Supply the WebClient that the client built by this builder should delegate to when processing non-matching requests.
      参数:
      webClient - the WebClient to delegate to for requests that do not match; never null
      返回:
      this builder for further customization
      另请参阅:
    • build

      public org.htmlunit.WebClient build()
      Build the WebClient configured via this builder.

      The returned client will use the configured MockMvc instance for processing any matching requests and a delegate WebClient for all other requests.

      If a delegate has been explicitly configured, it will be used; otherwise, a default WebClient will be configured as the delegate.

      返回:
      the WebClient to use
      另请参阅: