In my web.xml I set up the servlet mapping, for a (front) servlet to handle all requests for the web app, to '/'. This works to the extent that all requests are passed to the servlet. BUT... if I do a forward to another resource from the servlet, the servlet's doGet() method is invoked recursively with no response generated until the jvm runs out of memory. The same thing happens with a url-pattern of '/*'. If the servlet itself generates html output, that works.  If I map my servlet to a specific resource, like /index.html, forwarding works fine, but the servlet cant handle all requests and 'http://myhost/myapp' returns 'no directory browsing'. 

The url-pattern '/' seems like a valid directory specification (as per the servlet 2.2 spec, 'Servlet Mapping Techniques') and a front component, handling all requests is fundamental in the j2EE blueprints (http://java.sun.com/j2ee/blueprints/index.html, section 10.6), so my approach seems architecturally reasonable.

I've looked thru the archives and found two reports of the same problem. A proposed workaround from Magnus seems to recommend explicitly mapping every request your app generates (which would make the web.xml coding difficult to maintain in a large app) pendng the delivery of 'filters', perhaps in Servlet 2.3. I dont really understand what Magnus is suggesting:

PS: If you're bound to 2.2 or lower then you will not be able to use Filters, in that case you'd have to apply a more complex solution with duplicate resource roots and so on.

It looks like 'no front servlets on Orion' to me, but I hope I'm wrong.

I was not able to find any references to the problem on bugzilla, but I'm not very adept with its query interface.

My hunch is that Orion's request dispatcher is invoked in two contexts (from a client, and from a forward) and does not distinguish between them when it comes to selecting a resource to respond to the client. If the dispatcher ignored mapping in the forward context and just accepted the specified resource, the recursion problem would vanish and the front servlet would trap ALL client requests as per the blueprint architecture. Just a hunch, things are probably not that simple.

Does anyone know if this is a problem with other webservers ? My experience with Apache was all static pages.

My environment is NT4(sp6), Orion 1.4.8, IE 5.00, JDK 1.2.2.

Also, if somebody is actually using the front servlet pattern and univeral mapping on Orion, and could let me know how to set it up and/or get around the recursion I'd be a happy camper.

TIA,

Bill.

Reply via email to