When forwarding a request path is not canonicalized, JSP recompile is not trigger even after JSP file is updated in exploded deployments on JBoss EAP 7

Solution Unverified - Updated -

Issue

When forwarding a request path is not canonicalized, JSP recompile is not triggered even after the JSP file is updated in the exploded deployment on JBoss EAP 7.

For example, when my application contains the following JSP file that forwards to another JSP with multiple slashes // in the path:

<%
// RequestDispatcher dispatcher = request.getRequestDispatcher("test/example.jsp"); // OK
// RequestDispatcher dispatcher = request.getRequestDispatcher("test//example.jsp"); // OK
// RequestDispatcher dispatcher = request.getRequestDispatcher("/test/example.jsp"); // OK
// RequestDispatcher dispatcher = request.getRequestDispatcher("//test/example.jsp"); // Recompile is not triggered even after example.jsp is updated
RequestDispatcher dispatcher = request.getRequestDispatcher("/test//example.jsp"); // Recompile is not triggered even after example.jsp is updated
dispatcher.forward(request, response);
%>

in the following directory structure:

example.war
├── index.jsp
├── test
│   └── example.jsp // <- Recompile is not triggered even after this JSP file is updated
└── WEB-INF
    └── web.xml

The same issue can happen with Sping Boot based application that has the following:

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class DemoJspController {

    @RequestMapping("/test1")
    public String test1() {
        return "test/example"; // OK. Forwarinding to WEB-INF/jsp/test/example.jsp. Recompile works after the example.jsp is updated.
    }

    @RequestMapping("/test2")
    public String test2() {
        return "/test/example"; // forwarinding to WEB-INF/jsp//test/example.jsp. Recompile is not triggered even after the example.jsp is updated.
    }

}

with enabling JSP support in application.properties:

spring.mvc.view.prefix:/WEB-INF/jsp/
spring.mvc.view.suffix:.jsp

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content