478918 Change javax.servlet.error,forward,include literals to RequestDispatcher constants
This commit is contained in:
parent
23946d3c90
commit
9b5aa6f90d
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.jsp;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -59,10 +60,10 @@ public class JettyJspServlet extends JspServlet
|
||||||
|
|
||||||
String servletPath=null;
|
String servletPath=null;
|
||||||
String pathInfo=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");
|
servletPath=(String)request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
|
||||||
pathInfo=(String)request.getAttribute("javax.servlet.include.path_info");
|
pathInfo=(String)request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
|
||||||
if (servletPath==null)
|
if (servletPath==null)
|
||||||
{
|
{
|
||||||
servletPath=request.getServletPath();
|
servletPath=request.getServletPath();
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.io.Writer;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -199,7 +200,7 @@ public class ErrorHandler extends AbstractHandler
|
||||||
protected void writeErrorPageStacks(HttpServletRequest request, Writer writer)
|
protected void writeErrorPageStacks(HttpServletRequest request, Writer writer)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Throwable th = (Throwable)request.getAttribute("javax.servlet.error.exception");
|
Throwable th = (Throwable)request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
|
||||||
while (th != null)
|
while (th != null)
|
||||||
{
|
{
|
||||||
writer.write("<h3>Caused by:</h3><pre>");
|
writer.write("<h3>Caused by:</h3><pre>");
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
@ -76,7 +77,7 @@ public class ConcatServletTest
|
||||||
@Override
|
@Override
|
||||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
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);
|
response.getOutputStream().println(includedURI);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.io.PrintWriter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletConfig;
|
import javax.servlet.ServletConfig;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
@ -178,7 +179,7 @@ public class SessionDump extends HttpServlet
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
private String getURI(HttpServletRequest request)
|
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)
|
if (uri==null)
|
||||||
uri=request.getRequestURI();
|
uri=request.getRequestURI();
|
||||||
return uri;
|
return uri;
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
@ -105,7 +106,7 @@ public class CookieDump extends HttpServlet
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
private String getURI(HttpServletRequest request)
|
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)
|
if (uri==null)
|
||||||
uri=request.getRequestURI();
|
uri=request.getRequestURI();
|
||||||
return uri;
|
return uri;
|
||||||
|
|
|
@ -68,8 +68,8 @@ public class DispatchServlet extends HttpServlet
|
||||||
|
|
||||||
String info;
|
String info;
|
||||||
|
|
||||||
if (sreq.getAttribute("javax.servlet.include.servlet_path") != null)
|
if (sreq.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH) != null)
|
||||||
info= (String)sreq.getAttribute("javax.servlet.include.path_info");
|
info= (String)sreq.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
|
||||||
else
|
else
|
||||||
info= sreq.getPathInfo();
|
info= sreq.getPathInfo();
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import java.util.TimerTask;
|
||||||
import javax.servlet.AsyncContext;
|
import javax.servlet.AsyncContext;
|
||||||
import javax.servlet.AsyncEvent;
|
import javax.servlet.AsyncEvent;
|
||||||
import javax.servlet.AsyncListener;
|
import javax.servlet.AsyncListener;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletConfig;
|
import javax.servlet.ServletConfig;
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
@ -329,7 +330,7 @@ public class Dump extends HttpServlet
|
||||||
|
|
||||||
// handle an error
|
// handle an error
|
||||||
String error= request.getParameter("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.getOutputStream().println("THIS SHOULD NOT BE SEEN!");
|
||||||
response.sendError(Integer.parseInt(error));
|
response.sendError(Integer.parseInt(error));
|
||||||
|
@ -874,7 +875,7 @@ public class Dump extends HttpServlet
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
private String getURI(HttpServletRequest request)
|
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)
|
if (uri == null)
|
||||||
uri= request.getRequestURI();
|
uri= request.getRequestURI();
|
||||||
return uri;
|
return uri;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.PrintWriter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletConfig;
|
import javax.servlet.ServletConfig;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
@ -193,7 +194,7 @@ public class SessionDump extends HttpServlet
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
private String getURI(HttpServletRequest request)
|
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)
|
if (uri==null)
|
||||||
uri=request.getRequestURI();
|
uri=request.getRequestURI();
|
||||||
return uri;
|
return uri;
|
||||||
|
|
Loading…
Reference in New Issue