Skip to content

Commit

Permalink
Use servletPath instead of uri
Browse files Browse the repository at this point in the history
  • Loading branch information
codeconsole committed Nov 22, 2024
1 parent b95f5d5 commit 84a0e32
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ protected Object getHandlerInternal(HttpServletRequest request) {
if (request.getAttribute("jakarta.servlet.forward.request_uri") == null) {
return null; // only handle forwarded requests.
}
String uri = request.getRequestURI();
if (uri.startsWith("/layouts")) {
ParameterizableViewController pvc = layoutCache.get(uri);
String servletPath = request.getServletPath();
if (servletPath.startsWith("/layouts")) {
ParameterizableViewController pvc = layoutCache.get(servletPath);
if (pvc == null) {
if (groovyPageLocator.findViewByPath(uri) == null) {
throw new ResponseStatusException(NOT_FOUND, "Unable to find resource "+uri);
if (groovyPageLocator.findViewByPath(servletPath) == null) {
throw new ResponseStatusException(NOT_FOUND, "Unable to find resource "+servletPath);
}
pvc = new ParameterizableViewController();
pvc.setSupportedMethods(HttpMethod.GET.name(), HttpMethod.HEAD.name(), HttpMethod.POST.name());
pvc.setViewName(uri);
layoutCache.put(uri, pvc);
pvc.setViewName(servletPath);
layoutCache.put(servletPath, pvc);
}
return pvc;
}
Expand Down

0 comments on commit 84a0e32

Please sign in to comment.