package io.undertow.jsp;

import io.undertow.server.HandlerWrapper;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.servlet.handlers.ServletRequestContext;
import org.apache.jasper.Constants;

import javax.servlet.ServletRequest;

public class JspFileHandler implements HttpHandler {

    private final String jspFile;
    private final HttpHandler next;

    public JspFileHandler(final String jspFile, final HttpHandler next) {
        this.jspFile = jspFile;
        this.next = next;
    }

    @Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception {
        ServletRequest request = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getServletRequest();
        Object old = request.getAttribute(Constants.JSP_FILE);
        try {
            request.setAttribute(Constants.JSP_FILE, jspFile);
            next.handleRequest(exchange);
        } finally {
            request.setAttribute(Constants.JSP_FILE, old);
        }
    }

    public static HandlerWrapper jspFileHandlerWrapper(final String jspFile) {
        return new HandlerWrapper() {
            @Override
            public HttpHandler wrap(HttpHandler handler) {
                return new JspFileHandler(jspFile, handler);
            }
        };
    }
}

@@ -209,80 +209,97 @@
 xt;%0A
+%0A
 import 
-org.apache.jasper.Constants;%0A%0Aimport javax.servlet.ServletRequest
+javax.servlet.ServletRequest;%0A%0Aimport static org.apache.jasper.Constants.JSP_FILE
 ;%0A%0Ap
@@ -812,34 +812,24 @@
 etAttribute(
-Constants.
 JSP_FILE);%0A 
@@ -837,24 +837,62 @@
       try %7B%0A
+            if(jspFile == null) %7B%0A    
             
@@ -891,35 +891,38 @@
         request.
-set
+remove
 Attribute(Consta
@@ -911,34 +911,93 @@
 veAttribute(
-Constants.
+JSP_FILE);%0A            %7D else %7B%0A                request.setAttribute(
 JSP_FILE, js
@@ -1000,24 +1000,38 @@
 , jspFile);%0A
+            %7D%0A
             
@@ -1113,26 +1113,16 @@
 tribute(
-Constants.
 JSP_FILE

Fix JSP issue