<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # JSPHTTP 狀態碼 HTTP請求與HTTP響應的格式相近,都有著如下結構: * 以狀態行+CRLF(回車換行)開始 * 零行或多行頭模塊+CRLF * 一個空行,比如CRLF * 可選的消息體比如文件,查詢數據,查詢輸出 舉例來說,一個服務器響應頭看起來就像下面這樣: ~~~ HTTP/1.1 200 OK Content-Type: text/html Header2: ... ... HeaderN: ... (Blank Line) <!doctype ...> <html> <head>...</head> <body> ... </body> </html> ~~~ 狀態行包含HTTP版本,一個狀態碼,和狀態碼相對應的短消息。 下表列出了可能會從服務器返回的HTTP狀態碼和與之關聯的消息: | **狀態碼** | **消息** | **描述** | | --- | --- | --- | | 100 | Continue | 只有一部分請求被服務器接收,但只要沒被服務器拒絕,客戶端就會延續這個請求 | | 101 | Switching Protocols | 服務器交換機協議 | | 200 | OK | 請求被確認 | | 201 | Created | 請求時完整的,新的資源被創建 | | 202 | Accepted | 請求被接受,但未處理完 | | 203 | Non-authoritative Information | ? | | 204 | No Content | ? | | 205 | Reset Content | ? | | 206 | Partial Content | ? | | 300 | Multiple Choices | 一個超鏈接表,用戶可以選擇一個超鏈接并訪問,最大支持5個超鏈接 | | 301 | Moved Permanently | 被請求的頁面已經移動到了新的URL下 | | 302 | Found | 被請求的頁面暫時性地移動到了新的URL下 | | 303 | See Other | 被請求的頁面可以在一個不同的URL下找到 | | 304 | Not Modified | ? | | 305 | Use Proxy | ? | | 306 | *Unused* | 已經不再使用此狀態碼,但狀態碼被保留 | | 307 | Temporary Redirect | 被請求的頁面暫時性地移動到了新的URL下 | | 400 | Bad Request | 服務器無法識別請求 | | 401 | Unauthorized | 被請求的頁面需要用戶名和密碼 | | 402 | Payment Required | *目前還不能使用此狀態碼* | | 403 | Forbidden | 禁止訪問所請求的頁面 | | 404 | Not Found | 服務器無法找到所請求的頁面 | | 405 | Method Not Allowed | 請求中所指定的方法不被允許 | | 406 | Not Acceptable | 服務器只能創建一個客戶端無法接受的響應 | | 407 | Proxy Authentication Required | 在請求被服務前必須認證一個代理服務器 | | 408 | Request Timeout | 請求時間超過了服務器所能等待的時間,連接被斷開 | | 409 | Conflict | 請求有矛盾的地方 | | 410 | Gone | 被請求的頁面不再可用 | | 411 | Length Required | "Content-Length"沒有被定義,服務器拒絕接受請求 | | 412 | Precondition Failed | 請求的前提條件被服務器評估為false | | 413 | Request Entity Too Large | 因為請求的實體太大,服務器拒絕接受請求 | | 414 | Request-url Too Long | 服務器拒絕接受請求,因為URL太長。多出現在把"POST"請求轉換為"GET"請求時所附帶的大量查詢信息 | | 415 | Unsupported Media Type | 服務器拒絕接受請求,因為媒體類型不被支持 | | 417 | Expectation Failed | ? | | 500 | Internal Server Error | 請求不完整,服務器遇見了出乎意料的狀況 | | 501 | Not Implemented | 請求不完整,服務器不提供所需要的功能 | | 502 | Bad Gateway | 請求不完整,服務器從上游服務器接受了一個無效的響應 | | 503 | Service Unavailable | 請求不完整,服務器暫時重啟或關閉 | | 504 | Gateway Timeout | 網關超時 | | 505 | HTTP Version Not Supported | 服務器不支持所指定的HTTP版本 | * * * ## 設置HTTP狀態碼的方法 下表列出了HttpServletResponse 類中用來設置狀態碼的方法: | **S.N.** | **方法****&****描述** | | --- | --- | | 1 | **public void setStatus ( int statusCode )** 此方法可以設置任意的狀態碼。如果您的響應包含一個特殊的狀態碼和一個文檔,請確保在用PrintWriter返回任何內容前調用setStatus方法 | | 2 | **public void sendRedirect(String url)** 此方法產生302響應,同時產生一個?*Location*?頭告訴URL 一個新的文檔 | | 3 | **public void sendError(int code, String message)** 此方法將一個狀態碼(通常為 404)和一個短消息,自動插入HTML文檔中并發回給客戶端 | * * * ## HTTP狀態碼程序示例 接下來的例子將會發送407錯誤碼給瀏覽器,然后瀏覽器將會告訴您"Need authentication!!!"。 ~~~ <html> <head> <title>Setting HTTP Status Code</title> </head> <body> <% // 設置錯誤代碼,并說明原因 response.sendError(407, "Need authentication!!!" ); %> </body> </html> ~~~ 訪問以上JSP頁面,將會得到以下結果: 您也可以試試使用其他的狀態碼,看會不會得到什么意想不到結果。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看