httpservletresponse.html
来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 1,446 行 · 第 1/5 页
HTML
1,446 行
<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="sendError(int, java.lang.String)"><!-- --></A><H3>
sendError</H3>
<PRE>
public void <B>sendError</B>(int sc,
java.lang.String msg)
throws java.io.IOException</PRE>
<DL>
<DD>Sends an error response to the client using the specified
status clearing the buffer. The server defaults to creating the
response to look like an HTML-formatted server error page containing the specified message, setting the content type
to "text/html", leaving cookies and other headers unmodified.
If an error-page declaration has been made for the web application
corresponding to the status code passed in, it will be served back in
preference to the suggested msg parameter.
<p>If the response has already been committed, this method throws
an IllegalStateException.
After using this method, the response should be considered
to be committed and should not be written to.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>sc</CODE> - the error status code<DD><CODE>msg</CODE> - the descriptive message<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - If an input or output exception occurs<DD><CODE>java.lang.IllegalStateException</CODE> - If the response was committed</DL>
</DD>
</DL>
<HR>
<A NAME="sendError(int)"><!-- --></A><H3>
sendError</H3>
<PRE>
public void <B>sendError</B>(int sc)
throws java.io.IOException</PRE>
<DL>
<DD>Sends an error response to the client using the specified status
code and clearing the buffer.
<p>If the response has already been committed, this method throws
an IllegalStateException.
After using this method, the response should be considered
to be committed and should not be written to.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>sc</CODE> - the error status code<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - If an input or output exception occurs<DD><CODE>java.lang.IllegalStateException</CODE> - If the response was committed
before this method call</DL>
</DD>
</DL>
<HR>
<A NAME="sendRedirect(java.lang.String)"><!-- --></A><H3>
sendRedirect</H3>
<PRE>
public void <B>sendRedirect</B>(java.lang.String location)
throws java.io.IOException</PRE>
<DL>
<DD>Sends a temporary redirect response to the client using the
specified redirect location URL. This method can accept relative URLs;
the servlet container must convert the relative URL to an absolute URL
before sending the response to the client. If the location is relative
without a leading '/' the container interprets it as relative to
the current request URI. If the location is relative with a leading
'/' the container interprets it as relative to the servlet container root.
<p>If the response has already been committed, this method throws
an IllegalStateException.
After using this method, the response should be considered
to be committed and should not be written to.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>location</CODE> - the redirect location URL<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - If an input or output exception occurs<DD><CODE>java.lang.IllegalStateException</CODE> - If the response was committed</DL>
</DD>
</DL>
<HR>
<A NAME="setDateHeader(java.lang.String, long)"><!-- --></A><H3>
setDateHeader</H3>
<PRE>
public void <B>setDateHeader</B>(java.lang.String name,
long date)</PRE>
<DL>
<DD>Sets a response header with the given name and
date-value. The date is specified in terms of
milliseconds since the epoch. If the header had already
been set, the new value overwrites the previous one. The
<code>containsHeader</code> method can be used to test for the
presence of a header before setting its value.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header to set<DD><CODE>value</CODE> - the assigned date value<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/http/HttpServletResponse.html#containsHeader(java.lang.String)"><CODE>containsHeader(java.lang.String)</CODE></A>,
<A HREF="../../../javax/servlet/http/HttpServletResponse.html#addDateHeader(java.lang.String, long)"><CODE>addDateHeader(java.lang.String, long)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="addDateHeader(java.lang.String, long)"><!-- --></A><H3>
addDateHeader</H3>
<PRE>
public void <B>addDateHeader</B>(java.lang.String name,
long date)</PRE>
<DL>
<DD>Adds a response header with the given name and
date-value. The date is specified in terms of
milliseconds since the epoch. This method allows response headers
to have multiple values.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header to set<DD><CODE>value</CODE> - the additional date value<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/http/HttpServletResponse.html#setDateHeader(java.lang.String, long)"><CODE>setDateHeader(java.lang.String, long)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setHeader(java.lang.String, java.lang.String)"><!-- --></A><H3>
setHeader</H3>
<PRE>
public void <B>setHeader</B>(java.lang.String name,
java.lang.String value)</PRE>
<DL>
<DD>Sets a response header with the given name and value.
If the header had already been set, the new value overwrites the
previous one. The <code>containsHeader</code> method can be
used to test for the presence of a header before setting its
value.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header<DD><CODE>value</CODE> - the header value<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/http/HttpServletResponse.html#containsHeader(java.lang.String)"><CODE>containsHeader(java.lang.String)</CODE></A>,
<A HREF="../../../javax/servlet/http/HttpServletResponse.html#addHeader(java.lang.String, java.lang.String)"><CODE>addHeader(java.lang.String, java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="addHeader(java.lang.String, java.lang.String)"><!-- --></A><H3>
addHeader</H3>
<PRE>
public void <B>addHeader</B>(java.lang.String name,
java.lang.String value)</PRE>
<DL>
<DD>Adds a response header with the given name and value.
This method allows response headers to have multiple values.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header<DD><CODE>value</CODE> - the additional header value<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/http/HttpServletResponse.html#setHeader(java.lang.String, java.lang.String)"><CODE>setHeader(java.lang.String, java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setIntHeader(java.lang.String, int)"><!-- --></A><H3>
setIntHeader</H3>
<PRE>
public void <B>setIntHeader</B>(java.lang.String name,
int value)</PRE>
<DL>
<DD>Sets a response header with the given name and
integer value. If the header had already been set, the new value
overwrites the previous one. The <code>containsHeader</code>
method can be used to test for the presence of a header before
setting its value.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header<DD><CODE>value</CODE> - the assigned integer value<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/http/HttpServletResponse.html#containsHeader(java.lang.String)"><CODE>containsHeader(java.lang.String)</CODE></A>,
<A HREF="../../../javax/servlet/http/HttpServletResponse.html#addIntHeader(java.lang.String, int)"><CODE>addIntHeader(java.lang.String, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="addIntHeader(java.lang.String, int)"><!-- --></A><H3>
addIntHeader</H3>
<PRE>
public void <B>addIntHeader</B>(java.lang.String name,
int value)</PRE>
<DL>
<DD>Adds a response header with the given name and
integer value. This method allows response headers to have multiple
values.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the header<DD><CODE>value</CODE> - the assigned integer value<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/http/HttpServletResponse.html#setIntHeader(java.lang.String, int)"><CODE>setIntHeader(java.lang.String, int)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setStatus(int)"><!-- --></A><H3>
setStatus</H3>
<PRE>
public void <B>setStatus</B>(int sc)</PRE>
<DL>
<DD>Sets the status code for this response. This method is used to
set the return status code when there is no error (for example,
for the status codes SC_OK or SC_MOVED_TEMPORARILY). If there
is an error, and the caller wishes to invoke an <error-page> defined
in the web applicaion, the <code>sendError</code> method should be used
instead.
<p> The container clears the buffer and sets the Location header, preserving
cookies and other headers.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>sc</CODE> - the status code<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/http/HttpServletResponse.html#sendError(int, java.lang.String)"><CODE>sendError(int, java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setStatus(int, java.lang.String)"><!-- --></A><H3>
setStatus</H3>
<PRE>
public void <B>setStatus</B>(int sc,
java.lang.String sm)</PRE>
<DL>
<DD><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>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>sc</CODE> - the status code<DD><CODE>sm</CODE> - the status message</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../javax/servlet/http/HttpServletRequest.html"><B>PREV CLASS</B></A>
<A HREF="../../../javax/servlet/http/HttpSession.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="HttpServletResponse.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?