Java 类org.springframework.web.util.UriTemplateHandler 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RestTemplateBuilder.java   
private RestTemplateBuilder(boolean detectRequestFactory, String rootUri,
        Set<HttpMessageConverter<?>> messageConverters,
        ClientHttpRequestFactory requestFactory,
        UriTemplateHandler uriTemplateHandler, ResponseErrorHandler errorHandler,
        BasicAuthorizationInterceptor basicAuthorization,
        Set<RestTemplateCustomizer> restTemplateCustomizers,
        Set<RequestFactoryCustomizer> requestFactoryCustomizers) {
    super();
    this.detectRequestFactory = detectRequestFactory;
    this.rootUri = rootUri;
    this.messageConverters = messageConverters;
    this.requestFactory = requestFactory;
    this.uriTemplateHandler = uriTemplateHandler;
    this.errorHandler = errorHandler;
    this.basicAuthorization = basicAuthorization;
    this.restTemplateCustomizers = restTemplateCustomizers;
    this.requestFactoryCustomizers = requestFactoryCustomizers;
}
项目:spring-boot-concourse    文件:RestTemplateBuilder.java   
private RestTemplateBuilder(boolean detectRequestFactory, String rootUri,
        Set<HttpMessageConverter<?>> messageConverters,
        ClientHttpRequestFactory requestFactory,
        UriTemplateHandler uriTemplateHandler, ResponseErrorHandler errorHandler,
        BasicAuthorizationInterceptor basicAuthorization,
        Set<RestTemplateCustomizer> customizers) {
    super();
    this.detectRequestFactory = detectRequestFactory;
    this.rootUri = rootUri;
    this.messageConverters = messageConverters;
    this.requestFactory = requestFactory;
    this.uriTemplateHandler = uriTemplateHandler;
    this.errorHandler = errorHandler;
    this.basicAuthorization = basicAuthorization;
    this.customizers = customizers;
}
项目:incubator-servicecomb-java-chassis    文件:TestRestTemplateWrapper.java   
@Test
public void dotNotSetUriTemplateHandlerWithUnderlying() {
  UriTemplateHandler uriTemplateHandler = mock(UriTemplateHandler.class);

  wrapper.setUriTemplateHandler(uriTemplateHandler);

  assertThat(wrapper.getUriTemplateHandler(), is(uriTemplateHandler));
  assertThat(wrapper.defaultRestTemplate.getUriTemplateHandler(), is(uriTemplateHandler));

  verify(underlying, never()).setUriTemplateHandler(uriTemplateHandler);
}
项目:micrometer    文件:MetricsRestTemplateCustomizer.java   
@Override
public void customize(RestTemplate restTemplate) {
    UriTemplateHandler templateHandler = restTemplate.getUriTemplateHandler();
    templateHandler = this.interceptor.createUriTemplateHandler(templateHandler);
    restTemplate.setUriTemplateHandler(templateHandler);
    List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>();
    interceptors.add(this.interceptor);
    interceptors.addAll(restTemplate.getInterceptors());
    restTemplate.setInterceptors(interceptors);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RootUriTemplateHandler.java   
/**
 * Create a new {@link RootUriTemplateHandler} instance.
 * @param rootUri the root URI to be used to prefix relative URLs
 * @param handler the delegate handler
 */
public RootUriTemplateHandler(String rootUri, UriTemplateHandler handler) {
    Assert.notNull(rootUri, "RootUri must not be null");
    Assert.notNull(handler, "Handler must not be null");
    this.rootUri = rootUri;
    this.handler = handler;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RestTemplateBuilderTests.java   
@Test
public void rootUriShouldApplyAfterUriTemplateHandler() throws Exception {
    UriTemplateHandler uriTemplateHandler = mock(UriTemplateHandler.class);
    RestTemplate template = this.builder.uriTemplateHandler(uriTemplateHandler)
            .rootUri("http://example.com").build();
    UriTemplateHandler handler = template.getUriTemplateHandler();
    handler.expand("/hello");
    assertThat(handler).isInstanceOf(RootUriTemplateHandler.class);
    verify(uriTemplateHandler).expand("http://example.com/hello");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RestTemplateBuilderTests.java   
@Test
public void uriTemplateHandlerShouldApply() throws Exception {
    UriTemplateHandler uriTemplateHandler = mock(UriTemplateHandler.class);
    RestTemplate template = this.builder.uriTemplateHandler(uriTemplateHandler)
            .build();
    assertThat(template.getUriTemplateHandler()).isSameAs(uriTemplateHandler);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RootUriRequestExpectationManager.java   
/**
 * Return {@link RequestExpectationManager} to be used for binding with the specified
 * {@link RestTemplate}. If the {@link RestTemplate} is using a
 * {@link RootUriTemplateHandler} then a {@link RootUriRequestExpectationManager} is
 * returned, otherwise the source manager is returned unchanged.
 * @param restTemplate the source REST template
 * @param expectationManager the source {@link RequestExpectationManager}
 * @return a {@link RequestExpectationManager} to be bound to the template
 */
public static RequestExpectationManager forRestTemplate(RestTemplate restTemplate,
        RequestExpectationManager expectationManager) {
    Assert.notNull(restTemplate, "RestTemplate must not be null");
    UriTemplateHandler templateHandler = restTemplate.getUriTemplateHandler();
    if (templateHandler instanceof RootUriTemplateHandler) {
        return new RootUriRequestExpectationManager(
                ((RootUriTemplateHandler) templateHandler).getRootUri(),
                expectationManager);
    }
    return expectationManager;
}
项目:spring-boot-concourse    文件:RootUriTemplateHandler.java   
/**
 * Create a new {@link RootUriTemplateHandler} instance.
 * @param rootUri the root URI to used to prefix relative URLs
 * @param handler the delegate handler
 */
public RootUriTemplateHandler(String rootUri, UriTemplateHandler handler) {
    Assert.notNull(rootUri, "RootUri must not be null");
    Assert.notNull(handler, "Handler must not be null");
    this.rootUri = rootUri;
    this.handler = handler;
}
项目:spring-boot-concourse    文件:RestTemplateBuilderTests.java   
@Test
public void rootUriShouldApplyAfterUriTemplateHandler() throws Exception {
    UriTemplateHandler uriTemplateHandler = mock(UriTemplateHandler.class);
    RestTemplate template = this.builder.uriTemplateHandler(uriTemplateHandler)
            .rootUri("http://example.com").build();
    UriTemplateHandler handler = template.getUriTemplateHandler();
    handler.expand("/hello");
    assertThat(handler).isInstanceOf(RootUriTemplateHandler.class);
    verify(uriTemplateHandler).expand("http://example.com/hello");
}
项目:spring-boot-concourse    文件:RestTemplateBuilderTests.java   
@Test
public void uriTemplateHandlerShouldApply() throws Exception {
    UriTemplateHandler uriTemplateHandler = mock(UriTemplateHandler.class);
    RestTemplate template = this.builder.uriTemplateHandler(uriTemplateHandler)
            .build();
    assertThat(template.getUriTemplateHandler()).isSameAs(uriTemplateHandler);
}
项目:spring-boot-concourse    文件:RootUriRequestExpectationManager.java   
/**
 * Return {@link RequestExpectationManager} to be used for binding with the specified
 * {@link RestTemplate}. If the {@link RestTemplate} is using a
 * {@link RootUriTemplateHandler} then a {@link RootUriRequestExpectationManager} is
 * returned, otherwise the source manager is returned unchanged.
 * @param restTemplate the source reset template
 * @param expectationManager the source {@link RequestExpectationManager}
 * @return a {@link RequestExpectationManager} to be bound to the template
 */
public static RequestExpectationManager forRestTemplate(RestTemplate restTemplate,
        RequestExpectationManager expectationManager) {
    Assert.notNull(restTemplate, "RestTemplate must not be null");
    UriTemplateHandler templateHandler = restTemplate.getUriTemplateHandler();
    if (templateHandler instanceof RootUriTemplateHandler) {
        return new RootUriRequestExpectationManager(
                ((RootUriTemplateHandler) templateHandler).getRootUri(),
                expectationManager);
    }
    return expectationManager;
}
项目:incubator-servicecomb-java-chassis    文件:RestTemplateWrapper.java   
@Override
public void setUriTemplateHandler(UriTemplateHandler handler) {
  super.setUriTemplateHandler(handler);
  defaultRestTemplate.setUriTemplateHandler(handler);
}
项目:FastBootWeixin    文件:WxApiTemplate.java   
public void setUriTemplateHandler(UriTemplateHandler handler) {
    restTemplate.setUriTemplateHandler(handler);
}
项目:FastBootWeixin    文件:WxApiTemplate.java   
public UriTemplateHandler getUriTemplateHandler() {
    return restTemplate.getUriTemplateHandler();
}
项目:spring4-understanding    文件:RestTemplate.java   
/**
 * Return the configured URI template handler.
 */
public UriTemplateHandler getUriTemplateHandler() {
    return this.uriTemplateHandler;
}
项目:spring4-understanding    文件:AsyncRestTemplate.java   
/**
 * Return the configured URI template handler.
 */
public UriTemplateHandler getUriTemplateHandler() {
    return this.syncTemplate.getUriTemplateHandler();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RootUriTemplateHandler.java   
protected RootUriTemplateHandler(UriTemplateHandler handler) {
    this.rootUri = null;
    this.handler = handler;
}
项目:spring-boot-concourse    文件:RootUriTemplateHandler.java   
protected RootUriTemplateHandler(UriTemplateHandler handler) {
    this.rootUri = null;
    this.handler = handler;
}
项目:spring4-understanding    文件:RestTemplate.java   
/**
 * Set a custom {@link UriTemplateHandler} for expanding URI templates.
 * <p>By default, RestTemplate uses {@link DefaultUriTemplateHandler}.
 * @param handler the URI template handler to use
 */
public void setUriTemplateHandler(UriTemplateHandler handler) {
    Assert.notNull(handler, "UriTemplateHandler must not be null");
    this.uriTemplateHandler = handler;
}
项目:spring4-understanding    文件:AsyncRestTemplate.java   
/**
 * Set a custom {@link UriTemplateHandler} for expanding URI templates.
 * <p>By default, RestTemplate uses {@link DefaultUriTemplateHandler}.
 * @param handler the URI template handler to use
 */
public void setUriTemplateHandler(UriTemplateHandler handler) {
    this.syncTemplate.setUriTemplateHandler(handler);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:TestRestTemplate.java   
/**
 * Configure the {@link UriTemplateHandler} to use to expand URI templates. By default
 * the {@link DefaultUriTemplateHandler} is used which relies on Spring's URI template
 * support and exposes several useful properties that customize its behavior for
 * encoding and for prepending a common base URL. An alternative implementation may be
 * used to plug an external URI template library.
 * @param handler the URI template handler to use
 */
public void setUriTemplateHandler(UriTemplateHandler handler) {
    this.restTemplate.setUriTemplateHandler(handler);
}
项目:spring-boot-concourse    文件:TestRestTemplate.java   
/**
 * Configure the {@link UriTemplateHandler} to use to expand URI templates. By default
 * the {@link DefaultUriTemplateHandler} is used which relies on Spring's URI template
 * support and exposes several useful properties that customize its behavior for
 * encoding and for prepending a common base URL. An alternative implementation may be
 * used to plug an external URI template library.
 * @param handler the URI template handler to use
 */
public void setUriTemplateHandler(UriTemplateHandler handler) {
    this.restTemplate.setUriTemplateHandler(handler);
}