⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpservletresponse.html

📁 servlet-2_4-pfd3-doc.zip 您上载的源码为何会被站长不采用或帐号被删除?
💻 HTML
📖 第 1 页 / 共 5 页
字号:
			encodeRedirectURL(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="sendError(int, java.lang.String)"><!-- --></A><H3>sendError</H3><PRE>public void <B>sendError</B>(int&nbsp;sc,                      java.lang.String&nbsp;msg)               throws java.io.IOException</PRE><DL><DD>Sends an error response to the client using the specified status.  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>java.io.IOException - If an input or output exception occurs<DD>IllegalStateException - If the response was committed</DL></DD></DL><HR><A NAME="sendError(int)"><!-- --></A><H3>sendError</H3><PRE>public void <B>sendError</B>(int&nbsp;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>java.io.IOException - If an input or output exception occurs<DD>IllegalStateException - 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&nbsp;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>java.io.IOException - If an input or output exception occurs<DD>IllegalStateException - If the response was committed or if a partial URL is given and cannot be converted into a valid URL</DL></DD></DL><HR><A NAME="setDateHeader(java.lang.String, long)"><!-- --></A><H3>setDateHeader</H3><PRE>public void <B>setDateHeader</B>(java.lang.String&nbsp;name,                          long&nbsp;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&nbsp;name,                          long&nbsp;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&nbsp;name,                      java.lang.String&nbsp;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  If it contains octet string, 			it should be encoded according to RFC 2047 			(http://www.ietf.org/rfc/rfc2047.txt)<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&nbsp;name,                      java.lang.String&nbsp;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   If it contains 			octet string, it should be encoded 			according to RFC 2047 			(http://www.ietf.org/rfc/rfc2047.txt)<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&nbsp;name,                         int&nbsp;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&nbsp;name,                         int&nbsp;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&nbsp;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&nbsp;sc,                      java.lang.String&nbsp;sm)</PRE><DL><DD><B>Deprecated.</B>&nbsp;<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 ID="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../javax/servlet/http/HttpServletRequest.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<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>  &nbsp;&nbsp;<A HREF="HttpServletResponse.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -