当前位置: 首页>>代码示例>>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;未经允许,请勿转载。