当前位置: 首页>>代码示例>>Java>>正文


Java DefaultUriTemplateHandler类代码示例

本文整理汇总了Java中org.springframework.web.util.DefaultUriTemplateHandler的典型用法代码示例。如果您正苦于以下问题:Java DefaultUriTemplateHandler类的具体用法?Java DefaultUriTemplateHandler怎么用?Java DefaultUriTemplateHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultUriTemplateHandler类属于org.springframework.web.util包,在下文中一共展示了DefaultUriTemplateHandler类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerRestTemplate

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
private String registerRestTemplate(final String id, final String factoryId, final String convertersId,
        @Nullable final String baseUrl) {
    return registry.register(id, RestTemplate.class, () -> {
        LOG.debug("Client [{}]: Registering RestTemplate", id);

        final BeanDefinitionBuilder restTemplate = genericBeanDefinition(RestTemplate.class);

        restTemplate.addConstructorArgReference(factoryId);

        final DefaultUriTemplateHandler handler = new DefaultUriTemplateHandler();
        handler.setBaseUrl(baseUrl);
        restTemplate.addPropertyValue("uriTemplateHandler", handler);

        final AbstractBeanDefinition converters = BeanDefinitionBuilder.genericBeanDefinition()
                .setFactoryMethod("getConverters")
                .getBeanDefinition();
        converters.setFactoryBeanName(convertersId);
        restTemplate.addPropertyValue("messageConverters", converters);

        return restTemplate;
    });
}
 
开发者ID:zalando-stups,项目名称:put-it-to-rest,代码行数:23,代码来源:RestClientPostProcessor.java

示例2: registerAsyncRestTemplate

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
private String registerAsyncRestTemplate(final String id, final String factoryId, final String convertersId,
        @Nullable final String baseUrl) {
    return registry.register(id, AsyncRestTemplate.class, () -> {
        LOG.debug("Client [{}]: Registering AsyncRestTemplate", id);

        final BeanDefinitionBuilder restTemplate = genericBeanDefinition(AsyncRestTemplate.class);

        restTemplate.addConstructorArgReference(factoryId);

        final DefaultUriTemplateHandler handler = new DefaultUriTemplateHandler();
        handler.setBaseUrl(baseUrl);
        restTemplate.addPropertyValue("uriTemplateHandler", handler);

        final AbstractBeanDefinition converters = BeanDefinitionBuilder.genericBeanDefinition()
                .setFactoryMethod("getConverters")
                .getBeanDefinition();
        converters.setFactoryBeanName(convertersId);
        restTemplate.addPropertyValue("messageConverters", converters);

        return restTemplate;
    });
}
 
开发者ID:zalando-stups,项目名称:put-it-to-rest,代码行数:23,代码来源:RestClientPostProcessor.java

示例3: registerTemplate

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
private void registerTemplate(final String id, final Class<?> type, final String factoryId,
        @Nullable final String baseUrl, final BeanDefinition converters, final List<BeanMetadataElement> plugins) {
    registry.registerIfAbsent(id, type, () -> {
        log.debug("Client [{}]: Registering AsyncRestTemplate", id);

        final DefaultUriTemplateHandler handler = new DefaultUriTemplateHandler();
        handler.setBaseUrl(baseUrl);

        final BeanDefinitionBuilder template = genericBeanDefinition(type);
        template.addConstructorArgReference(factoryId);
        template.addPropertyValue("uriTemplateHandler", handler);
        template.addPropertyValue("messageConverters", converters);
        template.addPropertyValue("interceptors", plugins.stream()
                .map(plugin -> genericBeanDefinition(PluginInterceptors.class)
                        .setFactoryMethod("adapt")
                        .addConstructorArgValue(plugin)
                        .getBeanDefinition())
                .collect(toCollection(Registry::list)));

        return template;
    });
}
 
开发者ID:zalando,项目名称:riptide,代码行数:23,代码来源:DefaultRiptideRegistrar.java

示例4: getForObjectWithCustomUriTemplateHandler

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
@Test
public void getForObjectWithCustomUriTemplateHandler() throws Exception {

	DefaultUriTemplateHandler uriTemplateHandler = new DefaultUriTemplateHandler();
	uriTemplateHandler.setParsePath(true);
	template.setUriTemplateHandler(uriTemplateHandler);

	URI expectedUri = new URI("http://example.com/hotels/1/pic/pics%2Flogo.png/size/150x150");
	given(requestFactory.createRequest(expectedUri, HttpMethod.GET)).willReturn(request);

	given(request.getHeaders()).willReturn(new HttpHeaders());
	given(request.execute()).willReturn(response);
	given(errorHandler.hasError(response)).willReturn(false);

	given(response.getStatusCode()).willReturn(HttpStatus.OK);
	given(response.getHeaders()).willReturn(new HttpHeaders());
	given(response.getBody()).willReturn(null);

	Map<String, String> uriVariables = new HashMap<String, String>(2);
	uriVariables.put("hotel", "1");
	uriVariables.put("publicpath", "pics/logo.png");
	uriVariables.put("scale", "150x150");

	String url = "http://example.com/hotels/{hotel}/pic/{publicpath}/size/{scale}";
	template.getForObject(url, String.class, uriVariables);

	verify(response).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:29,代码来源:RestTemplateTests.java

示例5: init

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
@PostConstruct
public void init() {
    DefaultUriTemplateHandler handler = new DefaultUriTemplateHandler();
    handler.setBaseUrl(url + ":" + port);
    handler.setParsePath(true);

    client = new TestRestTemplate();
    client.setUriTemplateHandler(handler);
}
 
开发者ID:omlip,项目名称:cassandra-unit-spring-demo,代码行数:10,代码来源:AbstractEmbeddedCassandraTest.java

示例6: exampleRestTemplate

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
@Bean
public RestTemplate exampleRestTemplate(final ClientHttpRequestFactory requestFactory,
        final ClientHttpMessageConverters converters) {
    final RestTemplate template = new RestTemplate();

    final DefaultUriTemplateHandler handler = new DefaultUriTemplateHandler();
    handler.setBaseUrl("https://www.example.com");
    template.setUriTemplateHandler(handler);
    template.setRequestFactory(requestFactory);
    template.setMessageConverters(converters.getConverters());

    return template;
}
 
开发者ID:zalando,项目名称:riptide,代码行数:14,代码来源:ManualConfiguration.java

示例7: exampleAsyncRestTemplate

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
@Bean
public AsyncRestTemplate exampleAsyncRestTemplate(final AsyncClientHttpRequestFactory requestFactory,
        final ClientHttpMessageConverters converters) {
    final AsyncRestTemplate template = new AsyncRestTemplate();

    final DefaultUriTemplateHandler handler = new DefaultUriTemplateHandler();
    handler.setBaseUrl("https://www.example.com");
    template.setUriTemplateHandler(handler);
    template.setAsyncRequestFactory(requestFactory);
    template.setMessageConverters(converters.getConverters());

    return template;
}
 
开发者ID:zalando,项目名称:riptide,代码行数:14,代码来源:ManualConfiguration.java

示例8: defaultUriVariablesOf

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
private Map<String, ?> defaultUriVariablesOf(RestTemplate wrapper1) {
  return ((DefaultUriTemplateHandler) wrapper1.getUriTemplateHandler()).getDefaultUriVariables();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:4,代码来源:TestRestTemplateWrapper.java

示例9: createUriTemplateHandler

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
private static DefaultUriTemplateHandler createUriTemplateHandler(
		VaultEndpointProvider endpointProvider) {

	return new PrefixAwareUriTemplateHandler(endpointProvider);
}
 
开发者ID:spring-projects,项目名称:spring-vault,代码行数:6,代码来源:VaultClients.java

示例10: LocalHostUriTemplateHandler

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
public LocalHostUriTemplateHandler(Environment environment) {
	super(new DefaultUriTemplateHandler());
	Assert.notNull(environment, "Environment must not be null");
	this.environment = environment;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:6,代码来源:LocalHostUriTemplateHandler.java

示例11: createUriTemplateHandler

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
/**
 * Create a {@link UriTemplateHandler} that prefixes all {@link RestTemplate} calls
 * with the configured {@literal baseUri}.
 *
 * @param baseUri the base URI for the CredHub server
 * @return a configured {@link UriTemplateHandler}
 */
private static DefaultUriTemplateHandler createUriTemplateHandler(String baseUri) {
	DefaultUriTemplateHandler uriTemplateHandler = new DefaultUriTemplateHandler();
	uriTemplateHandler.setBaseUrl(baseUri);
	return uriTemplateHandler;
}
 
开发者ID:spring-projects,项目名称:spring-credhub,代码行数:13,代码来源:CredHubClient.java

示例12: RootUriTemplateHandler

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
/**
 * Create a new {@link RootUriTemplateHandler} instance.
 * @param rootUri the root URI to be used to prefix relative URLs
 */
public RootUriTemplateHandler(String rootUri) {
	this(rootUri, new DefaultUriTemplateHandler());
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:RootUriTemplateHandler.java

示例13: RootUriTemplateHandler

import org.springframework.web.util.DefaultUriTemplateHandler; //导入依赖的package包/类
/**
 * Create a new {@link RootUriTemplateHandler} instance.
 * @param rootUri the root URI to used to prefix relative URLs
 */
public RootUriTemplateHandler(String rootUri) {
	this(rootUri, new DefaultUriTemplateHandler());
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:8,代码来源:RootUriTemplateHandler.java


注:本文中的org.springframework.web.util.DefaultUriTemplateHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。