hi!
so your solution would be very portable because every container must support
that!?
-mw
----- Original Message -----
From: "Stefan AUFISCHER" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 24, 2002 1:42 PM
Subject: Antwort: Re: Access error pages defined in web.xml from a Servlet
> I think the "most portable" solution is to fetch web.xml as stream, so the
> Container will decide where to get it from:
>
> InputStream webXml = servletContext.getResourceAsStream
> ("WEB-INF/web.xml");
>
> Greetings
>
> -Stefan
>
> --
> Stefan Aufischer
> mailto:[EMAIL PROTECTED]
> http://www.grz.at
>
> Christopher K. St. John wrote:
>
> > Hi Christopher,
> >
> > I've already implemented a WebXmlReader which provides information
> > about the whole web.xml file. But--as you say--this is quite ugly
because
> > it
> > might not be portable.
> >
> > The solution to require additional context-params in web.xml is not
> > satisfactory. One would have to maintain two sets of error-page
> > definitions in web.xml because in some cases the standard error-page
> > behavior is required...
> >
> > Thanks again
> >
> > -Stefan
> >
> > Christopher K. St. John wrote:
> >
> > >
> > > Stefan AUFISCHER wrote:
> > > >
> > > > In my Servlet I need to decide (based on the type of exception that
> > > > occured) whether I will forward to an error page defined in web.xml
> > > > or to an error page that is provided by the servlet itself.
> > > >
> > > > Is there any standard way to access the error pages defined in
> web.xml?
> > > >
> > >
> > > Probably not in the way you mean. There's no javax.servlet* API that
> > > gives you the information directly.
> > >
> > > You could open up web.xml yourself (your servlet has access to it
> > > through ServletContext.getResource*) and parse the XML, looking for
> > > <error-page> elements. That should probably be portable, but it's
> > > kind of ugly.
> > >
> > > Easier would be to require that whoever sets up web.xml also set
> > > up some <context-param>s that tell which error-pages are declared.
> > >
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html