You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jesper Jørgensen <je...@caput.com> on 2000/03/23 10:18:37 UTC

Mapping servlets to other things that prefix and suffix

How do I go about setting up a completely traditional servlet repository
with automatic servlet reloading in tomcat BUT with one big difference:

I want each servlet to be mapped to a query string parameter instead of
to a path element or a suffix. Like:

http://domain.tld/showfolder.jsp?command=openthread&thread=1 Should be
mapped to the "command servlet" "openthread" which in this case will
change state of a folder view.

After the "command" servlet has been run, things should proceed as usual
as if no servlet has serviced the request yet, so that the JSP page
would be processed afterwards.

In effect, I am _not_ interested in complying with a standard servlet
container. I am interested in reusing the code already written in tomcat
that manages reloading and servicing of servlets to implement an MVC
controller that dispatches commands.

Regards,
Jesper
-- 
Jesper Jorgensen         Caput ApS       Tel +45 33 12 24 42             
jesper@caput.com         Nygade 6        Fax +45 33 91 24 42
http://www.caput.com     DK-1164 Kbh K

Re: Mapping servlets to other things that prefix and suffix

Posted by Costin Manolache <co...@eng.sun.com>.
You can implement a RequestInterceptor that will set the handler.

It's not very difficult, but be aware that this is not specified in any
spec, and might not work in any other engine. A portable solution is to use
a servlet that does a dispatch.

Costin



Jesper Jørgensen wrote:

> How do I go about setting up a completely traditional servlet repository
> with automatic servlet reloading in tomcat BUT with one big difference:
>
> I want each servlet to be mapped to a query string parameter instead of
> to a path element or a suffix. Like:
>
> http://domain.tld/showfolder.jsp?command=openthread&thread=1 Should be
> mapped to the "command servlet" "openthread" which in this case will
> change state of a folder view.
>
> After the "command" servlet has been run, things should proceed as usual
> as if no servlet has serviced the request yet, so that the JSP page
> would be processed afterwards.
>
> In effect, I am _not_ interested in complying with a standard servlet
> container. I am interested in reusing the code already written in tomcat
> that manages reloading and servicing of servlets to implement an MVC
> controller that dispatches commands.
>
> Regards,
> Jesper
> --
> Jesper Jorgensen         Caput ApS       Tel +45 33 12 24 42
> jesper@caput.com         Nygade 6        Fax +45 33 91 24 42
> http://www.caput.com     DK-1164 Kbh K
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org