本文整理匯總了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);
}