本文整理汇总了Java中org.springframework.web.util.UriComponents.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java UriComponents.getPath方法的具体用法?Java UriComponents.getPath怎么用?Java UriComponents.getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.util.UriComponents
的用法示例。
在下文中一共展示了UriComponents.getPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: contextPath
import org.springframework.web.util.UriComponents; //导入方法依赖的package包/类
private void contextPath(MockHttpServletRequest request, UriComponents uriComponents) {
if (this.contextPath == null) {
List<String> pathSegments = uriComponents.getPathSegments();
if (pathSegments.isEmpty()) {
request.setContextPath("");
}
else {
request.setContextPath("/" + pathSegments.get(0));
}
}
else {
if (!uriComponents.getPath().startsWith(this.contextPath)) {
throw new IllegalArgumentException(uriComponents.getPath() + " should start with contextPath "
+ this.contextPath);
}
request.setContextPath(this.contextPath);
}
}
示例2: getRestoredPath
import org.springframework.web.util.UriComponents; //导入方法依赖的package包/类
private String getRestoredPath(ZuulProperties zuulProperties, Route route,
UriComponents redirectedUriComps) {
StringBuilder path = new StringBuilder();
String redirectedPathWithoutGlobal = downstreamHasGlobalPrefix(zuulProperties)
? redirectedUriComps.getPath()
.substring(("/" + zuulProperties.getPrefix()).length())
: redirectedUriComps.getPath();
if (downstreamHasGlobalPrefix(zuulProperties)) {
path.append("/" + zuulProperties.getPrefix());
}
else {
path.append(zuulHasGlobalPrefix(zuulProperties)
? "/" + zuulProperties.getPrefix() : "");
}
path.append(downstreamHasRoutePrefix(route) ? "" : "/" + route.getPrefix())
.append(redirectedPathWithoutGlobal);
return path.toString();
}
示例3: createToken
import org.springframework.web.util.UriComponents; //导入方法依赖的package包/类
private static String createToken(String jwtKey, String path, Date expireDate) {
UriComponents components = UriComponentsBuilder.fromUriString(path).build();
String query = components.getQuery();
String claim = components.getPath() + (!StringUtils.isBlank(query) ? "?" + components.getQuery() : "");
logger.debug("Creating token with claim " + claim);
return JWT.create()
.withClaim(CLAIM_PATH, claim)
.withExpiresAt(expireDate)
.sign(getAlgorithm(jwtKey));
}
示例4: buildRequest
import org.springframework.web.util.UriComponents; //导入方法依赖的package包/类
public MockHttpServletRequest buildRequest(ServletContext servletContext) {
String charset = getCharset();
String httpMethod = this.webRequest.getHttpMethod().name();
UriComponents uriComponents = uriComponents();
MockHttpServletRequest request = new HtmlUnitMockHttpServletRequest(servletContext, httpMethod,
uriComponents.getPath());
parent(request, this.parentBuilder);
request.setServerName(uriComponents.getHost()); // needs to be first for additional headers
authType(request);
request.setCharacterEncoding(charset);
content(request, charset);
contextPath(request, uriComponents);
contentType(request);
cookies(request);
headers(request);
locales(request);
servletPath(uriComponents, request);
params(request, uriComponents);
ports(uriComponents, request);
request.setProtocol("HTTP/1.1");
request.setQueryString(uriComponents.getQuery());
request.setScheme(uriComponents.getScheme());
pathInfo(uriComponents,request);
return postProcess(request);
}