当我在部署在 WebLogic 上的 J2EE Web 应用程序内进行重定向时,它会向客户端发送以下响应:
HTTP/1.1 302 Moved Temporarily
Cache-Control: no-cache="set-cookie"
Date: Sat, 12 Dec 2009 07:37:43 GMT
Transfer-Encoding: chunked
Location: http://server:port/front/page
Set-Cookie: JSESSIONID=CDdjLjLHSLlGxzzBT7dmLCw7JFZyBTxp95gJyxSL8GLS2gpNGKpb!1582307085; path=/
X-Powered-By: Servlet/2.4 JSP/2.0
01d7
<html><head><title>302 Moved Temporarily</title></head>
<body bgcolor="#FFFFFF">
<p>This document you requested has moved temporarily.</p>
<p>It's now at <a href="http://server:port/front/page">http://server:port/front/page</a>.</p>
</body></html>
0000
有没有办法覆盖该 HTML?
最佳答案
您可以使用应用程序的 web.xml 来覆盖它,例如:
<error-page>
<error-code>302</error-code>
<location>/error302.jsp</location>
</error-page>
编辑: 错误页面可能以以下内容开头:
<%@ page language="java" isErrorPage="true" %>
<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
...
问候。
关于java - 在 WebLogic 中覆盖 302 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1888032/