amyroh 2002/09/11 17:09:28
Modified: catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
ApplicationFilterFactory.java
StandardWrapperValve.java
catalina/src/share/org/apache/catalina/deploy FilterMap.java
catalina/src/share/org/apache/catalina/valves
ErrorDispatcherValve.java
Log:
Fix RequestDispatcher for ERROR and INCLUDE - bugzilla bugs 12456 and 12457.
Patch submitted by Greg Murray <[EMAIL PROTECTED]>.
Revision Changes Path
1.4 +60 -36
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
Index: ApplicationDispatcher.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ApplicationDispatcher.java 23 Aug 2002 23:01:05 -0000 1.3
+++ ApplicationDispatcher.java 12 Sep 2002 00:09:27 -0000 1.4
@@ -360,7 +360,6 @@
private void doForward(ServletRequest request, ServletResponse response)
throws ServletException, IOException
{
-
// Reset any output that has been buffered, but keep headers/cookies
if (response.isCommitted()) {
if (debug >= 1)
@@ -392,8 +391,18 @@
if (debug >= 1)
log(" Non-HTTP Forward");
- invoke(request, response, ApplicationFilterFactory.FORWARD);
-
+ // only set the Dispatcher Type to Forward if it has not been set. It
will have
+ // been set by the ErrorDispatcherValue in the case of an ERROR
+ // it will be REQUEST coming in from the StandardWrapperValue and
+ // ERROR coming from the ErrorDispatcherValue
+ if (request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR)
!= null){
+ Integer disInt =
(Integer)request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR);
+ if (disInt.intValue() != ApplicationFilterFactory.ERROR) {
+
request.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
servletPath);
+
request.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR, new
Integer(ApplicationFilterFactory.FORWARD));
+ }
+ }
+ invoke(request, response);
}
// Handle an HTTP named dispatcher forward
@@ -401,7 +410,18 @@
if (debug >= 1)
log(" Named Dispatcher Forward");
- invoke(request, response, ApplicationFilterFactory.FORWARD);
+ // only set the Dispatcher Type to Forward if it has not been set. It
will have
+ // been set by the ErrorDispatcherValue in the case of an ERROR
+ // it will be REQUEST coming in from the StandardWrapperValue and
+ // ERROR coming from the ErrorDispatcherValue
+ if (request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR)
!= null){
+ Integer disInt =
(Integer)request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR);
+ if (disInt.intValue() != ApplicationFilterFactory.ERROR) {
+
request.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
servletPath);
+
request.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR, new
Integer(ApplicationFilterFactory.FORWARD));
+ }
+ }
+ invoke(request, response);
}
@@ -429,7 +449,19 @@
wrequest.setQueryString(queryString);
wrequest.mergeParameters(queryString);
}
- invoke(outerRequest, response, ApplicationFilterFactory.FORWARD);
+
+ // only set the Dispatcher Type to Forward if it has not been set. It
will have
+ // been set by the ErrorDispatcherValue in the case of an ERROR
+ // it will be REQUEST coming in from the StandardWrapperValue and
+ // ERROR coming from the ErrorDispatcherValue
+ if
(wrequest.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR) != null){
+ Integer disInt =
(Integer)request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR);
+ if (disInt.intValue() != ApplicationFilterFactory.ERROR) {
+
wrequest.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
servletPath);
+
wrequest.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR, new
Integer(ApplicationFilterFactory.FORWARD));
+ }
+ }
+ invoke(outerRequest, response);
unwrapRequest();
}
@@ -516,7 +548,10 @@
if (debug >= 1)
log(" Non-HTTP Include");
- invoke(request, outerResponse, ApplicationFilterFactory.INCLUDE);
+ request.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
+ new
Integer(ApplicationFilterFactory.INCLUDE));
+
request.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
servletPath);
+ invoke(request, outerResponse);
unwrapResponse();
}
@@ -532,7 +567,10 @@
wrequest.setAttribute(Globals.NAMED_DISPATCHER_ATTR, name);
if (servletPath != null)
wrequest.setServletPath(servletPath);
- invoke(outerRequest, outerResponse, ApplicationFilterFactory.INCLUDE);
+ wrequest.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
+ new
Integer(ApplicationFilterFactory.INCLUDE));
+
wrequest.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
servletPath);
+ invoke(outerRequest, outerResponse);
unwrapRequest();
unwrapResponse();
@@ -571,8 +609,11 @@
queryString);
wrequest.mergeParameters(queryString);
}
- // invoke(wrequest, wresponse);
- invoke(outerRequest, outerResponse, ApplicationFilterFactory.INCLUDE);
+
+ wrequest.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
+ new
Integer(ApplicationFilterFactory.INCLUDE));
+
wrequest.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
servletPath);
+ invoke(outerRequest, outerResponse);
unwrapRequest();
unwrapResponse();
@@ -599,8 +640,8 @@
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet error occurs
*/
- private void invoke(ServletRequest request, ServletResponse response,
- int dispatcherMapping) throws IOException, ServletException {
+ private void invoke(ServletRequest request, ServletResponse response)
+ throws IOException, ServletException {
// Checking to see if the context classloader is the current context
// classloader. If it's not, we're saving it, and setting the context
@@ -669,9 +710,9 @@
}
// Get the FilterChain Here
ApplicationFilterFactory factory = ApplicationFilterFactory.getInstance();
- ApplicationFilterChain filterChain = factory.createFilterChain(request,
wrapper, servlet, dispatcherMapping);
-
-
+ ApplicationFilterChain filterChain = factory.createFilterChain(request,
+
wrapper,
+
servlet);
// Call the service() method for the allocated servlet instance
try {
String jspFile = wrapper.getJspFile();
@@ -681,24 +722,11 @@
request.removeAttribute(Globals.JSP_FILE_ATTR);
support.fireInstanceEvent(InstanceEvent.BEFORE_DISPATCH_EVENT,
servlet, request, response);
- // Added by Greg Murray for filter chaining
// for includes/forwards
if ((servlet != null) && (filterChain != null)) {
filterChain.doFilter(request, response);
}
- // Greg Murray additions complete
- /* Servlet Service Method is called by the FilterChain
-
- if (servlet != null) {
- // if (debug >= 2)
- // log(" Calling service(), jspFile=" +
jspFile);
- if ((hrequest != null) && (hresponse != null)) {
- servlet.service((HttpServletRequest) request,
- (HttpServletResponse) response);
- } else {
- servlet.service(request, response);
- }
- }*/
+ // Servlet Service Method is called by the FilterChain
request.removeAttribute(Globals.JSP_FILE_ATTR);
support.fireInstanceEvent(InstanceEvent.AFTER_DISPATCH_EVENT,
servlet, request, response);
@@ -733,7 +761,6 @@
runtimeException = e;
}
- // Addtions by Greg Murray for Filter Chaining
// Release the filter chain (if any) for this request
try {
if (filterChain != null)
@@ -743,13 +770,10 @@
wrapper.getName()), e);
//FIXME Exception handling needs to be simpiler to what is in the
StandardWrapperValue
}
- // End Greg Murray additions
// Deallocate the allocated servlet instance
try {
if (servlet != null) {
- // if (debug >= 2)
- // log(" Deallocating servlet instance");
wrapper.deallocate(servlet);
}
} catch (ServletException e) {
1.3 +49 -52
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationFilterFactory.java
Index: ApplicationFilterFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationFilterFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ApplicationFilterFactory.java 23 Aug 2002 23:01:05 -0000 1.2
+++ ApplicationFilterFactory.java 12 Sep 2002 00:09:27 -0000 1.3
@@ -90,9 +90,13 @@
public final class ApplicationFilterFactory {
- public static final int FORWARD =1;
- public static final int INCLUDE =3;
- public static final int REQUEST = 4;
+ public static final int ERROR = 1;
+ public static final int FORWARD =2;
+ public static final int INCLUDE =4;
+ public static final int REQUEST = 8;
+
+ public static final String
DISPATCHER_TYPE_ATTR="org.apache.catalina.core.DISPATCHER_TYPE";
+ public static final String
DISPATCHER_REQUEST_PATH_ATTR="org.apache.catalina.core.DISPATCHER_REQUEST_PATH";
// ----------------------------------------------------------- Constructors
@@ -122,8 +126,15 @@
* @param servlet The servlet instance to be wrapped
*/
public ApplicationFilterChain createFilterChain(ServletRequest request,
- Wrapper wrapper, Servlet servlet, int
dispatcher) {
+ Wrapper wrapper, Servlet servlet) {
+ // get the dispatcher type
+ int dispatcher = -1;
+ if (request.getAttribute(DISPATCHER_TYPE_ATTR) != null) {
+ Integer dispatcherInt =
(Integer)request.getAttribute(DISPATCHER_TYPE_ATTR);
+ dispatcher = dispatcherInt.intValue();
+ }
+ String requestPath =
(String)request.getAttribute(DISPATCHER_REQUEST_PATH_ATTR);
HttpServletRequest hreq = null;
if (request instanceof HttpServletRequest) hreq =
(HttpServletRequest)request;
// If there is no servlet to execute, return null
@@ -144,77 +155,42 @@
// If there are no filter mappings, we are done
if ((filterMaps == null) || (filterMaps.length == 0))
return (filterChain);
-// if (debug >= 1)
-// log("createFilterChain: Processing " + filterMaps.length +
-// " filter map entries");
// Acquire the information we will need to match filter mappings
- String requestPath = null;
- if (hreq != null) {
- String contextPath = hreq.getContextPath();
- if (contextPath == null)
- contextPath = "";
- String requestURI = hreq.getRequestURI();
- //((HttpRequest) request).getDecodedRequestURI();
- if (requestURI.length() >= contextPath.length())
- requestPath = requestURI.substring(contextPath.length());
- }
String servletName = wrapper.getName();
-// if (debug >= 1) {
-// log(" requestPath=" + requestPath);
-// log(" servletName=" + servletName);
-// }
+
int n = 0;
// Add the relevant path-mapped filters to this filter chain
for (int i = 0; i < filterMaps.length; i++) {
-// if (debug >= 2)
-// log(" Checking path-mapped filter '" +
-// filterMaps[i] + "'");
+
if (!matchFiltersURL(filterMaps[i], requestPath, dispatcher))
continue;
ApplicationFilterConfig filterConfig = (ApplicationFilterConfig)
context.findFilterConfig(filterMaps[i].getFilterName());
if (filterConfig == null) {
-// if (debug >= 2)
-// log(" Missing path-mapped filter '" +
-// filterMaps[i] + "'");
; // FIXME - log configuration problem
continue;
}
-// if (debug >= 2)
-// log(" Adding path-mapped filter '" +
-// filterConfig.getFilterName() + "'");
filterChain.addFilter(filterConfig);
n++;
}
// Add filters that match on servlet name second
for (int i = 0; i < filterMaps.length; i++) {
-// if (debug >= 2)
-// log(" Checking servlet-mapped filter '" +
-// filterMaps[i] + "'");
if (!matchFiltersServlet(filterMaps[i], servletName, dispatcher))
continue;
ApplicationFilterConfig filterConfig = (ApplicationFilterConfig)
context.findFilterConfig(filterMaps[i].getFilterName());
if (filterConfig == null) {
-// if (debug >= 2)
-// log(" Missing servlet-mapped filter '" +
-// filterMaps[i] + "'");
; // FIXME - log configuration problem
continue;
}
-// if (debug >= 2)
-// log(" Adding servlet-mapped filter '" +
-// filterMaps[i] + "'");
filterChain.addFilter(filterConfig);
n++;
}
// Return the completed filter chain
-// if (debug >= 2)
-// log(" Returning chain with " + n + " filters");
return (filterChain);
}
@@ -231,10 +207,6 @@
String requestPath,
int dispatcher) {
-// if (debug >= 3)
-// log(" Matching request path '" + requestPath +
-// "' against mapping " + filterMap);
-
if (requestPath == null)
return (false);
@@ -286,8 +258,12 @@
switch (dispatcher) {
case FORWARD : {
if (filterMap.getDispatcherMapping() == FilterMap.FORWARD ||
- filterMap.getDispatcherMapping() == FilterMap.FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() == FilterMap.FORWARD_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.INCLUDE_FORWARD ||
+ filterMap.getDispatcherMapping() ==
FilterMap.INCLUDE_ERROR_FORWARD ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_FORWARD_INCLUDE) {
return true;
}
@@ -295,8 +271,12 @@
}
case INCLUDE : {
if (filterMap.getDispatcherMapping() == FilterMap.INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.FORWARD_INCLUDE ||
- filterMap.getDispatcherMapping() == FilterMap.REQUEST_INCLUDE||
+ filterMap.getDispatcherMapping() == FilterMap.INCLUDE_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.INCLUDE_FORWARD ||
+ filterMap.getDispatcherMapping() ==
FilterMap.INCLUDE_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.REQUEST_INCLUDE ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_INCLUDE ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_FORWARD_INCLUDE) {
return true;
}
@@ -304,9 +284,26 @@
}
case REQUEST : {
if (filterMap.getDispatcherMapping() == FilterMap.REQUEST ||
+ filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_INCLUDE ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_INCLUDE ||
filterMap.getDispatcherMapping() == FilterMap.REQUEST_FORWARD ||
- filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_FORWARD_INCLUDE) {
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_FORWARD_INCLUDE) {
+ return true;
+ }
+ break;
+ }
+ case ERROR : {
+ if (filterMap.getDispatcherMapping() == FilterMap.ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.FORWARD_ERROR ||
+ filterMap.getDispatcherMapping() == FilterMap.INCLUDE_ERROR ||
+ filterMap.getDispatcherMapping() ==
FilterMap.INCLUDE_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() == FilterMap.REQUEST_ERROR ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_FORWARD ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_FORWARD_INCLUDE ||
+ filterMap.getDispatcherMapping() ==
FilterMap.REQUEST_ERROR_INCLUDE) {
return true;
}
break;
1.4 +17 -6
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
Index: StandardWrapperValve.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StandardWrapperValve.java 23 Aug 2002 23:01:05 -0000 1.3
+++ StandardWrapperValve.java 12 Sep 2002 00:09:27 -0000 1.4
@@ -243,10 +243,21 @@
exception(request, response, e);
servlet = null;
}
-
+ String requestPath = null;
+ if (hreq != null) {
+ String contextPath = hreq.getContextPath();
+ if (contextPath == null)
+ contextPath = "";
+ String requestURI = hreq.getRequestURI();
+ if (requestURI.length() >= contextPath.length())
+ requestPath = requestURI.substring(contextPath.length());
+ }
+ sreq.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
+ new
Integer(ApplicationFilterFactory.REQUEST));
+ sreq.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
requestPath);
// Create the filter chain for this request
ApplicationFilterFactory factory = ApplicationFilterFactory.getInstance();
- ApplicationFilterChain filterChain = factory.createFilterChain(sreq,
wrapper, servlet, ApplicationFilterFactory.REQUEST);
+ ApplicationFilterChain filterChain = factory.createFilterChain(sreq,
wrapper, servlet);
// Call the filter chain for this request
// NOTE: This also calls the servlet's service() method
1.3 +66 -28
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/deploy/FilterMap.java
Index: FilterMap.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/deploy/FilterMap.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FilterMap.java 22 Aug 2002 22:05:51 -0000 1.2
+++ FilterMap.java 12 Sep 2002 00:09:28 -0000 1.3
@@ -83,27 +83,35 @@
// ------------------------------------------------------------- Properties
- //added by Greg Murray
-
- public static final int FORWARD =1;
- public static final int FORWARD_INCLUDE =2;
- public static final int INCLUDE =3;
- public static final int REQUEST = 4;
- public static final int REQUEST_FORWARD =5;
- public static final int REQUEST_INCLUDE =6;
- public static final int REQUEST_FORWARD_INCLUDE =7;
-
- // represents nothing having been set. This will be seen
- // as equal to a REQUEST
- private static final int NOT_SET = -1;
-
- private int dispatcherMapping=NOT_SET;
/**
* The name of this filter to be executed when this mapping matches
* a particular request.
*/
- private String filterName = null;
+
+ public static final int ERROR = 1;
+ public static final int FORWARD = 2;
+ public static final int FORWARD_ERROR =3;
+ public static final int INCLUDE = 4;
+ public static final int INCLUDE_ERROR = 5;
+ public static final int INCLUDE_ERROR_FORWARD =6;
+ public static final int INCLUDE_FORWARD = 7;
+ public static final int REQUEST = 8;
+ public static final int REQUEST_ERROR = 9;
+ public static final int REQUEST_ERROR_FORWARD = 10;
+ public static final int REQUEST_ERROR_FORWARD_INCLUDE = 11;
+ public static final int REQUEST_ERROR_INCLUDE = 12;
+ public static final int REQUEST_FORWARD = 13;
+ public static final int REQUEST_INCLUDE = 14;
+ public static final int REQUEST_FORWARD_INCLUDE= 15;
+
+ // represents nothing having been set. This will be seen
+ // as equal to a REQUEST
+ private static final int NOT_SET = -1;
+
+ private int dispatcherMapping=NOT_SET;
+
+ private String filterName = null;
public String getFilterName() {
return (this.filterName);
@@ -140,59 +148,89 @@
public void setURLPattern(String urlPattern) {
this.urlPattern = RequestUtil.URLDecode(urlPattern);
}
-
+
/**
- * Added by Greg Murray
*
* This method will be used to set the current state of the FilterMap
* representing the state of when filters should be applied:
*
+ * ERROR
* FORWARD
- * FORWARD_INCLUDE
+ * FORWARD_ERROR
* INCLUDE
+ * INCLUDE_ERROR
+ * INCLUDE_ERROR_FORWARD
* REQUEST
- * REQUEST_INCLUDE,
+ * REQUEST_ERROR
+ * REQUEST_ERROR_INCLUDE
+ * REQUEST_ERROR_FORWARD_INCLUDE
+ * REQUEST_INCLUDE
* REQUEST_FORWARD,
* REQUEST_FORWARD_INCLUDE
*
*/
public void setDispatcher(String dispatcherString) {
String dispatcher = dispatcherString.toUpperCase();
-
+
if (dispatcher.equals("FORWARD")) {
// apply FORWARD to the global dispatcherMapping.
switch (dispatcherMapping) {
- case INCLUDE : dispatcherMapping = FORWARD_INCLUDE; break;
case NOT_SET : dispatcherMapping = FORWARD; break;
+ case ERROR : dispatcherMapping = FORWARD_ERROR;
+ case INCLUDE : dispatcherMapping = INCLUDE_FORWARD; break;
+ case INCLUDE_ERROR : dispatcherMapping = INCLUDE_ERROR_FORWARD;
break;
case REQUEST : dispatcherMapping = REQUEST_FORWARD; break;
+ case REQUEST_ERROR : dispatcherMapping = REQUEST_ERROR_FORWARD;
break;
+ case REQUEST_ERROR_INCLUDE : dispatcherMapping =
REQUEST_ERROR_FORWARD_INCLUDE; break;
case REQUEST_INCLUDE : dispatcherMapping = REQUEST_FORWARD_INCLUDE;
break;
}
} else if (dispatcher.equals("INCLUDE")) {
// apply INCLUDE to the global dispatcherMapping.
switch (dispatcherMapping) {
- case FORWARD : dispatcherMapping = FORWARD_INCLUDE; break;
case NOT_SET : dispatcherMapping = INCLUDE; break;
+ case ERROR : dispatcherMapping = INCLUDE_ERROR;
+ case FORWARD : dispatcherMapping = INCLUDE_FORWARD; break;
+ case FORWARD_ERROR : dispatcherMapping = INCLUDE_ERROR_FORWARD;
break;
case REQUEST : dispatcherMapping = REQUEST_INCLUDE; break;
+ case REQUEST_ERROR : dispatcherMapping = REQUEST_ERROR_INCLUDE;
break;
+ case REQUEST_ERROR_FORWARD : dispatcherMapping =
REQUEST_ERROR_FORWARD_INCLUDE; break;
case REQUEST_FORWARD : dispatcherMapping = REQUEST_FORWARD_INCLUDE;
break;
}
} else if (dispatcher.equals("REQUEST")) {
// apply REQUEST to the global dispatcherMapping.
switch (dispatcherMapping) {
+ case NOT_SET : dispatcherMapping = REQUEST; break;
+ case ERROR : dispatcherMapping = REQUEST_ERROR;
case FORWARD : dispatcherMapping = REQUEST_FORWARD; break;
+ case FORWARD_ERROR : dispatcherMapping = REQUEST_ERROR_FORWARD;
break;
case INCLUDE : dispatcherMapping = REQUEST_INCLUDE; break;
- case NOT_SET : dispatcherMapping = REQUEST; break;
- case FORWARD_INCLUDE : dispatcherMapping = REQUEST_FORWARD_INCLUDE;
break;
+ case INCLUDE_ERROR : dispatcherMapping = REQUEST_ERROR_INCLUDE;
break;
+ case INCLUDE_FORWARD : dispatcherMapping = REQUEST_FORWARD_INCLUDE;
break;
+ case INCLUDE_ERROR_FORWARD : dispatcherMapping =
REQUEST_ERROR_FORWARD_INCLUDE; break;
+ }
+ } else if (dispatcher.equals("ERROR")) {
+ // apply ERROR to the global dispatcherMapping.
+ switch (dispatcherMapping) {
+ case NOT_SET : dispatcherMapping = ERROR; break;
+ case FORWARD : dispatcherMapping = FORWARD_ERROR; break;
+ case INCLUDE : dispatcherMapping = INCLUDE_ERROR; break;
+ case INCLUDE_FORWARD : dispatcherMapping = INCLUDE_ERROR_FORWARD;
break;
+ case REQUEST : dispatcherMapping = REQUEST_ERROR;
+ case REQUEST_INCLUDE : dispatcherMapping = REQUEST_ERROR_INCLUDE;
+ case REQUEST_FORWARD : dispatcherMapping = REQUEST_ERROR_FORWARD;
+ case REQUEST_FORWARD_INCLUDE : dispatcherMapping =
REQUEST_ERROR_FORWARD_INCLUDE;
}
}
}
-
+
public int getDispatcherMapping() {
// per the SRV.6.2.5 absence of any dispatcher elements is
// equivelant to a REQUEST value
if (dispatcherMapping == NOT_SET) return REQUEST;
- else return dispatcherMapping;
+ else return dispatcherMapping;
}
+
// --------------------------------------------------------- Public Methods
1.3 +9 -5
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorDispatcherValve.java
Index: ErrorDispatcherValve.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorDispatcherValve.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ErrorDispatcherValve.java 15 Aug 2002 19:11:31 -0000 1.2
+++ ErrorDispatcherValve.java 12 Sep 2002 00:09:28 -0000 1.3
@@ -91,7 +91,7 @@
import org.apache.catalina.deploy.ErrorPage;
import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.StringManager;
-
+import org.apache.catalina.core.ApplicationFilterFactory;
/**
* <p>Implementation of a Valve that handles the error dispatch (that is, will
@@ -231,6 +231,10 @@
response.setAppCommitted(false);
ServletRequest sreq = request.getRequest();
ServletResponse sresp = response.getResponse();
+ sreq.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
+ errorPage.getLocation());
+ sreq.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
+ new
Integer(ApplicationFilterFactory.ERROR));
sreq.setAttribute
(Globals.STATUS_CODE_ATTR,
new Integer(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>