Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

Re: Invoker Not Invoking in 5.5.9

Bill Barker

2007-07-26

Replies:


>"W Strater" <wstrater@(protected)
>news:663241.30795.qm@(protected)...
>I know that the servlet invoker is not popular but that is what I have to
>deal with.
>
>All of the servlets are invoked as
>http://localhost:8080/servlets/com.domain.servlets.ServletName where the
>/servlets is >the web app name.
>
>I would like to acheive to things.
>
>1) Ensure that only servlets within a package get invoked.
>2) Provide a catch all servlet.
>
>Here are my servlet mappings:
>
>
><servlet-mapping>
>
>   <servlet-name>invoker</servlet-name>
>
>   <url-pattern>/com.domain.servlets.*</url-pattern>
>
></servlet-mapping>
>

This doesn't do what you want. It is an exact-match pattern for a URL that
is litterally '/servlets/com.domain.servlets.*'. And, even if it did work,
Invoker would choke on the result.
>
>
>
>
><servlet-mapping>
>
>   <servlet-name>catchAll</servlet-name>
>
>   <url-pattern>/*</url-pattern>
>
></servlet-mapping>
>
>
>
>
>The problem is that the catchAll is getting every request despite being
>defined after the invoker. I have even defined a >new servlet name,
>xxxxxxxx, with the invoker class,
>org.apache.catalina.servlets.InvokerServlet, still the catchAll gets all
> >requests.
>
>Any suggestions?
>

Probably easiest is modifying the catchAll servlet to do something like (but
I haven't tried it myself):
  String pathInfo = request.getPathInfo();
  if(pathInfo != null && pathInfo.startsWith("/com.domain.servlets.")) {
     RequestDispatcher rd =
getServletContext().getNamedDispatcher("invoker");
     rd.forward(request, response);
     return;
  }

I can't see how you could accomplish what you want otherwise, without
changing your URL-space layout (since Invoker only works if it is
prefix-mapped).
>
>Wes.
>




---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.