本文整理了Java中javax.ws.rs.core.UriBuilder.replacePath()
方法的一些代码示例,展示了UriBuilder.replacePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UriBuilder.replacePath()
方法的具体详情如下:
包路径:javax.ws.rs.core.UriBuilder
类名称:UriBuilder
方法名:replacePath
[英]Set the URI path. This method will overwrite any existing path and associated matrix parameters. Existing '/' characters are preserved thus a single value can represent multiple URI path segments.
[中]设置URI路径。此方法将覆盖任何现有路径和关联的矩阵参数。保留现有的“/”字符,因此单个值可以表示多个URI路径段。
代码示例来源:origin: prestodb/presto
private String rewriteUri(UriInfo uriInfo, String uri)
{
return uriInfo.getAbsolutePathBuilder()
.replacePath("/v1/proxy")
.queryParam("uri", uri)
.queryParam("hmac", hmac.hashString(uri, UTF_8))
.build()
.toString();
}
代码示例来源:origin: prestodb/presto
private synchronized URI createNextResultsUri(String scheme, UriInfo uriInfo)
{
return uriInfo.getBaseUriBuilder()
.scheme(scheme)
.replacePath("/v1/statement")
.path(queryId.toString())
.path(String.valueOf(resultId.incrementAndGet()))
.replaceQuery("")
.build();
}
代码示例来源:origin: Netflix/eureka
private URI getRedirectBaseUri(URI locationURI) {
if (locationURI == null) {
throw new TransportException("Missing Location header in the redirect reply");
}
Matcher pathMatcher = REDIRECT_PATH_REGEX.matcher(locationURI.getPath());
if (pathMatcher.matches()) {
return UriBuilder.fromUri(locationURI)
.host(dnsService.resolveIp(locationURI.getHost()))
.replacePath(pathMatcher.group(1))
.replaceQuery(null)
.build();
}
logger.warn("Invalid redirect URL {}", locationURI);
return null;
}
}
代码示例来源:origin: com.sun.jersey/jersey-server
/**
* Normalize the URI provided and return the normalized
* copy.
* @param uri The URI to normalize
* @param preserveContdSlashes Shall we preserve "///" slashes
* @return New normalized URI
*/
public static URI normalize(URI uri, boolean preserveContdSlashes) {
if (!uri.getRawPath().contains("//")) {
return uri.normalize();
}
String np = UriHelper.removeDotSegments(
uri.getRawPath(),
preserveContdSlashes
);
if (np.equals(uri.getRawPath())) {
return uri;
}
return UriBuilder.fromUri(uri).replacePath(np).build();
}
代码示例来源:origin: jersey/jersey
rc.setRequestUri(uriInfo.getRequestUriBuilder().replacePath(path).build());
代码示例来源:origin: jersey/jersey
rc.setRequestUri(uriInfo.getRequestUriBuilder().replacePath(path).build());
代码示例来源:origin: com.sun.jersey/jersey-server
request.setUris(
request.getBaseUri(),
request.getRequestUriBuilder().replacePath(path).build());
代码示例来源:origin: jersey/jersey
: (filterContextPath != null ? filterContextPath : "");
baseUri = absoluteUriBuilder.replacePath(request.getContextPath()).path(replacingPath).path("/").build();
requestUri = absoluteUriBuilder.replacePath(requestURI)
.replaceQuery(ContainerUtils.encodeUnsafeCharacters(queryString))
.build();
代码示例来源:origin: jersey/jersey
final URI requestUri;
try {
baseUri = absoluteUriBuilder.replacePath(encodedBasePath).build();
String queryParameters = ContainerUtils.encodeUnsafeCharacters(request.getQueryString());
if (queryParameters == null) {
requestUri = absoluteUriBuilder.replacePath(requestURI)
.replaceQuery(queryParameters)
.build();
代码示例来源:origin: jersey/jersey
: (filterContextPath != null ? filterContextPath : "");
baseUri = absoluteUriBuilder.replacePath(request.getContextPath()).path(replacingPath).path("/").build();
requestUri = absoluteUriBuilder.replacePath(requestURI)
.replaceQuery(ContainerUtils.encodeUnsafeCharacters(queryString))
.build();
代码示例来源:origin: jersey/jersey
final URI requestUri;
try {
baseUri = absoluteUriBuilder.replacePath(encodedBasePath).build();
String queryParameters = ContainerUtils.encodeUnsafeCharacters(request.getQueryString());
if (queryParameters == null) {
requestUri = absoluteUriBuilder.replacePath(requestURI)
.replaceQuery(queryParameters)
.build();
代码示例来源:origin: jersey/jersey
.replacePath(
requestURIPath
.substring(0, requestURIPath.lastIndexOf('/') + 1))
代码示例来源:origin: jersey/jersey
.replacePath(
requestURIPath
.substring(0, requestURIPath.lastIndexOf('/') + 1))
代码示例来源:origin: com.sun.jersey/jersey-server
.replacePath(
requestURIPath
.substring(0, requestURIPath.lastIndexOf('/') + 1))
代码示例来源:origin: prestodb/presto
.replacePath("ui/query.html")
.replaceQuery(queryId.toString())
.build();
代码示例来源:origin: resteasy/Resteasy
public void initializeFromRequest(URI requestURI)
{
String r = requestURI.getRawPath();
if (r.startsWith("/"))
{
encodedPath = r;
path = requestURI.getPath();
}
else
{
encodedPath = "/" + r;
path = "/" + requestURI.getPath();
}
this.requestURI = requestURI;
baseURI = UriBuilder.fromUri(requestURI).replacePath("").build();
absolutePath = UriBuilder.fromUri(requestURI).replaceQuery(null).build();
processPath();
}
代码示例来源:origin: resteasy/Resteasy
protected void initialize(CharSequence absoluteUri, String queryString, String contextPath)
{
ResteasyUriBuilder absoluteBuilder = (ResteasyUriBuilder) ((ResteasyUriBuilder) RuntimeDelegate.getInstance()
.createUriBuilder()).uriFromCharSequence((CharSequence)absoluteUri);
absolutePath = absoluteBuilder.build();
requestURI = absoluteBuilder.replaceQuery(queryString).build();
encodedPath = PathHelper.getEncodedPathInfo(absolutePath.getRawPath(), contextPath);
baseURI = absolutePath;
if (!encodedPath.trim().equals(""))
{
String tmpContextPath = contextPath;
if (!tmpContextPath.endsWith("/")) tmpContextPath += "/";
baseURI = absoluteBuilder.clone().replacePath(tmpContextPath).replaceQuery(null).build();
}
// // make sure there is no trailing '/'
// if (encodedPath.length() > 1 && encodedPath.endsWith("/"))
// encodedPath = encodedPath.substring(0, encodedPath.length() - 1);
// make sure path starts with '/'
if (encodedPath.length() == 0 || encodedPath.charAt(0) != '/')
{
encodedPath = "/" + encodedPath;
}
path = UriBuilder.fromPath(encodedPath).build().getPath();
processPath();
}
代码示例来源:origin: resteasy/Resteasy
URI newUri = requestContext.getUriInfo().getBaseUriBuilder().replacePath(rawPath).replaceQuery(uri.getRawQuery()).build();
requestContext.setRequestUri(newUri);
代码示例来源:origin: resteasy/Resteasy
baseURI = UriBuilder.fromUri(absoluteURI).replacePath(tmpContextPath).replaceQuery(null).build();
代码示例来源:origin: org.glassfish.jersey.core/jersey-server
.replacePath(
requestURIPath
.substring(0, requestURIPath.lastIndexOf('/') + 1))
内容来源于网络,如有侵权,请联系作者删除!