📄 httpservletresponse.html
字号:
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletResponse.html#sendError(int)">sendError</A></B>(int sc)</CODE><BR> Sends an error response to the client using the specified status code and clearing the buffer.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletResponse.html#sendError(int, java.lang.String)">sendError</A></B>(int sc, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> msg)</CODE><BR> Sends an error response to the client using the specified status.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String)">sendRedirect</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> location)</CODE><BR> Sends a temporary redirect response to the client using the specified redirect location URL.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletResponse.html#setDateHeader(java.lang.String, long)">setDateHeader</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name, long date)</CODE><BR> Sets a response header with the given name and date-value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletResponse.html#setHeader(java.lang.String, java.lang.String)">setHeader</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> value)</CODE><BR> Sets a response header with the given name and value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletResponse.html#setIntHeader(java.lang.String, int)">setIntHeader</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name, int value)</CODE><BR> Sets a response header with the given name and integer value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletResponse.html#setStatus(int)">setStatus</A></B>(int sc)</CODE><BR> Sets the status code for this response.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/servlet/http/HttpServletResponse.html#setStatus(int, java.lang.String)">setStatus</A></B>(int sc, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> sm)</CODE><BR> <B>Deprecated.</B> <I>As of version 2.1, due to ambiguous meaning of the message parameter. To set a status code use <code>setStatus(int)</code>, to send an error with a description use <code>sendError(int, String)</code>. Sets the status code and message for this response.</I></TD></TR></TABLE> <A NAME="methods_inherited_from_class_javax.servlet.ServletResponse"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from interface javax.servlet.<A HREF="../../../javax/servlet/ServletResponse.html" title="interface in javax.servlet">ServletResponse</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../javax/servlet/ServletResponse.html#flushBuffer()">flushBuffer</A>, <A HREF="../../../javax/servlet/ServletResponse.html#getBufferSize()">getBufferSize</A>, <A HREF="../../../javax/servlet/ServletResponse.html#getCharacterEncoding()">getCharacterEncoding</A>, <A HREF="../../../javax/servlet/ServletResponse.html#getContentType()">getContentType</A>, <A HREF="../../../javax/servlet/ServletResponse.html#getLocale()">getLocale</A>, <A HREF="../../../javax/servlet/ServletResponse.html#getOutputStream()">getOutputStream</A>, <A HREF="../../../javax/servlet/ServletResponse.html#getWriter()">getWriter</A>, <A HREF="../../../javax/servlet/ServletResponse.html#isCommitted()">isCommitted</A>, <A HREF="../../../javax/servlet/ServletResponse.html#reset()">reset</A>, <A HREF="../../../javax/servlet/ServletResponse.html#resetBuffer()">resetBuffer</A>, <A HREF="../../../javax/servlet/ServletResponse.html#setBufferSize(int)">setBufferSize</A>, <A HREF="../../../javax/servlet/ServletResponse.html#setCharacterEncoding(java.lang.String)">setCharacterEncoding</A>, <A HREF="../../../javax/servlet/ServletResponse.html#setContentLength(int)">setContentLength</A>, <A HREF="../../../javax/servlet/ServletResponse.html#setContentType(java.lang.String)">setContentType</A>, <A HREF="../../../javax/servlet/ServletResponse.html#setLocale(java.util.Locale)">setLocale</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Field Detail</B></FONT></TH></TR></TABLE><A NAME="SC_CONTINUE"><!-- --></A><H3>SC_CONTINUE</H3><PRE>static final int <B>SC_CONTINUE</B></PRE><DL><DD>Status code (100) indicating the client can continue.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_CONTINUE">Constant Field Values</A></DL></DL><HR><A NAME="SC_SWITCHING_PROTOCOLS"><!-- --></A><H3>SC_SWITCHING_PROTOCOLS</H3><PRE>static final int <B>SC_SWITCHING_PROTOCOLS</B></PRE><DL><DD>Status code (101) indicating the server is switching protocols according to Upgrade header.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_SWITCHING_PROTOCOLS">Constant Field Values</A></DL></DL><HR><A NAME="SC_OK"><!-- --></A><H3>SC_OK</H3><PRE>static final int <B>SC_OK</B></PRE><DL><DD>Status code (200) indicating the request succeeded normally.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_OK">Constant Field Values</A></DL></DL><HR><A NAME="SC_CREATED"><!-- --></A><H3>SC_CREATED</H3><PRE>static final int <B>SC_CREATED</B></PRE><DL><DD>Status code (201) indicating the request succeeded and created a new resource on the server.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_CREATED">Constant Field Values</A></DL></DL><HR><A NAME="SC_ACCEPTED"><!-- --></A><H3>SC_ACCEPTED</H3><PRE>static final int <B>SC_ACCEPTED</B></PRE><DL><DD>Status code (202) indicating that a request was accepted for processing, but was not completed.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_ACCEPTED">Constant Field Values</A></DL></DL><HR><A NAME="SC_NON_AUTHORITATIVE_INFORMATION"><!-- --></A><H3>SC_NON_AUTHORITATIVE_INFORMATION</H3><PRE>static final int <B>SC_NON_AUTHORITATIVE_INFORMATION</B></PRE><DL><DD>Status code (203) indicating that the meta information presented by the client did not originate from the server.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_NON_AUTHORITATIVE_INFORMATION">Constant Field Values</A></DL></DL><HR><A NAME="SC_NO_CONTENT"><!-- --></A><H3>SC_NO_CONTENT</H3><PRE>static final int <B>SC_NO_CONTENT</B></PRE><DL><DD>Status code (204) indicating that the request succeeded but that there was no new information to return.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_NO_CONTENT">Constant Field Values</A></DL></DL><HR><A NAME="SC_RESET_CONTENT"><!-- --></A><H3>SC_RESET_CONTENT</H3><PRE>static final int <B>SC_RESET_CONTENT</B></PRE><DL><DD>Status code (205) indicating that the agent <em>SHOULD</em> reset the document view which caused the request to be sent.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_RESET_CONTENT">Constant Field Values</A></DL></DL><HR><A NAME="SC_PARTIAL_CONTENT"><!-- --></A><H3>SC_PARTIAL_CONTENT</H3><PRE>static final int <B>SC_PARTIAL_CONTENT</B></PRE><DL><DD>Status code (206) indicating that the server has fulfilled the partial GET request for the resource.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_PARTIAL_CONTENT">Constant Field Values</A></DL></DL><HR><A NAME="SC_MULTIPLE_CHOICES"><!-- --></A><H3>SC_MULTIPLE_CHOICES</H3><PRE>static final int <B>SC_MULTIPLE_CHOICES</B></PRE><DL><DD>Status code (300) indicating that the requested resource corresponds to any one of a set of representations, each with its own specific location.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_MULTIPLE_CHOICES">Constant Field Values</A></DL></DL><HR><A NAME="SC_MOVED_PERMANENTLY"><!-- --></A><H3>SC_MOVED_PERMANENTLY</H3><PRE>static final int <B>SC_MOVED_PERMANENTLY</B></PRE><DL><DD>Status code (301) indicating that the resource has permanently moved to a new location, and that future references should use a new URI with their requests.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_MOVED_PERMANENTLY">Constant Field Values</A></DL></DL><HR><A NAME="SC_MOVED_TEMPORARILY"><!-- --></A><H3>SC_MOVED_TEMPORARILY</H3><PRE>static final int <B>SC_MOVED_TEMPORARILY</B></PRE><DL><DD>Status code (302) indicating that the resource has temporarily moved to another location, but that future references should still use the original URI to access the resource. This definition is being retained for backwards compatibility. SC_FOUND is now the preferred definition.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_MOVED_TEMPORARILY">Constant Field Values</A></DL></DL><HR><A NAME="SC_FOUND"><!-- --></A><H3>SC_FOUND</H3><PRE>static final int <B>SC_FOUND</B></PRE><DL><DD>Status code (302) indicating that the resource reside 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.(HTTP/1.1) To represent the status code (302), it is recommended to use this variable.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_FOUND">Constant Field Values</A></DL></DL><HR><A NAME="SC_SEE_OTHER"><!-- --></A><H3>SC_SEE_OTHER</H3><PRE>static final int <B>SC_SEE_OTHER</B></PRE><DL><DD>Status code (303) indicating that the response to the request can be found under a different URI.<P><DL><DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.servlet.http.HttpServletResponse.SC_SEE_OTHER">Constant Field Values</A></DL></DL><HR><A NAME="SC_NOT_MODIFIED"><!-- --></A><H3>SC_NOT_MODIFIED</H3><PRE>static final int <B>SC_NOT_MODIFIED</B></PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -