|
|
@ -73,7 +73,6 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini |
|
|
|
private boolean detectHandlerFunctionsInAncestorContexts = false; |
|
|
|
private boolean detectHandlerFunctionsInAncestorContexts = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create an empty {@code RouterFunctionMapping}. |
|
|
|
* Create an empty {@code RouterFunctionMapping}. |
|
|
|
* <p>If this constructor is used, this mapping will detect all |
|
|
|
* <p>If this constructor is used, this mapping will detect all |
|
|
@ -91,6 +90,7 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini |
|
|
|
this.routerFunction = routerFunction; |
|
|
|
this.routerFunction = routerFunction; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the router function to map to. |
|
|
|
* Set the router function to map to. |
|
|
|
* <p>If this property is used, no application context detection will occur. |
|
|
|
* <p>If this property is used, no application context detection will occur. |
|
|
@ -111,6 +111,10 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini |
|
|
|
return this.routerFunction; |
|
|
|
return this.routerFunction; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set the message body converters to use. |
|
|
|
|
|
|
|
* <p>These converters are used to convert from and to HTTP requests and responses. |
|
|
|
|
|
|
|
*/ |
|
|
|
public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters) { |
|
|
|
public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters) { |
|
|
|
this.messageConverters = messageConverters; |
|
|
|
this.messageConverters = messageConverters; |
|
|
|
} |
|
|
|
} |
|
|
@ -127,6 +131,7 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini |
|
|
|
this.detectHandlerFunctionsInAncestorContexts = detectHandlerFunctionsInAncestorContexts; |
|
|
|
this.detectHandlerFunctionsInAncestorContexts = detectHandlerFunctionsInAncestorContexts; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void afterPropertiesSet() throws Exception { |
|
|
|
public void afterPropertiesSet() throws Exception { |
|
|
|
if (this.routerFunction == null) { |
|
|
|
if (this.routerFunction == null) { |
|
|
@ -204,8 +209,9 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini |
|
|
|
this.messageConverters = messageConverters; |
|
|
|
this.messageConverters = messageConverters; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
@Nullable |
|
|
|
protected Object getHandlerInternal(HttpServletRequest servletRequest) throws Exception { |
|
|
|
protected Object getHandlerInternal(HttpServletRequest servletRequest) throws Exception { |
|
|
|
if (this.routerFunction != null) { |
|
|
|
if (this.routerFunction != null) { |
|
|
|
ServerRequest request = ServerRequest.create(servletRequest, this.messageConverters); |
|
|
|
ServerRequest request = ServerRequest.create(servletRequest, this.messageConverters); |
|
|
@ -219,8 +225,10 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void setAttributes(HttpServletRequest servletRequest, ServerRequest request, |
|
|
|
private void setAttributes(HttpServletRequest servletRequest, ServerRequest request, |
|
|
|
HandlerFunction<?> handlerFunction) { |
|
|
|
@Nullable HandlerFunction<?> handlerFunction) { |
|
|
|
PathPattern matchingPattern = (PathPattern) servletRequest.getAttribute(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE); |
|
|
|
|
|
|
|
|
|
|
|
PathPattern matchingPattern = |
|
|
|
|
|
|
|
(PathPattern) servletRequest.getAttribute(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE); |
|
|
|
if (matchingPattern != null) { |
|
|
|
if (matchingPattern != null) { |
|
|
|
servletRequest.removeAttribute(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE); |
|
|
|
servletRequest.removeAttribute(RouterFunctions.MATCHING_PATTERN_ATTRIBUTE); |
|
|
|
servletRequest.setAttribute(BEST_MATCHING_PATTERN_ATTRIBUTE, matchingPattern.getPatternString()); |
|
|
|
servletRequest.setAttribute(BEST_MATCHING_PATTERN_ATTRIBUTE, matchingPattern.getPatternString()); |
|
|
|