tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Servlet mapping - url pattern with *
Date Mon, 01 Aug 2005 07:46:32 GMT

"flower" <flower@intercel.com.pl> wrote in message 
news:42ED4112.4070205@intercel.com.pl...
> Hello,
>
> Let's consider situation like this:
> We have got some servlets responsible for genereting galery page. We want 
> group galery pages by use common part in uri (/galery/):
> http://x.com/galery/galery_id/firstpage.html
> http://x.com/galery/galery_id/secondpage.html
>
> firstpage.html is generated by servlet1 , secondpage.html by servlet2.
>
> So we must url-pattern like this: /galery/*/firstpage.html and 
> /galery/*/secondpage.html but this url-pattern doesn't work.
> question: why ? ( I use version 5.5.9 )
>
> Some people, with I was talking about this, said that patterns like this 
> was work with previously version and that version 5.5.9 is "crazy" ;]
>

I've got a vague recollection that some some such Tomcat-specific extension 
was proposed on the dev list.  Can't remember if it was ever implemented 
(and to which version), and I'm much to lazy to look it up :).  However, the 
5.5.9 behavior is in strict compilance with the Servlet spec (and, hence 
anything but "crazy").

> Is any way to obtain behaviour like above with latest version ?
>

Simplest is with a Filter that does something like:
   RequestDispatcher rd = null;
   if(request.getRequestURI().endsWith("/firstpage.html") {
           rd = getServletContext().getNamedDispatcher("servlet1");
   } else if(request.getRequestURI().endsWith("/secondpage.html");
           rd = getServletContext().getNamedDispatcher("servlet2");
   }
   if(rd != null) {
          rd.forward(request, response);
   }



> Greatings
> flow 




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message