Skip to content

Commit 7ef3257

Browse files
committed
Correctly determine HttpServletMapping for INCLUDE
Closes gh-26216
1 parent 0172424 commit 7ef3257

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Map;
2222
import java.util.Properties;
2323

24+
import javax.servlet.RequestDispatcher;
2425
import javax.servlet.ServletRequest;
2526
import javax.servlet.http.HttpServletMapping;
2627
import javax.servlet.http.HttpServletRequest;
@@ -774,7 +775,10 @@ public String removeSemicolonContent(String requestUri) {
774775
private static class Servlet4Delegate {
775776

776777
public static boolean skipServletPathDetermination(HttpServletRequest request) {
777-
HttpServletMapping mapping = request.getHttpServletMapping();
778+
HttpServletMapping mapping = (HttpServletMapping) request.getAttribute(RequestDispatcher.INCLUDE_MAPPING);
779+
if (mapping == null) {
780+
mapping = request.getHttpServletMapping();
781+
}
778782
MappingMatch match = mapping.getMappingMatch();
779783
return (match != null && (!match.equals(MappingMatch.PATH) || mapping.getPattern().equals("/*")));
780784
}

0 commit comments

Comments
 (0)