You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Prashanth Pushpagiri <pr...@yahoo.com> on 2002/06/26 07:13:57 UTC

Can a URI pattern be matched to a JSP?

Hello everyone:
I am using Tomcat 4.0.4 on IIS. I would like to know
if there is a way of forwarding requests of a
particular pattern to a JSP i specify using Tomcat?

For eg. say the user requests for a file like
/examples/dln/sample.doc I want tomcat to forward the
request to a JSP /examples/index.jsp instead of
serving the file out. I guess this is similar to what
servlet mapping is! A particular URI pattern
'/examples/dln' should be forwarded to a particular
JSP '/examples/index.jsp'.

Any advice and assistance on this would be very
helpful.

Thanks
Prashanth

PS: It's nice to be back in the list!

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Re[2]: Can a URI pattern be matched to a JSP?

Posted by Prashanth Pushpagiri <pr...@yahoo.com>.
Duh! figured it out.....I copied the web.xml file from
/conf into my web application's WEB-INF folder. Since
this contained a default mapping, there was a
duplicate..... I created a new web.xml file for my
application and it works now!!

Thank guys
Prashanth

--- Eric Everman <ev...@precedadesign.com> wrote:
> Also, is it possible that there is another servlet
> named 
> 'default'?  Actually, did you say this was *your*
> web.xml file - not the 
> default one located in the root/config directory?
> 
> If this xml snippet is from
> root/webapps/<yourapp>/WEB-INF/web.xml file, it 
> will be additive to the root/config/web.xml file
> which contains the default 
> servlet declaration unless you have modified this
> file.  In other words, 
> everything in your root web.xml file is already
> included, you don't need to 
> "re-included" it in your application's web.xml file.
> 
> Does that help?
> 
> Eric Everman
> 
> At 01:36 PM 6/26/2002, you wrote:
> >Hello Prashanth,
> >
> >are all your <servlet> entries *after*
> <context-inint> entries and
> >*before* <servlet-mapping> entries?
> >
> >Take a look in the dtd and double check that you
> have everything in
> >the proper order.
> >
> >Jake
> >
> >Wednesday, June 26, 2002, 1:08:45 PM, you wrote:
> >
> >PP> Hi:
> >
> >PP> When I startup tomcat I still get the following
> error:
> >
> >PP> ERROR reading
> java.io.ByteArrayInputStream@d2fc36
> >PP> At Line 63 /web-app/servlet/
> >
> >PP> Inside my web.xml file I found the following:
> >
> >PP>   <servlet>
> >PP>     <servlet-name>default</servlet-name>
> >
> >PP>
>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
> >PP>     <init-param>
> >PP>       <param-name>debug</param-name>
> >PP>       <param-value>0</param-value>
> >PP>     </init-param>
> >PP>     <init-param>
> >PP>       <param-name>listings</param-name>
> >PP>       <param-value>true</param-value>
> >PP>     </init-param>
> >PP>     <load-on-startup>1</load-on-startup>
> >PP>   </servlet>
> >
> >PP> the </servlet> tag is line 63. I placed the
> servlet
> >PP> tag above and below the default servlet....does
> not
> >PP> help! Could there be a conflict? What more
> information
> >PP> can I provide to debug the situation? This is
> one
> >PP> entry I found in localhost.log
> >
> >PP> 2002-06-26 14:11:15 WebappLoader[/manager]:
> Deploying
> >PP> class repositories to work directory
> >PP>
> C:\tomcat4.0.4\work\Standalone\localhost\manager
> >PP> 2002-06-26 14:11:15 StandardManager[/manager]:
> Seeding
> >PP> random number generator class
> >PP> java.security.SecureRandom
> >PP> 2002-06-26 14:11:15 StandardManager[/manager]:
> Seeding
> >PP> of random number generator has been completed
> >PP> 2002-06-26 14:11:16 ContextConfig[/manager]:
> Added
> >certificates ->> request attribute Valve
> >PP> 2002-06-26 14:11:16 ContextConfig[/manager]:
> >PP> Configured an authenticator for method BASIC
> >PP> 2002-06-26 14:11:16
> StandardWrapper[/manager:default]:
> >PP> Loading container servlet default
> >PP> 2002-06-26 14:11:16 default: init
> >PP> 2002-06-26 14:11:16
> StandardWrapper[/manager:invoker]:
> >PP> Loading container servlet invoker
> >PP> 2002-06-26 14:11:16 invoker: init
> >PP> 2002-06-26 14:11:16 jsp: init
> >PP> 2002-06-26 14:11:16 WebappLoader[]: Deploying
> class
> >PP> repositories to work directory
> >PP> C:\tomcat4.0.4\work\Standalone\localhost\_
> >PP> 2002-06-26 14:11:16 WebappLoader[]: Reloading
> checks
> >PP> are enabled for this Context
> >PP> 2002-06-26 14:11:16 StandardManager[]: Seeding
> random
> >PP> number generator class
> java.security.SecureRandom
> >PP> 2002-06-26 14:11:16 StandardManager[]: Seeding
> of
> >PP> random number generator has been completed
> >PP> 2002-06-26 14:11:16 ContextConfig[]
> Configuration
> >PP> error in application web.xml
> >PP> java.lang.IllegalArgumentException: addChild: 
> Child
> >PP> name 'default' is not unique
> >PP>         at
> >PP>
>
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
> >PP>         at
> >PP> 
>
>org.apache.catalina.core.StandardContext.addChild(StandardContext.java:1280)
> >PP>         at
> >PP>
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >PP> Method)
> >PP>         at
> >PP> 
>
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >PP>         at
> >PP> 
>
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >PP>         at
> java.lang.reflect.Method.invoke(Method.java:324)
> >PP>         at
> >PP>
>
org.apache.catalina.util.xml.AddChild.end(XmlMapper.java:811)
> >PP>         at
> >PP>
>
org.apache.catalina.util.xml.XmlMapper.matchEnd(XmlMapper.java:419)
> >PP>         at
> >PP>
>
org.apache.catalina.util.xml.XmlMapper.endElement(XmlMapper.java:119)
> >PP>         at
> >PP>
>
org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAdapter.java:347)
> >PP>         at
> >PP>
>
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
> >PP>         at
> >PP> 
>
>org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
> >PP>         at
> >PP> 
>
>org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
> >PP>         at
> >PP> 
>
>org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
> >PP>         at
> >PP>
>
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
> >PP>         at
> >PP>
>
org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
> >PP>         at
> >PP>
>
javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
> >PP>         at
> >PP>
> javax.xml.parsers.SAXParser.parse(SAXParser.java:89)
> >PP>         at
> >PP>
>
org.apache.catalina.util.xml.XmlMapper.readXml(XmlMapper.java:275)
> >PP>         at
> >PP> 
>
>org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:256)
> >PP>         at
> >PP>
>
org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:824)
> >PP>         at
> >PP> 
>
>org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:224)
> >PP>         at
> >PP> 
>
>org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:155)
> >PP>         at
> >PP>
>
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1131)
> >PP>         at
> >PP>
>
org.apache.catalina.core.StandardContext.start(StandardContext.java:3371)
> >PP>         at
> >PP>
>
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
> >PP>         at
> >PP>
>
org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
> >PP>         at
> >PP>
>
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[2]: Can a URI pattern be matched to a JSP?

Posted by Eric Everman <ev...@precedadesign.com>.
Also, is it possible that there is another servlet named 
'default'?  Actually, did you say this was *your* web.xml file - not the 
default one located in the root/config directory?

If this xml snippet is from root/webapps/<yourapp>/WEB-INF/web.xml file, it 
will be additive to the root/config/web.xml file which contains the default 
servlet declaration unless you have modified this file.  In other words, 
everything in your root web.xml file is already included, you don't need to 
"re-included" it in your application's web.xml file.

Does that help?

Eric Everman

At 01:36 PM 6/26/2002, you wrote:
>Hello Prashanth,
>
>are all your <servlet> entries *after* <context-inint> entries and
>*before* <servlet-mapping> entries?
>
>Take a look in the dtd and double check that you have everything in
>the proper order.
>
>Jake
>
>Wednesday, June 26, 2002, 1:08:45 PM, you wrote:
>
>PP> Hi:
>
>PP> When I startup tomcat I still get the following error:
>
>PP> ERROR reading java.io.ByteArrayInputStream@d2fc36
>PP> At Line 63 /web-app/servlet/
>
>PP> Inside my web.xml file I found the following:
>
>PP>   <servlet>
>PP>     <servlet-name>default</servlet-name>
>
>PP> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
>PP>     <init-param>
>PP>       <param-name>debug</param-name>
>PP>       <param-value>0</param-value>
>PP>     </init-param>
>PP>     <init-param>
>PP>       <param-name>listings</param-name>
>PP>       <param-value>true</param-value>
>PP>     </init-param>
>PP>     <load-on-startup>1</load-on-startup>
>PP>   </servlet>
>
>PP> the </servlet> tag is line 63. I placed the servlet
>PP> tag above and below the default servlet....does not
>PP> help! Could there be a conflict? What more information
>PP> can I provide to debug the situation? This is one
>PP> entry I found in localhost.log
>
>PP> 2002-06-26 14:11:15 WebappLoader[/manager]: Deploying
>PP> class repositories to work directory
>PP> C:\tomcat4.0.4\work\Standalone\localhost\manager
>PP> 2002-06-26 14:11:15 StandardManager[/manager]: Seeding
>PP> random number generator class
>PP> java.security.SecureRandom
>PP> 2002-06-26 14:11:15 StandardManager[/manager]: Seeding
>PP> of random number generator has been completed
>PP> 2002-06-26 14:11:16 ContextConfig[/manager]: Added
>certificates ->> request attribute Valve
>PP> 2002-06-26 14:11:16 ContextConfig[/manager]:
>PP> Configured an authenticator for method BASIC
>PP> 2002-06-26 14:11:16 StandardWrapper[/manager:default]:
>PP> Loading container servlet default
>PP> 2002-06-26 14:11:16 default: init
>PP> 2002-06-26 14:11:16 StandardWrapper[/manager:invoker]:
>PP> Loading container servlet invoker
>PP> 2002-06-26 14:11:16 invoker: init
>PP> 2002-06-26 14:11:16 jsp: init
>PP> 2002-06-26 14:11:16 WebappLoader[]: Deploying class
>PP> repositories to work directory
>PP> C:\tomcat4.0.4\work\Standalone\localhost\_
>PP> 2002-06-26 14:11:16 WebappLoader[]: Reloading checks
>PP> are enabled for this Context
>PP> 2002-06-26 14:11:16 StandardManager[]: Seeding random
>PP> number generator class java.security.SecureRandom
>PP> 2002-06-26 14:11:16 StandardManager[]: Seeding of
>PP> random number generator has been completed
>PP> 2002-06-26 14:11:16 ContextConfig[] Configuration
>PP> error in application web.xml
>PP> java.lang.IllegalArgumentException: addChild:  Child
>PP> name 'default' is not unique
>PP>         at
>PP> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
>PP>         at
>PP> 
>org.apache.catalina.core.StandardContext.addChild(StandardContext.java:1280)
>PP>         at
>PP> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>PP> Method)
>PP>         at
>PP> 
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>PP>         at
>PP> 
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>PP>         at java.lang.reflect.Method.invoke(Method.java:324)
>PP>         at
>PP> org.apache.catalina.util.xml.AddChild.end(XmlMapper.java:811)
>PP>         at
>PP> org.apache.catalina.util.xml.XmlMapper.matchEnd(XmlMapper.java:419)
>PP>         at
>PP> org.apache.catalina.util.xml.XmlMapper.endElement(XmlMapper.java:119)
>PP>         at
>PP> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAdapter.java:347)
>PP>         at
>PP> org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
>PP>         at
>PP> 
>org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
>PP>         at
>PP> 
>org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
>PP>         at
>PP> 
>org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
>PP>         at
>PP> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
>PP>         at
>PP> org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
>PP>         at
>PP> javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
>PP>         at
>PP> javax.xml.parsers.SAXParser.parse(SAXParser.java:89)
>PP>         at
>PP> org.apache.catalina.util.xml.XmlMapper.readXml(XmlMapper.java:275)
>PP>         at
>PP> 
>org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:256)
>PP>         at
>PP> org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:824)
>PP>         at
>PP> 
>org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:224)
>PP>         at
>PP> 
>org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:155)
>PP>         at
>PP> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1131)
>PP>         at
>PP> org.apache.catalina.core.StandardContext.start(StandardContext.java:3371)
>PP>         at
>PP> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
>PP>         at
>PP> org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
>PP>         at
>PP> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
>PP>         at
>PP> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
>PP>         at
>PP> org.apache.catalina.core.StandardService.start(StandardService.java:388)
>PP>         at
>PP> org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
>PP>         at
>PP> org.apache.catalina.startup.Catalina.start(Catalina.java:781)
>PP>         at
>PP> org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
>PP>         at
>PP> org.apache.catalina.startup.Catalina.process(Catalina.java:179)
>PP>         at
>PP> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>PP> Method)
>PP>         at
>PP> 
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>PP>         at
>PP> 
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>PP>         at java.lang.reflect.Method.invoke(Method.java:324)
>PP>         at
>PP> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
>
>PP> 2002-06-26 14:11:16 ContextConfig[]: Marking this
>PP> application unavailable due to previous error(s)
>PP> 2002-06-26 14:11:16 StandardContext[]: Error
>PP> initializing naming context for context
>PP> 2002-06-26 14:11:16 StandardContext[]: Context startup
>PP> failed due to previous errors
>PP> 2002-06-26 14:11:17 StandardContext[]: Error
>PP> initializing naming context for context
>PP> 2002-06-26 14:11:17 StandardHost[localhost]:
>PP> Installing web application at context path
>PP> /tomcat-docs from URL
>PP> file:C:\tomcat4.0.4\webapps\tomcat-docs
>PP> ..................................
>PP> ..................................
>
>PP> I'm googled!
>PP> Prashanth
>
>
>PP> --- Milt Epstein <me...@uiuc.edu> wrote:
> >> On Wed, 26 Jun 2002, Prashanth Pushpagiri wrote:
> >>
> >> > Hi:
> >>
> >> > I tried this but when I add the servlet and
> >> servlet-mapping tags to
> >> > the web.xml, Tomcat throws an error during
> >> startup!
> >> >
> >> > ERROR reading java.io.ByteArrayInputStream@76cad3
> >> > At Line 57 /web-app/servlet/
> >>
> >> This doesn't mean it's not working, you need to
> >> figure out what's
> >> causing this error, maybe it's something totally
> >> unrelated.  And is
> >> that the entire error message?  It looks incomplete.
> >>
> >>
> >> > I tried adding the mappings to web.xml files in
> >> /conf and my web
> >> > application...neither a success..
> >> >
> >> > Am I doing something wrong? All I want to do is
> >> send the request to
> >> > my index.jsp page which will check for something
> >> and then serve the
> >> > file out!
> >>
> >> At this point, I'm not sure I'm going to be able to
> >> help you anymore,
> >> sounds like you've got a different problem.  And
> >> you're going to need
> >> to provide more information in order for people to
> >> have an idea what's
> >> going on.
> >>
> >>
> >> > --- Milt Epstein <me...@uiuc.edu> wrote:
> >> > > On Tue, 25 Jun 2002, Prashanth Pushpagiri wrote:
> >> > >
> >> > > > Hello everyone:
> >> > > > I am using Tomcat 4.0.4 on IIS. I would like
> >> to
> >> > > know if there is a
> >> > > > way of forwarding requests of a particular
> >> pattern
> >> > > to a JSP i
> >> > > > specify using Tomcat?
> >> > > >
> >> > > > For eg. say the user requests for a file like
> >> > > > /examples/dln/sample.doc I want tomcat to
> >> forward
> >> > > the request to a
> >> > > > JSP /examples/index.jsp instead of serving the
> >> > > file out. I guess
> >> > > > this is similar to what servlet mapping is! A
> >> > > particular URI pattern
> >> > > > '/examples/dln' should be forwarded to a
> >> > > particular JSP
> >> > > > '/examples/index.jsp'.
> >> > > >
> >> > > > Any advice and assistance on this would be
> >> very
> >> > > helpful.
> >> > >
> >> > > Yes, you can do this.
> >> > >
> >> > > Just define a servlet in your web.xml, and
> >> instead
> >> > > of specifying a
> >> > > servlet-class, specify a jsp-file.  Then you can
> >> > > specify
> >> > > servlet-mapping's back to that servlet.  A la:
> >> > >
> >> > > <servlet>
> >> > >   <servlet-name>somename</servlet-name>
> >> > >   <jsp-file>index.jsp</jsp-file>
> >> > > ...
> >> > > </servlet>
> >> > >
> >> > > <servlet-mapping>
> >> > >   <servlet-name>somename</servlet-name>
> >> > >   <url-pattern>/dln</url-pattern>
> >> > > </servlet-mapping>
> >> > >
> >> > > (You used to be able to specify the jsp-file
> >> right
> >> > > in the
> >> > > servlet-mapping  -- i.e. instead of the
> >> servlet-name
> >> > > -- but it looks
> >> > > like that was changed in the 2.3 spec.  I think
> >> the
> >> > > above gives the
> >> > > same effect, just with the extra expense of
> >> having
> >> > > to come up with a
> >> > > servlet name :-).
> >>
> >> Milt Epstein
> >> Research Programmer
> >> Systems and Technology Services (STS)
> >> Campus Information Technologies and Educational
> >> Services (CITES)
> >> University of Illinois at Urbana-Champaign (UIUC)
> >> mepstein@uiuc.edu
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> >> <ma...@jakarta.apache.org>
> >> For additional commands, e-mail:
> >> <ma...@jakarta.apache.org>
> >>
>
>
>PP> __________________________________________________
>PP> Do You Yahoo!?
>PP> Yahoo! - Official partner of 2002 FIFA World Cup
>PP> http://fifaworldcup.yahoo.com
>
>PP> --
>PP> To unsubscribe, 
>e-mail:   <ma...@jakarta.apache.org>
>PP> For additional commands, e-mail: 
><ma...@jakarta.apache.org>
>
>
>
>--
>Best regards,
>  Jacob                            mailto:hoju@visi.com
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[2]: Can a URI pattern be matched to a JSP?

Posted by Jacob Kjome <ho...@visi.com>.
Hello Prashanth,

are all your <servlet> entries *after* <context-inint> entries and
*before* <servlet-mapping> entries?

Take a look in the dtd and double check that you have everything in
the proper order.

Jake

Wednesday, June 26, 2002, 1:08:45 PM, you wrote:

PP> Hi:

PP> When I startup tomcat I still get the following error:

PP> ERROR reading java.io.ByteArrayInputStream@d2fc36
PP> At Line 63 /web-app/servlet/

PP> Inside my web.xml file I found the following:

PP>   <servlet>
PP>     <servlet-name>default</servlet-name>
   
PP> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
PP>     <init-param>
PP>       <param-name>debug</param-name>
PP>       <param-value>0</param-value>
PP>     </init-param>
PP>     <init-param>
PP>       <param-name>listings</param-name>
PP>       <param-value>true</param-value>
PP>     </init-param>
PP>     <load-on-startup>1</load-on-startup>
PP>   </servlet>           

PP> the </servlet> tag is line 63. I placed the servlet
PP> tag above and below the default servlet....does not
PP> help! Could there be a conflict? What more information
PP> can I provide to debug the situation? This is one
PP> entry I found in localhost.log

PP> 2002-06-26 14:11:15 WebappLoader[/manager]: Deploying
PP> class repositories to work directory
PP> C:\tomcat4.0.4\work\Standalone\localhost\manager
PP> 2002-06-26 14:11:15 StandardManager[/manager]: Seeding
PP> random number generator class
PP> java.security.SecureRandom
PP> 2002-06-26 14:11:15 StandardManager[/manager]: Seeding
PP> of random number generator has been completed
PP> 2002-06-26 14:11:16 ContextConfig[/manager]: Added
certificates ->> request attribute Valve
PP> 2002-06-26 14:11:16 ContextConfig[/manager]:
PP> Configured an authenticator for method BASIC
PP> 2002-06-26 14:11:16 StandardWrapper[/manager:default]:
PP> Loading container servlet default
PP> 2002-06-26 14:11:16 default: init
PP> 2002-06-26 14:11:16 StandardWrapper[/manager:invoker]:
PP> Loading container servlet invoker
PP> 2002-06-26 14:11:16 invoker: init
PP> 2002-06-26 14:11:16 jsp: init
PP> 2002-06-26 14:11:16 WebappLoader[]: Deploying class
PP> repositories to work directory
PP> C:\tomcat4.0.4\work\Standalone\localhost\_
PP> 2002-06-26 14:11:16 WebappLoader[]: Reloading checks
PP> are enabled for this Context
PP> 2002-06-26 14:11:16 StandardManager[]: Seeding random
PP> number generator class java.security.SecureRandom
PP> 2002-06-26 14:11:16 StandardManager[]: Seeding of
PP> random number generator has been completed
PP> 2002-06-26 14:11:16 ContextConfig[] Configuration
PP> error in application web.xml
PP> java.lang.IllegalArgumentException: addChild:  Child
PP> name 'default' is not unique
PP>         at
PP> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
PP>         at
PP> org.apache.catalina.core.StandardContext.addChild(StandardContext.java:1280)
PP>         at
PP> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
PP> Method)
PP>         at
PP> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
PP>         at
PP> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
PP>         at java.lang.reflect.Method.invoke(Method.java:324)
PP>         at
PP> org.apache.catalina.util.xml.AddChild.end(XmlMapper.java:811)
PP>         at
PP> org.apache.catalina.util.xml.XmlMapper.matchEnd(XmlMapper.java:419)
PP>         at
PP> org.apache.catalina.util.xml.XmlMapper.endElement(XmlMapper.java:119)
PP>         at
PP> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAdapter.java:347)
PP>         at
PP> org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
PP>         at
PP> org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
PP>         at
PP> org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
PP>         at
PP> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
PP>         at
PP> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
PP>         at
PP> org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
PP>         at
PP> javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
PP>         at
PP> javax.xml.parsers.SAXParser.parse(SAXParser.java:89)
PP>         at
PP> org.apache.catalina.util.xml.XmlMapper.readXml(XmlMapper.java:275)
PP>         at
PP> org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:256)
PP>         at
PP> org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:824)
PP>         at
PP> org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:224)
PP>         at
PP> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:155)
PP>         at
PP> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1131)
PP>         at
PP> org.apache.catalina.core.StandardContext.start(StandardContext.java:3371)
PP>         at
PP> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
PP>         at
PP> org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
PP>         at
PP> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
PP>         at
PP> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
PP>         at
PP> org.apache.catalina.core.StandardService.start(StandardService.java:388)
PP>         at
PP> org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
PP>         at
PP> org.apache.catalina.startup.Catalina.start(Catalina.java:781)
PP>         at
PP> org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
PP>         at
PP> org.apache.catalina.startup.Catalina.process(Catalina.java:179)
PP>         at
PP> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
PP> Method)
PP>         at
PP> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
PP>         at
PP> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
PP>         at java.lang.reflect.Method.invoke(Method.java:324)
PP>         at
PP> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)

PP> 2002-06-26 14:11:16 ContextConfig[]: Marking this
PP> application unavailable due to previous error(s)
PP> 2002-06-26 14:11:16 StandardContext[]: Error
PP> initializing naming context for context 
PP> 2002-06-26 14:11:16 StandardContext[]: Context startup
PP> failed due to previous errors
PP> 2002-06-26 14:11:17 StandardContext[]: Error
PP> initializing naming context for context 
PP> 2002-06-26 14:11:17 StandardHost[localhost]:
PP> Installing web application at context path
PP> /tomcat-docs from URL
PP> file:C:\tomcat4.0.4\webapps\tomcat-docs
PP> ..................................
PP> ..................................

PP> I'm googled!
PP> Prashanth


PP> --- Milt Epstein <me...@uiuc.edu> wrote:
>> On Wed, 26 Jun 2002, Prashanth Pushpagiri wrote:
>> 
>> > Hi:
>> 
>> > I tried this but when I add the servlet and
>> servlet-mapping tags to
>> > the web.xml, Tomcat throws an error during
>> startup!
>> >
>> > ERROR reading java.io.ByteArrayInputStream@76cad3
>> > At Line 57 /web-app/servlet/
>> 
>> This doesn't mean it's not working, you need to
>> figure out what's
>> causing this error, maybe it's something totally
>> unrelated.  And is
>> that the entire error message?  It looks incomplete.
>> 
>> 
>> > I tried adding the mappings to web.xml files in
>> /conf and my web
>> > application...neither a success..
>> >
>> > Am I doing something wrong? All I want to do is
>> send the request to
>> > my index.jsp page which will check for something
>> and then serve the
>> > file out!
>> 
>> At this point, I'm not sure I'm going to be able to
>> help you anymore,
>> sounds like you've got a different problem.  And
>> you're going to need
>> to provide more information in order for people to
>> have an idea what's
>> going on.
>> 
>> 
>> > --- Milt Epstein <me...@uiuc.edu> wrote:
>> > > On Tue, 25 Jun 2002, Prashanth Pushpagiri wrote:
>> > >
>> > > > Hello everyone:
>> > > > I am using Tomcat 4.0.4 on IIS. I would like
>> to
>> > > know if there is a
>> > > > way of forwarding requests of a particular
>> pattern
>> > > to a JSP i
>> > > > specify using Tomcat?
>> > > >
>> > > > For eg. say the user requests for a file like
>> > > > /examples/dln/sample.doc I want tomcat to
>> forward
>> > > the request to a
>> > > > JSP /examples/index.jsp instead of serving the
>> > > file out. I guess
>> > > > this is similar to what servlet mapping is! A
>> > > particular URI pattern
>> > > > '/examples/dln' should be forwarded to a
>> > > particular JSP
>> > > > '/examples/index.jsp'.
>> > > >
>> > > > Any advice and assistance on this would be
>> very
>> > > helpful.
>> > >
>> > > Yes, you can do this.
>> > >
>> > > Just define a servlet in your web.xml, and
>> instead
>> > > of specifying a
>> > > servlet-class, specify a jsp-file.  Then you can
>> > > specify
>> > > servlet-mapping's back to that servlet.  A la:
>> > >
>> > > <servlet>
>> > >   <servlet-name>somename</servlet-name>
>> > >   <jsp-file>index.jsp</jsp-file>
>> > > ...
>> > > </servlet>
>> > >
>> > > <servlet-mapping>
>> > >   <servlet-name>somename</servlet-name>
>> > >   <url-pattern>/dln</url-pattern>
>> > > </servlet-mapping>
>> > >
>> > > (You used to be able to specify the jsp-file
>> right
>> > > in the
>> > > servlet-mapping  -- i.e. instead of the
>> servlet-name
>> > > -- but it looks
>> > > like that was changed in the 2.3 spec.  I think
>> the
>> > > above gives the
>> > > same effect, just with the extra expense of
>> having
>> > > to come up with a
>> > > servlet name :-).
>> 
>> Milt Epstein
>> Research Programmer
>> Systems and Technology Services (STS)
>> Campus Information Technologies and Educational
>> Services (CITES)
>> University of Illinois at Urbana-Champaign (UIUC)
>> mepstein@uiuc.edu
>> 
>> 
>> --
>> To unsubscribe, e-mail:  
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>> 


PP> __________________________________________________
PP> Do You Yahoo!?
PP> Yahoo! - Official partner of 2002 FIFA World Cup
PP> http://fifaworldcup.yahoo.com

PP> --
PP> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
PP> For additional commands, e-mail: <ma...@jakarta.apache.org>



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Can a URI pattern be matched to a JSP?

Posted by Stefan Langer <ma...@web.de>.
Hello

Your logfile says that default is not a unique name meaning some other
servlet has the same name.
The best way to handle these issues is to eliminate everything from your
web.xml that is not explicitly yours. So just add your servlet and your
servlet mapping to your web.xml and delete everything else since it should
allready be included in the default web.xml.


Stefan Langer



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Can a URI pattern be matched to a JSP?

Posted by Prashanth Pushpagiri <pr...@yahoo.com>.
Hi:

When I startup tomcat I still get the following error:

ERROR reading java.io.ByteArrayInputStream@d2fc36
At Line 63 /web-app/servlet/

Inside my web.xml file I found the following:

  <servlet>
    <servlet-name>default</servlet-name>
   
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>listings</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>           

the </servlet> tag is line 63. I placed the servlet
tag above and below the default servlet....does not
help! Could there be a conflict? What more information
can I provide to debug the situation? This is one
entry I found in localhost.log

2002-06-26 14:11:15 WebappLoader[/manager]: Deploying
class repositories to work directory
C:\tomcat4.0.4\work\Standalone\localhost\manager
2002-06-26 14:11:15 StandardManager[/manager]: Seeding
random number generator class
java.security.SecureRandom
2002-06-26 14:11:15 StandardManager[/manager]: Seeding
of random number generator has been completed
2002-06-26 14:11:16 ContextConfig[/manager]: Added
certificates -> request attribute Valve
2002-06-26 14:11:16 ContextConfig[/manager]:
Configured an authenticator for method BASIC
2002-06-26 14:11:16 StandardWrapper[/manager:default]:
Loading container servlet default
2002-06-26 14:11:16 default: init
2002-06-26 14:11:16 StandardWrapper[/manager:invoker]:
Loading container servlet invoker
2002-06-26 14:11:16 invoker: init
2002-06-26 14:11:16 jsp: init
2002-06-26 14:11:16 WebappLoader[]: Deploying class
repositories to work directory
C:\tomcat4.0.4\work\Standalone\localhost\_
2002-06-26 14:11:16 WebappLoader[]: Reloading checks
are enabled for this Context
2002-06-26 14:11:16 StandardManager[]: Seeding random
number generator class java.security.SecureRandom
2002-06-26 14:11:16 StandardManager[]: Seeding of
random number generator has been completed
2002-06-26 14:11:16 ContextConfig[] Configuration
error in application web.xml
java.lang.IllegalArgumentException: addChild:  Child
name 'default' is not unique
	at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at
org.apache.catalina.core.StandardContext.addChild(StandardContext.java:1280)
	at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at
org.apache.catalina.util.xml.AddChild.end(XmlMapper.java:811)
	at
org.apache.catalina.util.xml.XmlMapper.matchEnd(XmlMapper.java:419)
	at
org.apache.catalina.util.xml.XmlMapper.endElement(XmlMapper.java:119)
	at
org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAdapter.java:347)
	at
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
	at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
	at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
	at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
	at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
	at
org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
	at
javax.xml.parsers.SAXParser.parse(SAXParser.java:314)
	at
javax.xml.parsers.SAXParser.parse(SAXParser.java:89)
	at
org.apache.catalina.util.xml.XmlMapper.readXml(XmlMapper.java:275)
	at
org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:256)
	at
org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:824)
	at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:224)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:155)
	at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1131)
	at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3371)
	at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
	at
org.apache.catalina.core.StandardHost.start(StandardHost.java:638)
	at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
	at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
	at
org.apache.catalina.core.StandardService.start(StandardService.java:388)
	at
org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
	at
org.apache.catalina.startup.Catalina.start(Catalina.java:781)
	at
org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
	at
org.apache.catalina.startup.Catalina.process(Catalina.java:179)
	at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)

2002-06-26 14:11:16 ContextConfig[]: Marking this
application unavailable due to previous error(s)
2002-06-26 14:11:16 StandardContext[]: Error
initializing naming context for context 
2002-06-26 14:11:16 StandardContext[]: Context startup
failed due to previous errors
2002-06-26 14:11:17 StandardContext[]: Error
initializing naming context for context 
2002-06-26 14:11:17 StandardHost[localhost]:
Installing web application at context path
/tomcat-docs from URL
file:C:\tomcat4.0.4\webapps\tomcat-docs
..................................
..................................

I'm googled!
Prashanth


--- Milt Epstein <me...@uiuc.edu> wrote:
> On Wed, 26 Jun 2002, Prashanth Pushpagiri wrote:
> 
> > Hi:
> 
> > I tried this but when I add the servlet and
> servlet-mapping tags to
> > the web.xml, Tomcat throws an error during
> startup!
> >
> > ERROR reading java.io.ByteArrayInputStream@76cad3
> > At Line 57 /web-app/servlet/
> 
> This doesn't mean it's not working, you need to
> figure out what's
> causing this error, maybe it's something totally
> unrelated.  And is
> that the entire error message?  It looks incomplete.
> 
> 
> > I tried adding the mappings to web.xml files in
> /conf and my web
> > application...neither a success..
> >
> > Am I doing something wrong? All I want to do is
> send the request to
> > my index.jsp page which will check for something
> and then serve the
> > file out!
> 
> At this point, I'm not sure I'm going to be able to
> help you anymore,
> sounds like you've got a different problem.  And
> you're going to need
> to provide more information in order for people to
> have an idea what's
> going on.
> 
> 
> > --- Milt Epstein <me...@uiuc.edu> wrote:
> > > On Tue, 25 Jun 2002, Prashanth Pushpagiri wrote:
> > >
> > > > Hello everyone:
> > > > I am using Tomcat 4.0.4 on IIS. I would like
> to
> > > know if there is a
> > > > way of forwarding requests of a particular
> pattern
> > > to a JSP i
> > > > specify using Tomcat?
> > > >
> > > > For eg. say the user requests for a file like
> > > > /examples/dln/sample.doc I want tomcat to
> forward
> > > the request to a
> > > > JSP /examples/index.jsp instead of serving the
> > > file out. I guess
> > > > this is similar to what servlet mapping is! A
> > > particular URI pattern
> > > > '/examples/dln' should be forwarded to a
> > > particular JSP
> > > > '/examples/index.jsp'.
> > > >
> > > > Any advice and assistance on this would be
> very
> > > helpful.
> > >
> > > Yes, you can do this.
> > >
> > > Just define a servlet in your web.xml, and
> instead
> > > of specifying a
> > > servlet-class, specify a jsp-file.  Then you can
> > > specify
> > > servlet-mapping's back to that servlet.  A la:
> > >
> > > <servlet>
> > >   <servlet-name>somename</servlet-name>
> > >   <jsp-file>index.jsp</jsp-file>
> > > ...
> > > </servlet>
> > >
> > > <servlet-mapping>
> > >   <servlet-name>somename</servlet-name>
> > >   <url-pattern>/dln</url-pattern>
> > > </servlet-mapping>
> > >
> > > (You used to be able to specify the jsp-file
> right
> > > in the
> > > servlet-mapping  -- i.e. instead of the
> servlet-name
> > > -- but it looks
> > > like that was changed in the 2.3 spec.  I think
> the
> > > above gives the
> > > same effect, just with the extra expense of
> having
> > > to come up with a
> > > servlet name :-).
> 
> Milt Epstein
> Research Programmer
> Systems and Technology Services (STS)
> Campus Information Technologies and Educational
> Services (CITES)
> University of Illinois at Urbana-Champaign (UIUC)
> mepstein@uiuc.edu
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Can a URI pattern be matched to a JSP?

Posted by Milt Epstein <me...@uiuc.edu>.
On Wed, 26 Jun 2002, Prashanth Pushpagiri wrote:

> Hi:

> I tried this but when I add the servlet and servlet-mapping tags to
> the web.xml, Tomcat throws an error during startup!
>
> ERROR reading java.io.ByteArrayInputStream@76cad3
> At Line 57 /web-app/servlet/

This doesn't mean it's not working, you need to figure out what's
causing this error, maybe it's something totally unrelated.  And is
that the entire error message?  It looks incomplete.


> I tried adding the mappings to web.xml files in /conf and my web
> application...neither a success..
>
> Am I doing something wrong? All I want to do is send the request to
> my index.jsp page which will check for something and then serve the
> file out!

At this point, I'm not sure I'm going to be able to help you anymore,
sounds like you've got a different problem.  And you're going to need
to provide more information in order for people to have an idea what's
going on.


> --- Milt Epstein <me...@uiuc.edu> wrote:
> > On Tue, 25 Jun 2002, Prashanth Pushpagiri wrote:
> >
> > > Hello everyone:
> > > I am using Tomcat 4.0.4 on IIS. I would like to
> > know if there is a
> > > way of forwarding requests of a particular pattern
> > to a JSP i
> > > specify using Tomcat?
> > >
> > > For eg. say the user requests for a file like
> > > /examples/dln/sample.doc I want tomcat to forward
> > the request to a
> > > JSP /examples/index.jsp instead of serving the
> > file out. I guess
> > > this is similar to what servlet mapping is! A
> > particular URI pattern
> > > '/examples/dln' should be forwarded to a
> > particular JSP
> > > '/examples/index.jsp'.
> > >
> > > Any advice and assistance on this would be very
> > helpful.
> >
> > Yes, you can do this.
> >
> > Just define a servlet in your web.xml, and instead
> > of specifying a
> > servlet-class, specify a jsp-file.  Then you can
> > specify
> > servlet-mapping's back to that servlet.  A la:
> >
> > <servlet>
> >   <servlet-name>somename</servlet-name>
> >   <jsp-file>index.jsp</jsp-file>
> > ...
> > </servlet>
> >
> > <servlet-mapping>
> >   <servlet-name>somename</servlet-name>
> >   <url-pattern>/dln</url-pattern>
> > </servlet-mapping>
> >
> > (You used to be able to specify the jsp-file right
> > in the
> > servlet-mapping  -- i.e. instead of the servlet-name
> > -- but it looks
> > like that was changed in the 2.3 spec.  I think the
> > above gives the
> > same effect, just with the extra expense of having
> > to come up with a
> > servlet name :-).

Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
mepstein@uiuc.edu


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Can a URI pattern be matched to a JSP?

Posted by Prashanth Pushpagiri <pr...@yahoo.com>.
Hi:
I tried this but when I add the servlet and
servlet-mapping tags to the web.xml, Tomcat throws an
error during startup!

ERROR reading java.io.ByteArrayInputStream@76cad3
At Line 57 /web-app/servlet/

I tried adding the mappings to web.xml files in /conf
and my web application...neither a success..

Am I doing something wrong? All I want to do is send
the request to my index.jsp page which will check for
something and then serve the file out!

Thanks
Prashanth
 
--- Milt Epstein <me...@uiuc.edu> wrote:
> On Tue, 25 Jun 2002, Prashanth Pushpagiri wrote:
> 
> > Hello everyone:
> > I am using Tomcat 4.0.4 on IIS. I would like to
> know if there is a
> > way of forwarding requests of a particular pattern
> to a JSP i
> > specify using Tomcat?
> >
> > For eg. say the user requests for a file like
> > /examples/dln/sample.doc I want tomcat to forward
> the request to a
> > JSP /examples/index.jsp instead of serving the
> file out. I guess
> > this is similar to what servlet mapping is! A
> particular URI pattern
> > '/examples/dln' should be forwarded to a
> particular JSP
> > '/examples/index.jsp'.
> >
> > Any advice and assistance on this would be very
> helpful.
> 
> Yes, you can do this.
> 
> Just define a servlet in your web.xml, and instead
> of specifying a
> servlet-class, specify a jsp-file.  Then you can
> specify
> servlet-mapping's back to that servlet.  A la:
> 
> <servlet>
>   <servlet-name>somename</servlet-name>
>   <jsp-file>index.jsp</jsp-file>
> ...
> </servlet>
> 
> <servlet-mapping>
>   <servlet-name>somename</servlet-name>
>   <url-pattern>/dln</url-pattern>
> </servlet-mapping>
> 
> (You used to be able to specify the jsp-file right
> in the
> servlet-mapping  -- i.e. instead of the servlet-name
> -- but it looks
> like that was changed in the 2.3 spec.  I think the
> above gives the
> same effect, just with the extra expense of having
> to come up with a
> servlet name :-).
> 
> Milt Epstein
> Research Programmer
> Systems and Technology Services (STS)
> Campus Information Technologies and Educational
> Services (CITES)
> University of Illinois at Urbana-Champaign (UIUC)
> mepstein@uiuc.edu
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Can a URI pattern be matched to a JSP?

Posted by Milt Epstein <me...@uiuc.edu>.
On Tue, 25 Jun 2002, Prashanth Pushpagiri wrote:

> Hello everyone:
> I am using Tomcat 4.0.4 on IIS. I would like to know if there is a
> way of forwarding requests of a particular pattern to a JSP i
> specify using Tomcat?
>
> For eg. say the user requests for a file like
> /examples/dln/sample.doc I want tomcat to forward the request to a
> JSP /examples/index.jsp instead of serving the file out. I guess
> this is similar to what servlet mapping is! A particular URI pattern
> '/examples/dln' should be forwarded to a particular JSP
> '/examples/index.jsp'.
>
> Any advice and assistance on this would be very helpful.

Yes, you can do this.

Just define a servlet in your web.xml, and instead of specifying a
servlet-class, specify a jsp-file.  Then you can specify
servlet-mapping's back to that servlet.  A la:

<servlet>
  <servlet-name>somename</servlet-name>
  <jsp-file>index.jsp</jsp-file>
...
</servlet>

<servlet-mapping>
  <servlet-name>somename</servlet-name>
  <url-pattern>/dln</url-pattern>
</servlet-mapping>

(You used to be able to specify the jsp-file right in the
servlet-mapping  -- i.e. instead of the servlet-name -- but it looks
like that was changed in the 2.3 spec.  I think the above gives the
same effect, just with the extra expense of having to come up with a
servlet name :-).

Milt Epstein
Research Programmer
Systems and Technology Services (STS)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
mepstein@uiuc.edu


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>