From: markt Date: Fri, 10 Dec 2010 12:28:20 +0000 (+0000) Subject: Avoid duplicate constant definition. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ca7233d4696a60bf76c4407a0f208a0abf38dd55;p=tomcat7.0 Avoid duplicate constant definition. Use Constants defined by the Servlet/JSP specs where appropriate Use Constants in preference to local Strings git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1044326 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/javax/servlet/jsp/PageContext.java b/java/javax/servlet/jsp/PageContext.java index 323359490..b320a021e 100644 --- a/java/javax/servlet/jsp/PageContext.java +++ b/java/javax/servlet/jsp/PageContext.java @@ -19,6 +19,7 @@ package javax.servlet.jsp; import java.io.IOException; +import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; @@ -514,17 +515,21 @@ public abstract class PageContext int status = 0; Integer status_code = (Integer)getRequest().getAttribute( - "javax.servlet.error.status_code"); + RequestDispatcher.ERROR_STATUS_CODE); // Avoid NPE if attribute is not set if (status_code != null) { status = status_code.intValue(); } return new ErrorData( - (Throwable)getRequest().getAttribute( "javax.servlet.error.exception" ), + (Throwable)getRequest().getAttribute( + RequestDispatcher.ERROR_EXCEPTION), status, - (String)getRequest().getAttribute( "javax.servlet.error.request_uri" ), - (String)getRequest().getAttribute( "javax.servlet.error.servlet_name" ) ); + (String)getRequest().getAttribute( + RequestDispatcher.ERROR_REQUEST_URI), + (String)getRequest().getAttribute( + RequestDispatcher.ERROR_SERVLET_NAME) + ); } } diff --git a/java/org/apache/catalina/Globals.java b/java/org/apache/catalina/Globals.java index 803f512e5..1505a2b8f 100644 --- a/java/org/apache/catalina/Globals.java +++ b/java/org/apache/catalina/Globals.java @@ -86,38 +86,6 @@ public final class Globals { /** - * The request attribute under which we forward a Java exception - * (as an object of type Throwable) to an error page. - */ - public static final String EXCEPTION_ATTR = - "javax.servlet.error.exception"; - - - /** - * The request attribute under which we forward the request URI - * (as an object of type String) of the page on which an error occurred. - */ - public static final String EXCEPTION_PAGE_ATTR = - "javax.servlet.error.request_uri"; - - - /** - * The request attribute under which we forward a Java exception type - * (as an object of type Class) to an error page. - */ - public static final String EXCEPTION_TYPE_ATTR = - "javax.servlet.error.exception_type"; - - - /** - * The request attribute under which we forward an HTTP status message - * (as an object of type STring) to an error page. - */ - public static final String ERROR_MESSAGE_ATTR = - "javax.servlet.error.message"; - - - /** * The request attribute under which we store the key size being used for * this SSL connection (as an object of type java.lang.Integer). */ @@ -166,94 +134,6 @@ public final class Globals { /** - * The request attribute under which the request URI of the included - * servlet is stored on an included dispatcher request. - */ - public static final String INCLUDE_REQUEST_URI_ATTR = - "javax.servlet.include.request_uri"; - - - /** - * The request attribute under which the context path of the included - * servlet is stored on an included dispatcher request. - */ - public static final String INCLUDE_CONTEXT_PATH_ATTR = - "javax.servlet.include.context_path"; - - - /** - * The request attribute under which the path info of the included - * servlet is stored on an included dispatcher request. - */ - public static final String INCLUDE_PATH_INFO_ATTR = - "javax.servlet.include.path_info"; - - - /** - * The request attribute under which the servlet path of the included - * servlet is stored on an included dispatcher request. - */ - public static final String INCLUDE_SERVLET_PATH_ATTR = - "javax.servlet.include.servlet_path"; - - - /** - * The request attribute under which the query string of the included - * servlet is stored on an included dispatcher request. - */ - public static final String INCLUDE_QUERY_STRING_ATTR = - "javax.servlet.include.query_string"; - - - /** - * The request attribute under which the original request URI is stored - * on an forwarded dispatcher request. - */ - public static final String FORWARD_REQUEST_URI_ATTR = - "javax.servlet.forward.request_uri"; - - - /** - * The request attribute under which the original context path is stored - * on an forwarded dispatcher request. - */ - public static final String FORWARD_CONTEXT_PATH_ATTR = - "javax.servlet.forward.context_path"; - - - /** - * The request attribute under which the original path info is stored - * on an forwarded dispatcher request. - */ - public static final String FORWARD_PATH_INFO_ATTR = - "javax.servlet.forward.path_info"; - - - /** - * The request attribute under which the original servlet path is stored - * on an forwarded dispatcher request. - */ - public static final String FORWARD_SERVLET_PATH_ATTR = - "javax.servlet.forward.servlet_path"; - - - /** - * The request attribute under which the original query string is stored - * on an forwarded dispatcher request. - */ - public static final String FORWARD_QUERY_STRING_ATTR = - "javax.servlet.forward.query_string"; - - - /** - * The request attribute under which we forward a servlet name to - * an error page. - */ - public static final String SERVLET_NAME_ATTR = - "javax.servlet.error.servlet_name"; - - - /** * The servlet context attribute under which we store a flag used * to mark this request as having been processed by the SSIServlet. * We do this because of the pathInfo mangling happening when using @@ -265,14 +145,6 @@ public final class Globals { /** - * The request attribute under which we forward an HTTP status code - * (as an object of type Integer) to an error page. - */ - public static final String STATUS_CODE_ATTR = - "javax.servlet.error.status_code"; - - - /** * The subject under which the AccessControlContext is running. */ public static final String SUBJECT_ATTR = diff --git a/java/org/apache/catalina/authenticator/FormAuthenticator.java b/java/org/apache/catalina/authenticator/FormAuthenticator.java index 5b57e2227..9dc3ed51f 100644 --- a/java/org/apache/catalina/authenticator/FormAuthenticator.java +++ b/java/org/apache/catalina/authenticator/FormAuthenticator.java @@ -30,7 +30,6 @@ import javax.servlet.RequestDispatcher; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; -import org.apache.catalina.Globals; import org.apache.catalina.Realm; import org.apache.catalina.Session; import org.apache.catalina.connector.Request; @@ -378,7 +377,7 @@ public class FormAuthenticator ExceptionUtils.handleThrowable(t); String msg = sm.getString("formAuthenticator.forwardLoginFail"); log.warn(msg, t); - request.setAttribute(Globals.EXCEPTION_ATTR, t); + request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); } @@ -411,7 +410,7 @@ public class FormAuthenticator ExceptionUtils.handleThrowable(t); String msg = sm.getString("formAuthenticator.forwardErrorFail"); log.warn(msg, t); - request.setAttribute(Globals.EXCEPTION_ATTR, t); + request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); } diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java index 0cb736eee..e4c3eab0b 100644 --- a/java/org/apache/catalina/connector/CoyoteAdapter.java +++ b/java/org/apache/catalina/connector/CoyoteAdapter.java @@ -22,10 +22,10 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.EnumSet; +import javax.servlet.RequestDispatcher; import javax.servlet.SessionTrackingMode; import org.apache.catalina.Context; -import org.apache.catalina.Globals; import org.apache.catalina.Wrapper; import org.apache.catalina.comet.CometEvent; import org.apache.catalina.core.ApplicationSessionCookieConfig; @@ -207,7 +207,8 @@ public class CoyoteAdapter implements Adapter { // Calling the container connector.getService().getContainer().getPipeline().getFirst().event(request, response, request.getEvent()); - if (!error && !response.isClosed() && (request.getAttribute(Globals.EXCEPTION_ATTR) != null)) { + if (!error && !response.isClosed() && (request.getAttribute( + RequestDispatcher.ERROR_EXCEPTION) != null)) { // An unexpected exception occurred while processing the event, so // error should be called request.getEvent().setEventType(CometEvent.EventType.ERROR); @@ -275,7 +276,7 @@ public class CoyoteAdapter implements Adapter { success = true; connector.getService().getContainer().getPipeline().getFirst().invoke(request, response); Throwable t = (Throwable) request.getAttribute( - Globals.EXCEPTION_ATTR); + RequestDispatcher.ERROR_EXCEPTION); if (t != null) { asyncConImpl.setErrorState(t); } diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index c2ef8dc99..66ca28c52 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -1342,7 +1342,8 @@ public class Request return (context.getServletContext().getRequestDispatcher(path)); // Convert a request-relative path to a context-relative one - String servletPath = (String) getAttribute(Globals.INCLUDE_SERVLET_PATH_ATTR); + String servletPath = (String) getAttribute( + RequestDispatcher.INCLUDE_SERVLET_PATH); if (servletPath == null) servletPath = getServletPath(); @@ -1453,7 +1454,7 @@ public class Request ExceptionUtils.handleThrowable(t); context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t); // Error valve will pick this exception up and display it to user - attributes.put(Globals.EXCEPTION_ATTR, t); + attributes.put(RequestDispatcher.ERROR_EXCEPTION, t); } } } @@ -1540,7 +1541,7 @@ public class Request ExceptionUtils.handleThrowable(t); context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t); // Error valve will pick this exception up and display it to user - attributes.put( Globals.EXCEPTION_ATTR, t ); + attributes.put(RequestDispatcher.ERROR_EXCEPTION, t ); } } } diff --git a/java/org/apache/catalina/core/ApplicationDispatcher.java b/java/org/apache/catalina/core/ApplicationDispatcher.java index 55c071343..583b8dce4 100644 --- a/java/org/apache/catalina/core/ApplicationDispatcher.java +++ b/java/org/apache/catalina/core/ApplicationDispatcher.java @@ -376,16 +376,17 @@ final class ApplicationDispatcher (ApplicationHttpRequest) wrapRequest(state); String contextPath = context.getPath(); HttpServletRequest hrequest = state.hrequest; - if (hrequest.getAttribute(Globals.FORWARD_REQUEST_URI_ATTR) == null) { - wrequest.setAttribute(Globals.FORWARD_REQUEST_URI_ATTR, + if (hrequest.getAttribute( + RequestDispatcher.FORWARD_REQUEST_URI) == null) { + wrequest.setAttribute(RequestDispatcher.FORWARD_REQUEST_URI, hrequest.getRequestURI()); - wrequest.setAttribute(Globals.FORWARD_CONTEXT_PATH_ATTR, + wrequest.setAttribute(RequestDispatcher.FORWARD_CONTEXT_PATH, hrequest.getContextPath()); - wrequest.setAttribute(Globals.FORWARD_SERVLET_PATH_ATTR, + wrequest.setAttribute(RequestDispatcher.FORWARD_SERVLET_PATH, hrequest.getServletPath()); - wrequest.setAttribute(Globals.FORWARD_PATH_INFO_ATTR, + wrequest.setAttribute(RequestDispatcher.FORWARD_PATH_INFO, hrequest.getPathInfo()); - wrequest.setAttribute(Globals.FORWARD_QUERY_STRING_ATTR, + wrequest.setAttribute(RequestDispatcher.FORWARD_QUERY_STRING, hrequest.getQueryString()); } @@ -555,19 +556,19 @@ final class ApplicationDispatcher (ApplicationHttpRequest) wrapRequest(state); String contextPath = context.getPath(); if (requestURI != null) - wrequest.setAttribute(Globals.INCLUDE_REQUEST_URI_ATTR, + wrequest.setAttribute(RequestDispatcher.INCLUDE_REQUEST_URI, requestURI); if (contextPath != null) - wrequest.setAttribute(Globals.INCLUDE_CONTEXT_PATH_ATTR, + wrequest.setAttribute(RequestDispatcher.INCLUDE_CONTEXT_PATH, contextPath); if (servletPath != null) - wrequest.setAttribute(Globals.INCLUDE_SERVLET_PATH_ATTR, + wrequest.setAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH, servletPath); if (pathInfo != null) - wrequest.setAttribute(Globals.INCLUDE_PATH_INFO_ATTR, + wrequest.setAttribute(RequestDispatcher.INCLUDE_PATH_INFO, pathInfo); if (queryString != null) { - wrequest.setAttribute(Globals.INCLUDE_QUERY_STRING_ATTR, + wrequest.setAttribute(RequestDispatcher.INCLUDE_QUERY_STRING, queryString); wrequest.setQueryParams(queryString); } @@ -866,8 +867,8 @@ final class ApplicationDispatcher (state.outerRequest instanceof HttpServletRequest)) { HttpServletRequest houterRequest = (HttpServletRequest) state.outerRequest; - Object contextPath = houterRequest.getAttribute - (Globals.INCLUDE_CONTEXT_PATH_ATTR); + Object contextPath = houterRequest.getAttribute( + RequestDispatcher.INCLUDE_CONTEXT_PATH); if (contextPath == null) { // Forward contextPath = houterRequest.getContextPath(); diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java index adbec8fbd..a158dde30 100644 --- a/java/org/apache/catalina/core/ApplicationHttpRequest.java +++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java @@ -69,11 +69,16 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper { * The set of attribute names that are special for request dispatchers. */ protected static final String specials[] = - { Globals.INCLUDE_REQUEST_URI_ATTR, Globals.INCLUDE_CONTEXT_PATH_ATTR, - Globals.INCLUDE_SERVLET_PATH_ATTR, Globals.INCLUDE_PATH_INFO_ATTR, - Globals.INCLUDE_QUERY_STRING_ATTR, Globals.FORWARD_REQUEST_URI_ATTR, - Globals.FORWARD_CONTEXT_PATH_ATTR, Globals.FORWARD_SERVLET_PATH_ATTR, - Globals.FORWARD_PATH_INFO_ATTR, Globals.FORWARD_QUERY_STRING_ATTR }; + { RequestDispatcher.INCLUDE_REQUEST_URI, + RequestDispatcher.INCLUDE_CONTEXT_PATH, + RequestDispatcher.INCLUDE_SERVLET_PATH, + RequestDispatcher.INCLUDE_PATH_INFO, + RequestDispatcher.INCLUDE_QUERY_STRING, + RequestDispatcher.FORWARD_REQUEST_URI, + RequestDispatcher.FORWARD_CONTEXT_PATH, + RequestDispatcher.FORWARD_SERVLET_PATH, + RequestDispatcher.FORWARD_PATH_INFO, + RequestDispatcher.FORWARD_QUERY_STRING }; /** @@ -307,7 +312,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper { // Convert a request-relative path to a context-relative one String servletPath = - (String) getAttribute(Globals.INCLUDE_SERVLET_PATH_ATTR); + (String) getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); if (servletPath == null) servletPath = getServletPath(); diff --git a/java/org/apache/catalina/core/ApplicationRequest.java b/java/org/apache/catalina/core/ApplicationRequest.java index b260e443e..348b67592 100644 --- a/java/org/apache/catalina/core/ApplicationRequest.java +++ b/java/org/apache/catalina/core/ApplicationRequest.java @@ -22,10 +22,10 @@ package org.apache.catalina.core; import java.util.Enumeration; import java.util.HashMap; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletRequest; import javax.servlet.ServletRequestWrapper; -import org.apache.catalina.Globals; import org.apache.catalina.util.Enumerator; import org.apache.tomcat.util.res.StringManager; @@ -56,11 +56,16 @@ class ApplicationRequest extends ServletRequestWrapper { * The set of attribute names that are special for request dispatchers. */ protected static final String specials[] = - { Globals.INCLUDE_REQUEST_URI_ATTR, Globals.INCLUDE_CONTEXT_PATH_ATTR, - Globals.INCLUDE_SERVLET_PATH_ATTR, Globals.INCLUDE_PATH_INFO_ATTR, - Globals.INCLUDE_QUERY_STRING_ATTR, Globals.FORWARD_REQUEST_URI_ATTR, - Globals.FORWARD_CONTEXT_PATH_ATTR, Globals.FORWARD_SERVLET_PATH_ATTR, - Globals.FORWARD_PATH_INFO_ATTR, Globals.FORWARD_QUERY_STRING_ATTR }; + { RequestDispatcher.INCLUDE_REQUEST_URI, + RequestDispatcher.INCLUDE_CONTEXT_PATH, + RequestDispatcher.INCLUDE_SERVLET_PATH, + RequestDispatcher.INCLUDE_PATH_INFO, + RequestDispatcher.INCLUDE_QUERY_STRING, + RequestDispatcher.FORWARD_REQUEST_URI, + RequestDispatcher.FORWARD_CONTEXT_PATH, + RequestDispatcher.FORWARD_SERVLET_PATH, + RequestDispatcher.FORWARD_PATH_INFO, + RequestDispatcher.FORWARD_QUERY_STRING }; // ----------------------------------------------------------- Constructors diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 500866191..5f9a9bc75 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -51,6 +51,7 @@ import javax.naming.NamingException; import javax.naming.directory.DirContext; import javax.servlet.DispatcherType; import javax.servlet.FilterConfig; +import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletContainerInitializer; import javax.servlet.ServletContext; @@ -5749,7 +5750,7 @@ public class StandardContext extends ContainerBase getLogger().error(sm.getString( "standardContext.requestListener.requestInit", instances[i].getClass().getName()), t); - request.setAttribute(Globals.EXCEPTION_ATTR,t); + request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); return false; } } @@ -5787,7 +5788,7 @@ public class StandardContext extends ContainerBase getLogger().error(sm.getString( "standardContext.requestListener.requestInit", instances[j].getClass().getName()), t); - request.setAttribute(Globals.EXCEPTION_ATTR,t); + request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t); return false; } } diff --git a/java/org/apache/catalina/core/StandardHostValve.java b/java/org/apache/catalina/core/StandardHostValve.java index 757b83337..deca53562 100644 --- a/java/org/apache/catalina/core/StandardHostValve.java +++ b/java/org/apache/catalina/core/StandardHostValve.java @@ -172,7 +172,8 @@ final class StandardHostValve // Error page processing response.setSuspended(false); - Throwable t = (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR); + Throwable t = (Throwable) request.getAttribute( + RequestDispatcher.ERROR_EXCEPTION); if (t != null) { throwable(request, response, t); @@ -230,7 +231,8 @@ final class StandardHostValve // Error page processing response.setSuspended(false); - Throwable t = (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR); + Throwable t = (Throwable) request.getAttribute( + RequestDispatcher.ERROR_EXCEPTION); if (t != null) { throwable(request, response, t); @@ -296,20 +298,19 @@ final class StandardHostValve errorPage.getLocation()); request.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR, DispatcherType.ERROR); - request.setAttribute - (Globals.STATUS_CODE_ATTR, - new Integer(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); - request.setAttribute(Globals.ERROR_MESSAGE_ATTR, + request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE, + new Integer(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); + request.setAttribute(RequestDispatcher.ERROR_MESSAGE, throwable.getMessage()); - request.setAttribute(Globals.EXCEPTION_ATTR, + request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, realError); Wrapper wrapper = request.getWrapper(); if (wrapper != null) - request.setAttribute(Globals.SERVLET_NAME_ATTR, + request.setAttribute(RequestDispatcher.ERROR_SERVLET_NAME, wrapper.getName()); - request.setAttribute(Globals.EXCEPTION_PAGE_ATTR, + request.setAttribute(RequestDispatcher.ERROR_REQUEST_URI, request.getRequestURI()); - request.setAttribute(Globals.EXCEPTION_TYPE_ATTR, + request.setAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE, realError.getClass()); if (custom(request, response, errorPage)) { try { @@ -363,13 +364,13 @@ final class StandardHostValve ErrorPage errorPage = context.findErrorPage(statusCode); if (errorPage != null) { response.setAppCommitted(false); - request.setAttribute(Globals.STATUS_CODE_ATTR, + request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE, Integer.valueOf(statusCode)); String message = response.getMessage(); if (message == null) message = ""; - request.setAttribute(Globals.ERROR_MESSAGE_ATTR, message); + request.setAttribute(RequestDispatcher.ERROR_MESSAGE, message); request.setAttribute (ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR, errorPage.getLocation()); @@ -379,9 +380,9 @@ final class StandardHostValve Wrapper wrapper = request.getWrapper(); if (wrapper != null) - request.setAttribute(Globals.SERVLET_NAME_ATTR, + request.setAttribute(RequestDispatcher.ERROR_SERVLET_NAME, wrapper.getName()); - request.setAttribute(Globals.EXCEPTION_PAGE_ATTR, + request.setAttribute(RequestDispatcher.ERROR_REQUEST_URI, request.getRequestURI()); if (custom(request, response, errorPage)) { try { diff --git a/java/org/apache/catalina/core/StandardWrapperValve.java b/java/org/apache/catalina/core/StandardWrapperValve.java index 63af4f33c..8a0a00cd2 100644 --- a/java/org/apache/catalina/core/StandardWrapperValve.java +++ b/java/org/apache/catalina/core/StandardWrapperValve.java @@ -22,13 +22,13 @@ package org.apache.catalina.core; import java.io.IOException; import javax.servlet.DispatcherType; +import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletException; import javax.servlet.UnavailableException; import javax.servlet.http.HttpServletResponse; import org.apache.catalina.Context; -import org.apache.catalina.Globals; import org.apache.catalina.LifecycleException; import org.apache.catalina.comet.CometEvent; import org.apache.catalina.comet.CometProcessor; @@ -522,7 +522,7 @@ final class StandardWrapperValve */ private void exception(Request request, Response response, Throwable exception) { - request.setAttribute(Globals.EXCEPTION_ATTR, exception); + request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, exception); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } diff --git a/java/org/apache/catalina/servlets/CGIServlet.java b/java/org/apache/catalina/servlets/CGIServlet.java index e3e85edc5..5da05f744 100644 --- a/java/org/apache/catalina/servlets/CGIServlet.java +++ b/java/org/apache/catalina/servlets/CGIServlet.java @@ -36,6 +36,7 @@ import java.util.Locale; import java.util.StringTokenizer; import java.util.Vector; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -46,7 +47,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.catalina.Globals; import org.apache.catalina.util.IOTools; @@ -722,16 +722,17 @@ public final class CGIServlet extends HttpServlet { boolean isIncluded = false; // Look to see if this request is an include - if (req.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR) != null) { + if (req.getAttribute( + RequestDispatcher.INCLUDE_REQUEST_URI) != null) { isIncluded = true; } if (isIncluded) { this.contextPath = (String) req.getAttribute( - Globals.INCLUDE_CONTEXT_PATH_ATTR); + RequestDispatcher.INCLUDE_CONTEXT_PATH); this.servletPath = (String) req.getAttribute( - Globals.INCLUDE_SERVLET_PATH_ATTR); + RequestDispatcher.INCLUDE_SERVLET_PATH); this.pathInfo = (String) req.getAttribute( - Globals.INCLUDE_PATH_INFO_ATTR); + RequestDispatcher.INCLUDE_PATH_INFO); } else { this.contextPath = req.getContextPath(); this.servletPath = req.getServletPath(); @@ -753,7 +754,7 @@ public final class CGIServlet extends HttpServlet { String qs; if (isIncluded) { qs = (String) req.getAttribute( - Globals.INCLUDE_QUERY_STRING_ATTR); + RequestDispatcher.INCLUDE_QUERY_STRING); } else { qs = req.getQueryString(); } diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index cddefcd91..0fc2ec451 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -43,6 +43,7 @@ import javax.naming.NameClassPair; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.DirContext; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; @@ -345,15 +346,16 @@ public class DefaultServlet // subclasses can change this behaviour. // Are we being processed by a RequestDispatcher.include()? - if (request.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR) != null) { + if (request.getAttribute( + RequestDispatcher.INCLUDE_REQUEST_URI) != null) { String result = (String) request.getAttribute( - Globals.INCLUDE_PATH_INFO_ATTR); + RequestDispatcher.INCLUDE_PATH_INFO); if (result == null) { result = (String) request.getAttribute( - Globals.INCLUDE_SERVLET_PATH_ATTR); + RequestDispatcher.INCLUDE_SERVLET_PATH); } else { result = (String) request.getAttribute( - Globals.INCLUDE_SERVLET_PATH_ATTR) + result; + RequestDispatcher.INCLUDE_SERVLET_PATH) + result; } if ((result == null) || (result.equals(""))) { result = "/"; @@ -759,7 +761,7 @@ public class DefaultServlet // Check if we're included so we can return the appropriate // missing resource name in the error String requestUri = (String) request.getAttribute( - Globals.INCLUDE_REQUEST_URI_ATTR); + RequestDispatcher.INCLUDE_REQUEST_URI); if (requestUri == null) { requestUri = request.getRequestURI(); } else { @@ -782,7 +784,7 @@ public class DefaultServlet // Check if we're included so we can return the appropriate // missing resource name in the error String requestUri = (String) request.getAttribute( - Globals.INCLUDE_REQUEST_URI_ATTR); + RequestDispatcher.INCLUDE_REQUEST_URI); if (requestUri == null) { requestUri = request.getRequestURI(); } @@ -800,8 +802,8 @@ public class DefaultServlet if (cacheEntry.context == null) { // Checking If headers - boolean included = - (request.getAttribute(Globals.INCLUDE_CONTEXT_PATH_ATTR) != null); + boolean included = (request.getAttribute( + RequestDispatcher.INCLUDE_CONTEXT_PATH) != null); if (!included && !isError && !checkIfHeaders(request, response, cacheEntry.attributes)) { return; diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index 3276b4fa0..4d0382a63 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -39,6 +39,7 @@ import javax.naming.NameClassPair; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.directory.DirContext; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.UnavailableException; @@ -48,7 +49,6 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.catalina.Globals; import org.apache.catalina.util.DOMWriter; import org.apache.catalina.util.MD5Encoder; import org.apache.catalina.util.RequestUtil; @@ -429,9 +429,10 @@ public class WebdavServlet @Override protected String getRelativePath(HttpServletRequest request) { // Are we being processed by a RequestDispatcher.include()? - if (request.getAttribute(Globals.INCLUDE_REQUEST_URI_ATTR) != null) { + if (request.getAttribute( + RequestDispatcher.INCLUDE_REQUEST_URI) != null) { String result = (String) request.getAttribute( - Globals.INCLUDE_PATH_INFO_ATTR); + RequestDispatcher.INCLUDE_PATH_INFO); if ((result == null) || (result.equals(""))) result = "/"; return (result); diff --git a/java/org/apache/catalina/ssi/SSIServletExternalResolver.java b/java/org/apache/catalina/ssi/SSIServletExternalResolver.java index c5aa02ba2..74a1799c4 100644 --- a/java/org/apache/catalina/ssi/SSIServletExternalResolver.java +++ b/java/org/apache/catalina/ssi/SSIServletExternalResolver.java @@ -293,7 +293,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver { else if (nameParts[1].equals("URI")) { // If this is an error page, get the original URI retVal = (String) req.getAttribute( - "javax.servlet.forward.request_uri"); + RequestDispatcher.FORWARD_REQUEST_URI); if (retVal == null) retVal=req.getRequestURI(); } } else if (nameParts[0].equals("SCRIPT")) { diff --git a/java/org/apache/catalina/ssi/SSIServletRequestUtil.java b/java/org/apache/catalina/ssi/SSIServletRequestUtil.java index 2a91be58a..8f76401a9 100644 --- a/java/org/apache/catalina/ssi/SSIServletRequestUtil.java +++ b/java/org/apache/catalina/ssi/SSIServletRequestUtil.java @@ -17,6 +17,7 @@ package org.apache.catalina.ssi; +import javax.servlet.RequestDispatcher; import javax.servlet.http.HttpServletRequest; import org.apache.catalina.util.RequestUtil; @@ -31,12 +32,13 @@ public class SSIServletRequestUtil { */ public static String getRelativePath(HttpServletRequest request) { // Are we being processed by a RequestDispatcher.include()? - if (request.getAttribute("javax.servlet.include.request_uri") != null) { - String result = (String)request - .getAttribute("javax.servlet.include.path_info"); + if (request.getAttribute( + RequestDispatcher.INCLUDE_REQUEST_URI) != null) { + String result = (String)request.getAttribute( + RequestDispatcher.INCLUDE_PATH_INFO); if (result == null) - result = (String)request - .getAttribute("javax.servlet.include.servlet_path"); + result = (String)request.getAttribute( + RequestDispatcher.INCLUDE_SERVLET_PATH); if ((result == null) || (result.equals(""))) result = "/"; return (result); } diff --git a/java/org/apache/catalina/valves/ErrorReportValve.java b/java/org/apache/catalina/valves/ErrorReportValve.java index fe99839a7..5ad3e1ebb 100644 --- a/java/org/apache/catalina/valves/ErrorReportValve.java +++ b/java/org/apache/catalina/valves/ErrorReportValve.java @@ -22,10 +22,10 @@ package org.apache.catalina.valves; import java.io.IOException; import java.io.Writer; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; -import org.apache.catalina.Globals; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.catalina.util.RequestUtil; @@ -116,7 +116,7 @@ public class ErrorReportValve extends ValveBase { } Throwable throwable = - (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR); + (Throwable) request.getAttribute(RequestDispatcher.ERROR_EXCEPTION); if (throwable != null) { diff --git a/java/org/apache/catalina/valves/SSLValve.java b/java/org/apache/catalina/valves/SSLValve.java index 4ebfaccd3..dac656790 100644 --- a/java/org/apache/catalina/valves/SSLValve.java +++ b/java/org/apache/catalina/valves/SSLValve.java @@ -24,6 +24,7 @@ import java.security.cert.X509Certificate; import javax.servlet.ServletException; +import org.apache.catalina.Globals; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; @@ -43,8 +44,7 @@ import org.apache.catalina.connector.Response; * @version $Id$ */ -public class SSLValve - extends ValveBase { +public class SSLValve extends ValveBase { //------------------------------------------------------ Constructor @@ -87,19 +87,19 @@ public class SSLValve System.out.println("SSLValve failed " + strcerts); System.out.println("SSLValve failed " + e); } - request.setAttribute("javax.servlet.request.X509Certificate", jsseCerts); + request.setAttribute(Globals.CERTIFICATES_ATTR, jsseCerts); } strcert0 = mygetHeader(request, "ssl_cipher"); if (strcert0 != null) { - request.setAttribute("javax.servlet.request.cipher_suite", strcert0); + request.setAttribute(Globals.CIPHER_SUITE_ATTR, strcert0); } strcert0 = mygetHeader(request, "ssl_session_id"); if (strcert0 != null) { - request.setAttribute("javax.servlet.request.ssl_session", strcert0); + request.setAttribute(Globals.SSL_SESSION_ID_ATTR, strcert0); } strcert0 = mygetHeader(request, "ssl_cipher_usekeysize"); if (strcert0 != null) { - request.setAttribute("javax.servlet.request.key_size", strcert0); + request.setAttribute(Globals.KEY_SIZE_ATTR, strcert0); } getNext().invoke(request, response); } diff --git a/java/org/apache/coyote/ajp/AbstractAjpProcessor.java b/java/org/apache/coyote/ajp/AbstractAjpProcessor.java index c825c3508..2058c2377 100644 --- a/java/org/apache/coyote/ajp/AbstractAjpProcessor.java +++ b/java/org/apache/coyote/ajp/AbstractAjpProcessor.java @@ -42,6 +42,7 @@ import org.apache.tomcat.util.http.HttpMessages; import org.apache.tomcat.util.http.MimeHeaders; import org.apache.tomcat.util.net.AbstractEndpoint; import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState; +import org.apache.tomcat.util.net.SSLSupport; import org.apache.tomcat.util.res.StringManager; /** @@ -301,7 +302,7 @@ public abstract class AbstractAjpProcessor implements ActionHook, Processor { getLog().error(sm.getString("ajpprocessor.certs.fail"), e); return; } - request.setAttribute(AbstractEndpoint.CERTIFICATE_KEY, jsseCerts); + request.setAttribute(SSLSupport.CERTIFICATE_KEY, jsseCerts); } } else if (actionCode == ActionCode.REQ_HOST_ATTRIBUTE) { @@ -558,19 +559,19 @@ public abstract class AbstractAjpProcessor implements ActionHook, Processor { case Constants.SC_A_SSL_CIPHER : request.scheme().setString("https"); requestHeaderMessage.getBytes(tmpMB); - request.setAttribute(AbstractEndpoint.CIPHER_SUITE_KEY, + request.setAttribute(SSLSupport.CIPHER_SUITE_KEY, tmpMB.toString()); break; case Constants.SC_A_SSL_SESSION : request.scheme().setString("https"); requestHeaderMessage.getBytes(tmpMB); - request.setAttribute(AbstractEndpoint.SESSION_ID_KEY, + request.setAttribute(SSLSupport.SESSION_ID_KEY, tmpMB.toString()); break; case Constants.SC_A_SSL_KEY_SIZE : - request.setAttribute(AbstractEndpoint.KEY_SIZE_KEY, + request.setAttribute(SSLSupport.KEY_SIZE_KEY, Integer.valueOf(requestHeaderMessage.getInt())); break; diff --git a/java/org/apache/coyote/http11/Http11AprProcessor.java b/java/org/apache/coyote/http11/Http11AprProcessor.java index c802542ad..8096f5b0f 100644 --- a/java/org/apache/coyote/http11/Http11AprProcessor.java +++ b/java/org/apache/coyote/http11/Http11AprProcessor.java @@ -45,6 +45,7 @@ import org.apache.tomcat.util.http.MimeHeaders; import org.apache.tomcat.util.net.AbstractEndpoint; import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState; import org.apache.tomcat.util.net.AprEndpoint; +import org.apache.tomcat.util.net.SSLSupport; import org.apache.tomcat.util.net.SocketStatus; import org.apache.tomcat.util.net.SocketWrapper; @@ -518,7 +519,7 @@ public class Http11AprProcessor extends AbstractHttp11Processor { // Cipher suite Object sslO = SSLSocket.getInfoS(socketRef, SSL.SSL_INFO_CIPHER); if (sslO != null) { - request.setAttribute(AbstractEndpoint.CIPHER_SUITE_KEY, sslO); + request.setAttribute(SSLSupport.CIPHER_SUITE_KEY, sslO); } // Get client certificate and the certificate chain if present // certLength == -1 indicates an error @@ -535,17 +536,17 @@ public class Http11AprProcessor extends AbstractHttp11Processor { } } if (certs != null) { - request.setAttribute(AbstractEndpoint.CERTIFICATE_KEY, certs); + request.setAttribute(SSLSupport.CERTIFICATE_KEY, certs); } // User key size sslO = Integer.valueOf(SSLSocket.getInfoI(socketRef, SSL.SSL_INFO_CIPHER_USEKEYSIZE)); - request.setAttribute(AbstractEndpoint.KEY_SIZE_KEY, sslO); + request.setAttribute(SSLSupport.KEY_SIZE_KEY, sslO); // SSL session ID sslO = SSLSocket.getInfoS(socketRef, SSL.SSL_INFO_SESSION_ID); if (sslO != null) { - request.setAttribute(AbstractEndpoint.SESSION_ID_KEY, sslO); + request.setAttribute(SSLSupport.SESSION_ID_KEY, sslO); } //TODO provide a hook to enable the SSL session to be // invalidated. Set AprEndpoint.SESSION_MGR req attr @@ -584,7 +585,7 @@ public class Http11AprProcessor extends AbstractHttp11Processor { } } if (certs != null) { - request.setAttribute(AbstractEndpoint.CERTIFICATE_KEY, certs); + request.setAttribute(SSLSupport.CERTIFICATE_KEY, certs); } } } catch (Exception e) { diff --git a/java/org/apache/jasper/Constants.java b/java/org/apache/jasper/Constants.java index ec2024aa1..60ff5e3c7 100644 --- a/java/org/apache/jasper/Constants.java +++ b/java/org/apache/jasper/Constants.java @@ -120,12 +120,6 @@ public class Constants { public static final String TAG_FILE_PACKAGE_NAME = System.getProperty("org.apache.jasper.Constants.TAG_FILE_PACKAGE_NAME", "org.apache.jsp.tag"); - /** - * Servlet context and request attributes that the JSP engine - * uses. - */ - public static final String INC_SERVLET_PATH = "javax.servlet.include.servlet_path"; - // Must be kept in sync with org/apache/catalina/Globals.java public static final String ALT_DD_ATTR = System.getProperty("org.apache.jasper.Constants.ALT_DD_ATTR", "org.apache.catalina.deploy.alt_dd"); diff --git a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java index 174eca79b..5fc164b88 100644 --- a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java +++ b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java @@ -55,11 +55,6 @@ import org.apache.jasper.compiler.Localizer; */ public class JspRuntimeLibrary { - private static final String SERVLET_EXCEPTION - = "javax.servlet.error.exception"; - private static final String JSP_EXCEPTION - = "javax.servlet.jsp.jspException"; - protected static class PrivilegedIntrospectHelper implements PrivilegedExceptionAction { @@ -100,9 +95,10 @@ public class JspRuntimeLibrary { * variable is initialized. */ public static Throwable getThrowable(ServletRequest request) { - Throwable error = (Throwable) request.getAttribute(SERVLET_EXCEPTION); + Throwable error = (Throwable) request.getAttribute( + RequestDispatcher.ERROR_EXCEPTION); if (error == null) { - error = (Throwable) request.getAttribute(JSP_EXCEPTION); + error = (Throwable) request.getAttribute(PageContext.EXCEPTION); if (error != null) { /* * The only place that sets JSP_EXCEPTION is @@ -111,7 +107,7 @@ public class JspRuntimeLibrary { * ErrorReportValve. Therefore, if JSP_EXCEPTION is set, we * need to set SERVLET_EXCEPTION. */ - request.setAttribute(SERVLET_EXCEPTION, error); + request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, error); } } @@ -875,11 +871,11 @@ public class JspRuntimeLibrary { if (!(request instanceof HttpServletRequest)) return (relativePath); HttpServletRequest hrequest = (HttpServletRequest) request; - String uri = (String) - request.getAttribute("javax.servlet.include.servlet_path"); + String uri = (String) request.getAttribute( + RequestDispatcher.INCLUDE_SERVLET_PATH); if (uri != null) { String pathInfo = (String) - request.getAttribute("javax.servlet.include.path_info"); + request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (pathInfo == null) { if (uri.lastIndexOf('/') >= 0) uri = uri.substring(0, uri.lastIndexOf('/')); diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java b/java/org/apache/jasper/runtime/PageContextImpl.java index b040e7a39..42ab001a9 100644 --- a/java/org/apache/jasper/runtime/PageContextImpl.java +++ b/java/org/apache/jasper/runtime/PageContextImpl.java @@ -29,6 +29,7 @@ import java.util.HashMap; import javax.el.ELContext; import javax.el.ExpressionFactory; import javax.el.ValueExpression; +import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; @@ -47,7 +48,6 @@ import javax.servlet.jsp.el.ExpressionEvaluator; import javax.servlet.jsp.el.VariableResolver; import javax.servlet.jsp.tagext.BodyContent; -import org.apache.jasper.Constants; import org.apache.jasper.compiler.Localizer; import org.apache.jasper.el.ELContextImpl; import org.apache.jasper.el.ExpressionEvaluatorImpl; @@ -170,7 +170,8 @@ public class PageContextImpl extends PageContext { setAttribute(PAGECONTEXT, this); setAttribute(APPLICATION, context); - isIncluded = request.getAttribute("javax.servlet.include.servlet_path") != null; + isIncluded = request.getAttribute( + RequestDispatcher.INCLUDE_SERVLET_PATH) != null; } @Override @@ -638,8 +639,8 @@ public class PageContextImpl extends PageContext { String path = relativeUrlPath; if (!path.startsWith("/")) { - String uri = (String) request - .getAttribute("javax.servlet.include.servlet_path"); + String uri = (String) request.getAttribute( + RequestDispatcher.INCLUDE_SERVLET_PATH); if (uri == null) uri = ((HttpServletRequest) request).getServletPath(); String baseURI = uri.substring(0, uri.lastIndexOf('/')); @@ -739,16 +740,17 @@ public class PageContextImpl extends PageContext { } final String path = getAbsolutePathRelativeToContext(relativeUrlPath); - String includeUri = (String) request - .getAttribute(Constants.INC_SERVLET_PATH); + String includeUri = (String) request.getAttribute( + RequestDispatcher.INCLUDE_SERVLET_PATH); if (includeUri != null) - request.removeAttribute(Constants.INC_SERVLET_PATH); + request.removeAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); try { context.getRequestDispatcher(path).forward(request, response); } finally { if (includeUri != null) - request.setAttribute(Constants.INC_SERVLET_PATH, includeUri); + request.setAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH, + includeUri); } } @@ -858,13 +860,13 @@ public class PageContextImpl extends PageContext { * not been committed (the response will have been committed if the * error page is a JSP page). */ - request.setAttribute("javax.servlet.jsp.jspException", t); - request.setAttribute("javax.servlet.error.status_code", + request.setAttribute(PageContext.EXCEPTION, t); + request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE, new Integer(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); - request.setAttribute("javax.servlet.error.request_uri", + request.setAttribute(RequestDispatcher.ERROR_REQUEST_URI, ((HttpServletRequest) request).getRequestURI()); - request.setAttribute("javax.servlet.error.servlet_name", config - .getServletName()); + request.setAttribute(RequestDispatcher.ERROR_SERVLET_NAME, + config.getServletName()); try { forward(errorPageURL); } catch (IllegalStateException ise) { @@ -873,19 +875,19 @@ public class PageContextImpl extends PageContext { // The error page could be inside an include. - Object newException = request - .getAttribute("javax.servlet.error.exception"); + Object newException = + request.getAttribute(RequestDispatcher.ERROR_EXCEPTION); // t==null means the attribute was not set. if ((newException != null) && (newException == t)) { - request.removeAttribute("javax.servlet.error.exception"); + request.removeAttribute(RequestDispatcher.ERROR_EXCEPTION); } // now clear the error code - to prevent double handling. - request.removeAttribute("javax.servlet.error.status_code"); - request.removeAttribute("javax.servlet.error.request_uri"); - request.removeAttribute("javax.servlet.error.status_code"); - request.removeAttribute("javax.servlet.jsp.jspException"); + request.removeAttribute(RequestDispatcher.ERROR_STATUS_CODE); + request.removeAttribute(RequestDispatcher.ERROR_REQUEST_URI); + request.removeAttribute(RequestDispatcher.ERROR_SERVLET_NAME); + request.removeAttribute(PageContext.EXCEPTION); } else { // Otherwise throw the exception wrapped inside a ServletException. diff --git a/java/org/apache/jasper/servlet/JspServlet.java b/java/org/apache/jasper/servlet/JspServlet.java index f95c0aa09..00e00768f 100644 --- a/java/org/apache/jasper/servlet/JspServlet.java +++ b/java/org/apache/jasper/servlet/JspServlet.java @@ -25,6 +25,7 @@ import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -292,7 +293,8 @@ public class JspServlet extends HttpServlet implements PeriodicEventListener { * Check to see if the requested JSP has been the target of a * RequestDispatcher.include() */ - jspUri = (String) request.getAttribute(Constants.INC_SERVLET_PATH); + jspUri = (String) request.getAttribute( + RequestDispatcher.INCLUDE_SERVLET_PATH); if (jspUri != null) { /* * Requested JSP has been target of @@ -300,7 +302,7 @@ public class JspServlet extends HttpServlet implements PeriodicEventListener { * relevant javax.servlet.include.* request attributes */ String pathInfo = (String) request.getAttribute( - "javax.servlet.include.path_info"); + RequestDispatcher.INCLUDE_PATH_INFO); if (pathInfo != null) { jspUri += pathInfo; } @@ -399,7 +401,7 @@ public class JspServlet extends HttpServlet implements PeriodicEventListener { throws ServletException, IOException { String includeRequestUri = - (String)request.getAttribute("javax.servlet.include.request_uri"); + (String)request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI); if (includeRequestUri != null) { // This file was included. Throw an exception as diff --git a/java/org/apache/jasper/servlet/JspServletWrapper.java b/java/org/apache/jasper/servlet/JspServletWrapper.java index 66738a2ea..f69221c95 100644 --- a/java/org/apache/jasper/servlet/JspServletWrapper.java +++ b/java/org/apache/jasper/servlet/JspServletWrapper.java @@ -20,6 +20,7 @@ package org.apache.jasper.servlet; import java.io.FileNotFoundException; import java.io.IOException; +import javax.servlet.RequestDispatcher; import javax.servlet.Servlet; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; @@ -417,7 +418,7 @@ public class JspServletWrapper { } } catch (UnavailableException ex) { String includeRequestUri = (String) - request.getAttribute("javax.servlet.include.request_uri"); + request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI); if (includeRequestUri != null) { // This file was included. Throw an exception as // a response.sendError() will be ignored by the diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java index e1c48b3e6..ada095122 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -49,33 +49,6 @@ public abstract class AbstractEndpoint { // -------------------------------------------------------------- Constants protected static final StringManager sm = StringManager.getManager("org.apache.tomcat.util.net.res"); - /** - * The Request attribute key for the cipher suite. - */ - public static final String CIPHER_SUITE_KEY = "javax.servlet.request.cipher_suite"; - - /** - * The Request attribute key for the key size. - */ - public static final String KEY_SIZE_KEY = "javax.servlet.request.key_size"; - - /** - * The Request attribute key for the client certificate chain. - */ - public static final String CERTIFICATE_KEY = "javax.servlet.request.X509Certificate"; - - /** - * The Request attribute key for the session id. - * This one is a Tomcat extension to the Servlet spec. - */ - public static final String SESSION_ID_KEY = "javax.servlet.request.ssl_session"; - - /** - * The request attribute key for the session manager. - * This one is a Tomcat extension to the Servlet spec. - */ - public static final String SESSION_MGR = "javax.servlet.request.ssl_session_mgr"; - public static interface Handler { /** * Different types of socket states to react upon. diff --git a/java/org/apache/tomcat/util/net/SSLSupport.java b/java/org/apache/tomcat/util/net/SSLSupport.java index f1437e0d0..6a679dfc1 100644 --- a/java/org/apache/tomcat/util/net/SSLSupport.java +++ b/java/org/apache/tomcat/util/net/SSLSupport.java @@ -30,7 +30,8 @@ public interface SSLSupport { /** * The Request attribute key for the cipher suite. */ - public static final String CIPHER_SUITE_KEY = "javax.servlet.request.cipher_suite"; + public static final String CIPHER_SUITE_KEY = + "javax.servlet.request.cipher_suite"; /** * The Request attribute key for the key size. @@ -40,20 +41,22 @@ public interface SSLSupport { /** * The Request attribute key for the client certificate chain. */ - public static final String CERTIFICATE_KEY = "javax.servlet.request.X509Certificate"; + public static final String CERTIFICATE_KEY = + "javax.servlet.request.X509Certificate"; /** * The Request attribute key for the session id. * This one is a Tomcat extension to the Servlet spec. */ - public static final String SESSION_ID_KEY = "javax.servlet.request.ssl_session"; + public static final String SESSION_ID_KEY = + "javax.servlet.request.ssl_session"; /** * The request attribute key for the session manager. * This one is a Tomcat extension to the Servlet spec. */ public static final String SESSION_MGR = - "javax.servlet.request.ssl_session_mgr"; + "javax.servlet.request.ssl_session_mgr"; /**