views:

449

answers:

1

I have a JavaEE 1.4 web application running on WebSphere Application Server 6.0. In web.xml, there is a servlet configured to intercept all server requests:

<servlet-mapping>
 <servlet-name>name</servlet-name>
 <url-pattern>/*</url-pattern>
</servlet-mapping>

This works fine until I try to request something ending with *.jsp. In this case, server tries to find JSP with this name and fails with the error:

java.io.FileNotFoundException: JSPG0036E: Failed to find resource /cfvct/search_criteria.jsp
    at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.findWrapper(JSPExtensionProcessor.java:279)
    at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:261)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3226)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:253)
    at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:229)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1970)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:120)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:434)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:373)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:253)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1475)

I need to have this request processed by the servlet, but seems server uses some JSPExtensionProcessor to process all paths ending with .jsp. Is there any way to change this behaviour?

+2  A: 

Yes, you'll need to map your servlet to *.jsp in order to get *.jsp support redirected to your servlet.

<servlet-mapping>
        <servlet-name>name</servlet-name>
        <url-pattern>*.jsp</url-pattern>
</servlet-mapping>

It is normally a bad idea to have jsps accessible directly, however. Placing them in WEB-INF in some directory, then mapping an appropriate url (.do, .action, etc) to a servlet that then redirects internally to that JSP is the better practice.

So instead of typing thisUrl.jsp, the user would type thisUrl.do or thisUrl.action, and it would then get hit by the servlet to redirect to thisUrl.jsp.

MetroidFan2002
That works perfectly, thanks.
Das