📄 httpservletresponse.html
字号:
<DD>Status code (405) indicating that the method specified in the <code><em>Request-Line</em></code> is not allowed for the resource identified by the <code><em>Request-URI</em></code>.</DL><HR><A NAME="SC_NOT_ACCEPTABLE"><!-- --></A><H3>SC_NOT_ACCEPTABLE</H3><PRE>public static final int <B>SC_NOT_ACCEPTABLE</B></PRE><DL><DD>Status code (406) indicating that the resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headerssent in the request.</DL><HR><A NAME="SC_PROXY_AUTHENTICATION_REQUIRED"><!-- --></A><H3>SC_PROXY_AUTHENTICATION_REQUIRED</H3><PRE>public static final int <B>SC_PROXY_AUTHENTICATION_REQUIRED</B></PRE><DL><DD>Status code (407) indicating that the client <em>MUST</em> first authenticate itself with the proxy.</DL><HR><A NAME="SC_REQUEST_TIMEOUT"><!-- --></A><H3>SC_REQUEST_TIMEOUT</H3><PRE>public static final int <B>SC_REQUEST_TIMEOUT</B></PRE><DL><DD>Status code (408) indicating that the client did not produce a requestwithin the time that the server was prepared to wait.</DL><HR><A NAME="SC_CONFLICT"><!-- --></A><H3>SC_CONFLICT</H3><PRE>public static final int <B>SC_CONFLICT</B></PRE><DL><DD>Status code (409) indicating that the request could not be completed due to a conflict with the current state of the resource.</DL><HR><A NAME="SC_GONE"><!-- --></A><H3>SC_GONE</H3><PRE>public static final int <B>SC_GONE</B></PRE><DL><DD>Status code (410) indicating that the resource is no longer available at the server and no forwarding address is known. This condition <em>SHOULD</em> be considered permanent.</DL><HR><A NAME="SC_LENGTH_REQUIRED"><!-- --></A><H3>SC_LENGTH_REQUIRED</H3><PRE>public static final int <B>SC_LENGTH_REQUIRED</B></PRE><DL><DD>Status code (411) indicating that the request cannot be handled without a defined <code><em>Content-Length</em></code>.</DL><HR><A NAME="SC_PRECONDITION_FAILED"><!-- --></A><H3>SC_PRECONDITION_FAILED</H3><PRE>public static final int <B>SC_PRECONDITION_FAILED</B></PRE><DL><DD>Status code (412) indicating that the precondition given in one or more of the request-header fields evaluated to false when it was tested on the server.</DL><HR><A NAME="SC_REQUEST_ENTITY_TOO_LARGE"><!-- --></A><H3>SC_REQUEST_ENTITY_TOO_LARGE</H3><PRE>public static final int <B>SC_REQUEST_ENTITY_TOO_LARGE</B></PRE><DL><DD>Status code (413) indicating that the server is refusing to process the request because the request entity is larger than the server is willing or able to process.</DL><HR><A NAME="SC_REQUEST_URI_TOO_LONG"><!-- --></A><H3>SC_REQUEST_URI_TOO_LONG</H3><PRE>public static final int <B>SC_REQUEST_URI_TOO_LONG</B></PRE><DL><DD>Status code (414) indicating that the server is refusing to service the request because the <code><em>Request-URI</em></code> is longer than the server is willing to interpret.</DL><HR><A NAME="SC_UNSUPPORTED_MEDIA_TYPE"><!-- --></A><H3>SC_UNSUPPORTED_MEDIA_TYPE</H3><PRE>public static final int <B>SC_UNSUPPORTED_MEDIA_TYPE</B></PRE><DL><DD>Status code (415) indicating that the server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.</DL><HR><A NAME="SC_REQUESTED_RANGE_NOT_SATISFIABLE"><!-- --></A><H3>SC_REQUESTED_RANGE_NOT_SATISFIABLE</H3><PRE>public static final int <B>SC_REQUESTED_RANGE_NOT_SATISFIABLE</B></PRE><DL><DD>Status code (416) indicating that the server cannot serve the requested byte range.</DL><HR><A NAME="SC_EXPECTATION_FAILED"><!-- --></A><H3>SC_EXPECTATION_FAILED</H3><PRE>public static final int <B>SC_EXPECTATION_FAILED</B></PRE><DL><DD>Status code (417) indicating that the server could not meet the expectation given in the Expect request header.</DL><HR><A NAME="SC_INTERNAL_SERVER_ERROR"><!-- --></A><H3>SC_INTERNAL_SERVER_ERROR</H3><PRE>public static final int <B>SC_INTERNAL_SERVER_ERROR</B></PRE><DL><DD>Status code (500) indicating an error inside the HTTP server which prevented it from fulfilling the request.</DL><HR><A NAME="SC_NOT_IMPLEMENTED"><!-- --></A><H3>SC_NOT_IMPLEMENTED</H3><PRE>public static final int <B>SC_NOT_IMPLEMENTED</B></PRE><DL><DD>Status code (501) indicating the HTTP server does not support the functionality needed to fulfill the request.</DL><HR><A NAME="SC_BAD_GATEWAY"><!-- --></A><H3>SC_BAD_GATEWAY</H3><PRE>public static final int <B>SC_BAD_GATEWAY</B></PRE><DL><DD>Status code (502) indicating that the HTTP server received an invalid response from a server it consulted when acting as a proxy or gateway.</DL><HR><A NAME="SC_SERVICE_UNAVAILABLE"><!-- --></A><H3>SC_SERVICE_UNAVAILABLE</H3><PRE>public static final int <B>SC_SERVICE_UNAVAILABLE</B></PRE><DL><DD>Status code (503) indicating that the HTTP server is temporarily overloaded, and unable to handle the request.</DL><HR><A NAME="SC_GATEWAY_TIMEOUT"><!-- --></A><H3>SC_GATEWAY_TIMEOUT</H3><PRE>public static final int <B>SC_GATEWAY_TIMEOUT</B></PRE><DL><DD>Status code (504) indicating that the server did not receive a timely response from the upstream server while acting as a gateway or proxy.</DL><HR><A NAME="SC_HTTP_VERSION_NOT_SUPPORTED"><!-- --></A><H3>SC_HTTP_VERSION_NOT_SUPPORTED</H3><PRE>public static final int <B>SC_HTTP_VERSION_NOT_SUPPORTED</B></PRE><DL><DD>Status code (505) indicating that the server does not support or refuses to support the HTTP protocol version that was used in the request message.</DL><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="addCookie(javax.servlet.http.Cookie)"><!-- --></A><H3>addCookie</H3><PRE>public void <B>addCookie</B>(<A HREF="../../../javax/servlet/http/Cookie.html">Cookie</A> cookie)</PRE><DL><DD>Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>cookie</CODE> - the Cookie to return to the client</DL></DD></DL><HR><A NAME="containsHeader(java.lang.String)"><!-- --></A><H3>containsHeader</H3><PRE>public boolean <B>containsHeader</B>(java.lang.String name)</PRE><DL><DD>Returns a boolean indicating whether the named response header has already been set.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the header name<DT><B>Returns:</B><DD><code>true</code> if the named response header has already been set; <code>false</code> otherwise</DL></DD></DL><HR><A NAME="encodeURL(java.lang.String)"><!-- --></A><H3>encodeURL</H3><PRE>public java.lang.String <B>encodeURL</B>(java.lang.String url)</PRE><DL><DD>Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary. <p>For robust session tracking, all URLs emitted by a servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>url</CODE> - the url to be encoded.<DT><B>Returns:</B><DD>the encoded URL if encoding is needed; the unchanged URL otherwise.</DL></DD></DL><HR><A NAME="encodeRedirectURL(java.lang.String)"><!-- --></A><H3>encodeRedirectURL</H3><PRE>public java.lang.String <B>encodeRedirectURL</B>(java.lang.String url)</PRE><DL><DD>Encodes the specified URL for use in the <code>sendRedirect</code> method or, if encoding is not needed, returns the URL unchanged. The implementation of this method includes the logic to determine whether the session ID needs to be encoded in the URL. Because the rules for making this determination can differ from those used to decide whether to encode a normal link, this method is seperate from the <code>encodeURL</code> method. <p>All URLs sent to the <code>HttpServletResponse.sendRedirect</code> method should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>url</CODE> - the url to be encoded.<DT><B>Returns:</B><DD>the encoded URL if encoding is needed; the unchanged URL otherwise.<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String)"><CODE>sendRedirect(java.lang.String)</CODE></A>, <A HREF="../../../javax/servlet/http/HttpServletResponse.html#encodeUrl(java.lang.String)"><CODE>encodeUrl(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="encodeUrl(java.lang.String)"><!-- --></A><H3>encodeUrl</H3><PRE>public java.lang.String <B>encodeUrl</B>(java.lang.String url)</PRE><DL><DD><B>Deprecated.</B> <I>As of version 2.1, use encodeURL(String url) instead</I><P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>url</CODE> - the url to be encoded.<DT><B>Returns:</B><DD>the encoded URL if encoding is needed; the unchanged URL otherwise.</DL></DD></DL><HR><A NAME="encodeRedirectUrl(java.lang.String)"><!-- --></A><H3>encodeRedirectUrl</H3><PRE>public java.lang.String <B>encodeRedirectUrl</B>(java.lang.String url)</PRE><DL><DD><B>Deprecated.</B> <I>As of version 2.1, use
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -