使用BigIP时struts2的redirectAction结果出现问题
我正在使用 struts2 (2.1.6) 并希望从 Action1 重定向到 Action2。
struts.xml:
<action name="Action1" class="Action1">
<result name="success" type="redirectAction">Action2</result>
</action>
<action name="Action2" class="Action2">
<result name="success">/demo.jsp</result>
</action>
这按预期工作:http://myserver:9064/demo/Action1
重定向到http://myserver:9064/demo/Action2
(在 tomcat 和 websphere 上测试)。
但是,当我将应用程序置于 BigIP 后面时,redirectAction
不再按预期运行。
http://mybigip/demo/Action1
预计会重定向到 http://mybigip/demo/Action2
,而不是重定向到 http://mybigip :9064/demo/Action2
(请注意,我的应用程序的端口号已附加),这会出现 404 错误。我也得到了 type="redirect"
相同的结果。
任何解决这个问题的指针将不胜感激。
I am using struts2 (2.1.6) and want to redirect to Action2 from Action1.
struts.xml:
<action name="Action1" class="Action1">
<result name="success" type="redirectAction">Action2</result>
</action>
<action name="Action2" class="Action2">
<result name="success">/demo.jsp</result>
</action>
This works as expected: http://myserver:9064/demo/Action1
redirects to http://myserver:9064/demo/Action2
(tested on tomcat and websphere).
But when I put my app behind BigIP, redirectAction
no longer behaves as expected.
http://mybigip/demo/Action1
is expected to redirect to http://mybigip/demo/Action2
, instead it redirects to http://mybigip:9064/demo/Action2
(note that my app's port number gets appended) which gives a 404 error. I got same result for type="redirect"
also.
Any pointer to solve this issue would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了这个问题的解决方案。事实上,这种情况不仅仅发生在 Struts 上。通常,任何
Response.sendRedirect
或RequestDispatcher.forward
都会发生这种情况。此外,当应用程序部署在 WebSphere 中而不是 Tomcat 中时,会注意到此行为。以下链接提供了更多详细信息:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info /ae/ae/rweb_custom_props.html
(查找自定义属性
httpsIndicatorHeader
)另外:
I found the solution for this problem. In fact this is not happening just for Struts. It happens in general with any
Response.sendRedirect
orRequestDispatcher.forward
. Also, this behavior is noticed when the app is deployed in WebSphere and not when in Tomcat.The links below has more details:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rweb_custom_props.html
(look for the custom property
httpsIndicatorHeader
)Also: