You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by flower <fl...@intercel.com.pl> on 2005/07/31 23:22:26 UTC

Servlet mapping - url pattern with *

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" ;]

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

Greatings
flow




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


Re: Servlet mapping - url pattern with *

Posted by flower <fl...@intercel.com.pl>.
Bill Barker wrote:

>"flower" <fl...@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").
>  
>
mhm, when some time ago I was reading Servlet spec, I noticed that.

>>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);
>   }
>  
>
thx for example :)
I was thinking about somethings like this ... but my lazy force me to 
looking buildin solution :)

thx and greetings
flow


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


Re: Servlet mapping - url pattern with *

Posted by Bill Barker <wb...@wilshire.com>.
"flower" <fl...@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