Disable JSP Extension Processing
I have a JavaEE 1.4 web application running on WebSphere Application Server 6.0. There web.xml
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 something ending in *.jsp
. In this case, the server tries to find a JSP with that name and fails with an 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 this request to be handled by a servlet, but it looks like the server is using multiple JSPExtensionProcessor
to handle all paths ending in .jsp
. Is there a way to change this behavior?
source to share
Yes, you need to map your servlet to * .jsp to get * .jsp support redirected to your servlet.
<servlet-mapping>
<servlet-name>name</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
It is generally a bad idea to access jsps directly. Putting them in WEB-INF in some directory, then mapping the corresponding url (.do, .action, etc.) to the servlet, which then redirects internally to that JSP, is best practice.
So, instead of typing thisUrl.jsp, the user will type thisUrl.do or thisUrl.action, and then they will be hit by the servlet to redirect to thisUrl.jsp.
source to share