List of usage examples for org.springframework.http.server.reactive ServerHttpRequest getPath
RequestPath getPath();
From source file:org.springframework.security.web.server.savedrequest.WebSessionServerRequestCache.java
private static String pathInApplication(ServerHttpRequest request) { String path = request.getPath().pathWithinApplication().value(); String query = request.getURI().getRawQuery(); return path + (query != null ? "?" + query : ""); }
From source file:org.springframework.web.reactive.resource.ResourceUrlProvider.java
/** * Get the public resource URL for the given URI string. * <p>The URI string is expected to be a path and if it contains a query or * fragment those will be preserved in the resulting public resource URL. * @param uriString the URI string to transform * @param exchange the current exchange//from www . jav a2 s.c o m * @return the resolved public resource URL path, or empty if unresolved */ public final Mono<String> getForUriString(String uriString, ServerWebExchange exchange) { if (logger.isTraceEnabled()) { logger.trace("Getting resource URL for request URL \"" + uriString + "\""); } ServerHttpRequest request = exchange.getRequest(); int queryIndex = getQueryIndex(uriString); String lookupPath = uriString.substring(0, queryIndex); String query = uriString.substring(queryIndex); PathContainer parsedLookupPath = PathContainer.parsePath(lookupPath); if (logger.isTraceEnabled()) { logger.trace("Getting resource URL for lookup path \"" + lookupPath + "\""); } return resolveResourceUrl(parsedLookupPath) .map(resolvedPath -> request.getPath().contextPath().value() + resolvedPath + query); }