diff --git a/apache-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java b/apache-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java index 98b29c460ed..6f889dd4d8f 100644 --- a/apache-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java +++ b/apache-jsp/src/main/java/org/eclipse/jetty/jsp/JettyJspServlet.java @@ -20,6 +20,7 @@ package org.eclipse.jetty.jsp; import java.io.IOException; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -59,10 +60,10 @@ public class JettyJspServlet extends JspServlet String servletPath=null; String pathInfo=null; - if (request.getAttribute("javax.servlet.include.request_uri")!=null) + if (request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI)!=null) { - servletPath=(String)request.getAttribute("javax.servlet.include.servlet_path"); - pathInfo=(String)request.getAttribute("javax.servlet.include.path_info"); + servletPath=(String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); + pathInfo=(String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (servletPath==null) { servletPath=request.getServletPath(); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java index 1eacb7d64c6..3c6172d5ceb 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java @@ -25,6 +25,7 @@ import java.io.Writer; import java.nio.ByteBuffer; import javax.servlet.ServletContext; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -199,7 +200,7 @@ public class ErrorHandler extends AbstractHandler protected void writeErrorPageStacks(HttpServletRequest request, Writer writer) throws IOException { - Throwable th = (Throwable)request.getAttribute("javax.servlet.error.exception"); + Throwable th = (Throwable)request.getAttribute(RequestDispatcher.ERROR_EXCEPTION); while (th != null) { writer.write("
"); diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/ConcatServletTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/ConcatServletTest.java index 80812229bf1..db24fe13f79 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/ConcatServletTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/ConcatServletTest.java @@ -27,6 +27,7 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -76,7 +77,7 @@ public class ConcatServletTest @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - String includedURI = (String)request.getAttribute("javax.servlet.include.request_uri"); + String includedURI = (String)request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI); response.getOutputStream().println(includedURI); } }); diff --git a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionDump.java b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionDump.java index 3c1572a6d51..eaa120cbf3e 100644 --- a/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionDump.java +++ b/tests/test-sessions/test-mongodb-sessions/src/test/java/org/eclipse/jetty/nosql/mongodb/SessionDump.java @@ -24,6 +24,7 @@ import java.io.PrintWriter; import java.util.Date; import java.util.Enumeration; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -178,7 +179,7 @@ public class SessionDump extends HttpServlet /* ------------------------------------------------------------ */ private String getURI(HttpServletRequest request) { - String uri=(String)request.getAttribute("javax.servlet.forward.request_uri"); + String uri=(String)request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI); if (uri==null) uri=request.getRequestURI(); return uri; diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/CookieDump.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/CookieDump.java index bc40854d158..d5b8cb024ea 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/CookieDump.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/CookieDump.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.PrintWriter; import java.util.concurrent.TimeUnit; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; @@ -105,7 +106,7 @@ public class CookieDump extends HttpServlet /* ------------------------------------------------------------ */ private String getURI(HttpServletRequest request) { - String uri=(String)request.getAttribute("javax.servlet.forward.request_uri"); + String uri=(String)request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI); if (uri==null) uri=request.getRequestURI(); return uri; diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java index 1e088d22b77..70637fcd882 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/DispatchServlet.java @@ -68,8 +68,8 @@ public class DispatchServlet extends HttpServlet String info; - if (sreq.getAttribute("javax.servlet.include.servlet_path") != null) - info= (String)sreq.getAttribute("javax.servlet.include.path_info"); + if (sreq.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH) != null) + info= (String)sreq.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); else info= sreq.getPathInfo(); diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Dump.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Dump.java index b47d0de2178..d5ddf3fd53f 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Dump.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/Dump.java @@ -39,6 +39,7 @@ import java.util.TimerTask; import javax.servlet.AsyncContext; import javax.servlet.AsyncEvent; import javax.servlet.AsyncListener; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -329,7 +330,7 @@ public class Dump extends HttpServlet // handle an error String error= request.getParameter("error"); - if (error != null && error.length() > 0 && request.getAttribute("javax.servlet.error.status_code")==null) + if (error != null && error.length() > 0 && request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE)==null) { response.getOutputStream().println("THIS SHOULD NOT BE SEEN!"); response.sendError(Integer.parseInt(error)); @@ -874,7 +875,7 @@ public class Dump extends HttpServlet /* ------------------------------------------------------------ */ private String getURI(HttpServletRequest request) { - String uri= (String)request.getAttribute("javax.servlet.forward.request_uri"); + String uri= (String)request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI); if (uri == null) uri= request.getRequestURI(); return uri; diff --git a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/SessionDump.java b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/SessionDump.java index c4290f0cfb0..4d3c085f17b 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/SessionDump.java +++ b/tests/test-webapps/test-jetty-webapp/src/main/java/com/acme/SessionDump.java @@ -23,6 +23,7 @@ import java.io.PrintWriter; import java.util.Date; import java.util.Enumeration; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -193,7 +194,7 @@ public class SessionDump extends HttpServlet /* ------------------------------------------------------------ */ private String getURI(HttpServletRequest request) { - String uri=(String)request.getAttribute("javax.servlet.forward.request_uri"); + String uri=(String)request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI); if (uri==null) uri=request.getRequestURI(); return uri;