This is the way it is supposed to work. The filters are only processed on the original request, not for errors,forward or include.
Charlie > -----Original Message----- > From: Nathan Vick [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, May 14, 2002 7:13 PM > To: [EMAIL PROTECTED] > Subject: How do filters work with error-page and RequestDispatcher? > > > I am programming a web application with filters that run XSLT's (using > Xalan) against the XML written out by servlets. I have also > created servlets > to serve as error pages by writing out error messages as XML > documents, > which then get transformed into user-friendly HTML by filters > that use XSLT. > I map these error servlets to a path, and associate certain > exceptions with > those paths. > > Unfortunately for me, the filters are not used when the error > servlets get > called. If I request the path to the error servlets directly > from a browser, > then the filters are used. However, when a servlet throws an > exception that > is mapped to a path that happens to be filtered, the filters > are not used. > (If the path is mapped to a servlet, then the servlet is > called, but any > filters mapped to that path are ignored). > > If an error-page is mapped to a location that happens to be > mapped to 1+ > filters and 0 or 1 servlets, are the filter-mapping elements > really meant to > be ignored while the servlet-mapping elements are respected? > > Does the RequestDispatcher work the same way (ignoring filter-mapping > elements and respecting servlet-mapping elements)? > > I have tried to make sense of the Servlet 2.3 spec, but I can > not find a > place where it describes how filters work with error-page elements and > RequestDispatcher objects. > > Here is a selection from my web.xml file: > > <filter> > <filter-name>DirectoryTemplates</filter-name> > <description> > Applies the specified XSLT. > </description> > > <filter-class>ca.capilanocollege.servlet.xml.TemplatesFilter</ > filter-class> > <init-param> > <param-name>templatesUrl</param-name> > <param-value>/directory/directory.xsl</param-value> > </init-param> > </filter> > > <filter> > <filter-name>DirectoryExceptionTemplates</filter-name> > <description> > Applies the specified XSLT. > </description> > > <filter-class>ca.capilanocollege.servlet.xml.TemplatesFilter</ > filter-class> > <init-param> > <param-name>templatesUrl</param-name> > <param-value>/directory/directory-exception.xsl</param-value> > </init-param> > </filter> > > <filter-mapping> > <filter-name>DirectoryTemplates</filter-name> > <servlet-name>Directory</servlet-name> > </filter-mapping> > > <filter-mapping> > <filter-name>DirectoryExceptionTemplates</filter-name> > <servlet-name>DirectoryException</servlet-name> > </filter-mapping> > > <servlet> > <servlet-name>Directory</servlet-name> > <description> > Searches all employees and administrators working at > Capilano College. > </description> > > <servlet-class>ca.capilanocollege.names.servlets.Directory</se > rvlet-class> > <load-on-startup/> > </servlet> > > <servlet> > <servlet-name>DirectoryException</servlet-name> > > <servlet-class>ca.capilanocollege.servlet.xml.ExceptionToXmlSe > rvlet</servlet > -class> > <load-on-startup/> > </servlet> > > <servlet-mapping> > <servlet-name>Directory</servlet-name> > <url-pattern>/directory/directory.serv</url-pattern> > </servlet-mapping> > > <servlet-mapping> > <servlet-name>DirectoryException</servlet-name> > <url-pattern>/directory/directory-exception.serv</url-pattern> > </servlet-mapping> > > <error-page> > > <exception-type>ca.capilanocollege.names.exceptions.DirectoryE > xception</exce > ption-type> > <location>/directory/directory-exception.serv</location> > </error-page> > > > Thank you so much, > Nathan > > ~~> > Nathan Vick > Programmer/Analyst > Capilano College > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
