本文整理汇总了Java中org.springframework.web.util.UriBuilder类的典型用法代码示例。如果您正苦于以下问题:Java UriBuilder类的具体用法?Java UriBuilder怎么用?Java UriBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UriBuilder类属于org.springframework.web.util包,在下文中一共展示了UriBuilder类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.springframework.web.util.UriBuilder; //导入依赖的package包/类
private String get(final Function<UriBuilder, URI> builder, final HttpStatus status) {
return new String(client.get()
.uri(builder)
.accept(TEXT_HTML).exchange()
.expectStatus().isEqualTo(status)
.expectHeader().contentType(TEXT_HTML)
.expectBody().returnResult().getResponseBody());
}
示例2: post
import org.springframework.web.util.UriBuilder; //导入依赖的package包/类
protected <T, K> T post(final Function<UriBuilder, URI> builder, final HttpStatus status, final K object, final Class<T> type) {
return client.post()
.uri(builder)
.body(BodyInserters.fromObject(object))
.accept(APPLICATION_JSON_UTF8).exchange()
.expectStatus().isEqualTo(status)
.expectHeader().contentType(APPLICATION_JSON_UTF8)
.expectBody(type)
.returnResult().getResponseBody();
}
示例3: buildRequest
import org.springframework.web.util.UriBuilder; //导入依赖的package包/类
public DefaultRequest buildRequest(String uri, Map<String, Object> variables) {
UriBuilder uriBuilder = new DefaultUriBuilderFactory(uri).builder();
return new DefaultRequest(uriBuilder, HttpMethod.GET, new HttpHeaders(), variables, BodyInserters.empty());
}
示例4: DefaultRequest
import org.springframework.web.util.UriBuilder; //导入依赖的package包/类
public DefaultRequest(UriBuilder uriBuilder,
HttpMethod httpMethod,
HttpHeaders httpHeaders,
Map<String, Object> variables,
BodyInserter<?, ? super ClientHttpRequest> bodyInserter) {
this.uriBuilder = uriBuilder;
this.httpMethod = httpMethod;
this.bodyInserter = bodyInserter;
this.variables = new HashMap<>();
this.variables.putAll(variables);
this.httpHeaders = new HttpHeaders();
this.httpHeaders.putAll(httpHeaders);
}
示例5: uriString
import org.springframework.web.util.UriBuilder; //导入依赖的package包/类
@Override
public UriBuilder uriString(String uriTemplate) {
VaultEndpoint endpoint = endpointProvider.getVaultEndpoint();
String baseUri = toBaseUri(endpoint);
UriComponents uriComponents = UriComponentsBuilder.fromUriString(
prepareUriTemplate(baseUri, uriTemplate)).build();
return UriComponentsBuilder.fromUriString(baseUri).uriComponents(
uriComponents);
}