How to get WebLogic to process certain files as JSP
I am migrating a java web application from OC4J to WebLogic 11g. The application contains the following servlet mapping:
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*_dyn.txt</url-pattern>
</servlet-mapping>
This works in OC4J for two reasons:
- the servlet name "jsp" is automatically mapped to the JSP servlet - OC4J accepts the pattern *_dyn.txt even though it does not conform with the servlet standard.I discovered in WebLogic I can explicitly map the servlet name "jsp" to the JSP servlet by adding the following:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>weblogic.servlet.JSPServlet</servlet-class>
</servlet>
This works if I use a standard URL pattern such as /dyn/* but not the non-standard URL pattern *_dyn.txt that was accepted by OC4J.
I have tried using Tuckey's UrlRewriteFilter to map it instead, but this results in an exception in the JSPServlet class.
My UrlRewriteFilter rule looks like this:
<rule match-type="wildcard">
<from>**/*_dyn.*</from>
<run class="weblogic.servlet.JSPServlet" method="service" />
</rule>
The exception I get is this:
Error 500--Internal Server Error
[AddToMap: pattern=/bla/test_dyn.txt class=jsp_servlet._bla.__test_dyn_txt]
at weblogic.servlet.JSPServlet.service(JSPServlet.java:220)
at开发者_如何学Go javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.tuckey.web.filters.urlrewrite.Run.invokeRunMethod(Run.java:416)
Can anyone tell me how I can achieve my goal?
Thanks
Martin
精彩评论