List of usage examples for org.springframework.web.reactive HandlerMapping PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
String PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
To view the source code for org.springframework.web.reactive HandlerMapping PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE.
Click Source Link
From source file:org.springframework.web.reactive.resource.ResourceWebHandler.java
protected Mono<Resource> getResource(ServerWebExchange exchange) { String name = HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE; PathContainer pathWithinHandler = exchange.getRequiredAttribute(name); String path = processPath(pathWithinHandler.value()); if (!StringUtils.hasText(path) || isInvalidPath(path)) { if (logger.isTraceEnabled()) { logger.trace("Ignoring invalid resource path [" + path + "]"); }//from w w w. jav a 2 s . c o m return Mono.empty(); } if (path.contains("%")) { try { // Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars if (isInvalidPath(URLDecoder.decode(path, "UTF-8"))) { if (logger.isTraceEnabled()) { logger.trace("Ignoring invalid resource path with escape sequences [" + path + "]."); } return Mono.empty(); } } catch (IllegalArgumentException ex) { // ignore } catch (UnsupportedEncodingException ex) { return Mono.error(Exceptions.propagate(ex)); } } ResourceResolverChain resolveChain = createResolverChain(); return resolveChain.resolveResource(exchange, path, getLocations()).flatMap(resource -> { ResourceTransformerChain transformerChain = createTransformerChain(resolveChain); return transformerChain.transform(exchange, resource); }); }