如何让WebLogic将某些文件作为JSP处理
我正在将 Java Web 应用程序从 OC4J 迁移到 WebLogic 11g。该应用程序包含以下 servlet 映射:
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*_dyn.txt</url-pattern>
</servlet-mapping>
这在 OC4J 中有效有两个原因:
- servlet 名称“jsp”自动映射到 JSP servlet
- OC4J 接受模式 *_dyn.txt,即使它不符合 servlet 标准。
我发现在 WebLogic 中,我可以通过添加以下内容将 servlet 名称“jsp”显式映射到 JSP servlet:
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>weblogic.servlet.JSPServlet</servlet-class>
</servlet>
如果我使用标准 URL 模式(如 /dyn/*)而不是非标准 URL 模式 *_dyn.txt,则此方法有效。已被 OC4J 接受。
我尝试使用 Tuckey 的 UrlRewriteFilter 来映射它,但这会导致 JSPServlet 类出现异常。
我的 UrlRewriteFilter 规则如下所示:
<rule match-type="wildcard">
<from>**/*_dyn.*</from>
<run class="weblogic.servlet.JSPServlet" method="service" />
</rule>
我得到的异常是这样的:
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 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)
谁能告诉我如何实现我的目标?
谢谢
马丁
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 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论