這個就是表示 重定向!! 不過,302在不同HTTP協議下的狀態信息不同。
302 Moved temporarily (redirect) 你所連接的頁面進行了Redirect 302 Found 類似於301,但新的URL應該被視為臨時性的替代,而不是永久性的。注意,在HTTP1.0中對應的狀態信息是“Moved Temporatily”,而HttpServletResponse中相應的常量是SC_MOVED_TEMPORARILY,而不是SC_FOUND。出現該狀態代碼時,瀏覽器能夠自動訪問新的URL,因此它是一個很有用的狀態代碼。為此,Servlet提供了一個專用的方法,即sendRedirect。使用response.sendRedirect(url)比使用response.setStatus(response.SC_MOVED_TEMPORARILY)和response.setHeader("Location",url)更好。這是因為: 首先,代碼更加簡潔。 第二,使用sendRedirect,Servlet會自動構造一個包含新鏈接的頁面(用於那些不能自動重定向的老式瀏覽器)。 最后,sendRedirect能夠處理相對URL,自動把它們轉換成絕對URL。 注意這個狀態代碼有時候可以和301替換使用。例如,如果瀏覽器錯誤地請求http://host/~user(缺少了后面的斜杠),有的服務器返回301,有的則返回302。 嚴格地說,我們只能假定只有當原來的請求是GET時瀏覽器才會自動重定向。 參考資料: http://zhidao.baidu.com/question/16119833.html?si=4
http://segmentfault.com/q/1010000000094621
二者在不同HTTP協議下的狀態信息不同。 在HTTP/1.0 302 狀態為 Moved Temporarily The requested resource resides temporarily under a different URL. Since the redirection may be altered on occasion, the client should continue to use the Request-URI for future requests. 在HTTP/1.1 302 狀態為 Found The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.
