當前位置: 首頁>>代碼示例>>Java>>正文


Java UriComponents.getPath方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:19,代碼來源:HtmlUnitRequestBuilder.java

示例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();
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-netflix,代碼行數:22,代碼來源:LocationRewriteFilter.java

示例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));
}
 
開發者ID:airsonic,項目名稱:airsonic,代碼行數:11,代碼來源:JWTSecurityService.java

示例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);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:28,代碼來源:HtmlUnitRequestBuilder.java


注:本文中的org.springframework.web.util.UriComponents.getPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。