httpservlet.html

来自「SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的」· HTML 代码 · 共 746 行 · 第 1/3 页

HTML
746
字号
                     java.io.IOException</PRE>
<DL>
<DD>Called by the server (via the <code>service</code> method)
 to allow a servlet to handle a PUT request.

 The PUT operation allows a client to 
 place a file on the server and is similar to 
 sending a file by FTP.

 <p>When overriding this method, leave intact
 any content headers sent with the request (including
 Content-Length, Content-Type, Content-Transfer-Encoding,
 Content-Encoding, Content-Base, Content-Language, Content-Location,
 Content-MD5, and Content-Range). If your method cannot
 handle a content header, it must issue an error message
 (HTTP 501 - Not Implemented) and discard the request.
 For more information on HTTP 1.1, see RFC 2068
 <a href="http://info.internet.isi.edu:80/in-notes/rfc/files/rfc2068.txt"></a>.

 <p>This method does not need to be either safe or idempotent.
 Operations that <code>doPut</code> performs can have side
 effects for which the user can be held accountable. When using
 this method, it may be useful to save a copy of the
 affected URL in temporary storage.

 <p>If the HTTP PUT request is incorrectly formatted,
 <code>doPut</code> returns an HTTP "Bad Request" message.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>req</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletRequest.html"><CODE>HttpServletRequest</CODE></A> object that
			contains the request the client made of
			the servlet<DD><CODE>resp</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletResponse.html"><CODE>HttpServletResponse</CODE></A> object that
			contains the response the servlet returns
			to the client<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an input or output error occurs
				while the servlet is handling the
				PUT request<DD><CODE><A HREF="../../../javax/servlet/ServletException.html">ServletException</A></CODE> - if the request for the PUT
					cannot be handled</DL>
</DD>
</DL>
<HR>

<A NAME="doDelete(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
doDelete</H3>
<PRE>
protected void <B>doDelete</B>(<A HREF="../../../javax/servlet/http/HttpServletRequest.html">HttpServletRequest</A>&nbsp;req,
                        <A HREF="../../../javax/servlet/http/HttpServletResponse.html">HttpServletResponse</A>&nbsp;resp)
                 throws <A HREF="../../../javax/servlet/ServletException.html">ServletException</A>,
                        java.io.IOException</PRE>
<DL>
<DD>Called by the server (via the <code>service</code> method)
 to allow a servlet to handle a DELETE request.

 The DELETE operation allows a client to remove a document
 or Web page from the server.
 
 <p>This method does not need to be either safe
 or idempotent. Operations requested through
 DELETE can have side effects for which users
 can be held accountable. When using
 this method, it may be useful to save a copy of the
 affected URL in temporary storage.

 <p>If the HTTP DELETE request is incorrectly formatted,
 <code>doDelete</code> returns an HTTP "Bad Request"
 message.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>req</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletRequest.html"><CODE>HttpServletRequest</CODE></A> object that
			contains the request the client made of
			the servlet<DD><CODE>resp</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletResponse.html"><CODE>HttpServletResponse</CODE></A> object that
			contains the response the servlet returns
			to the client<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an input or output error occurs
				while the servlet is handling the
				DELETE request<DD><CODE><A HREF="../../../javax/servlet/ServletException.html">ServletException</A></CODE> - if the request for the
					DELETE cannot be handled</DL>
</DD>
</DL>
<HR>

<A NAME="doOptions(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
doOptions</H3>
<PRE>
protected void <B>doOptions</B>(<A HREF="../../../javax/servlet/http/HttpServletRequest.html">HttpServletRequest</A>&nbsp;req,
                         <A HREF="../../../javax/servlet/http/HttpServletResponse.html">HttpServletResponse</A>&nbsp;resp)
                  throws <A HREF="../../../javax/servlet/ServletException.html">ServletException</A>,
                         java.io.IOException</PRE>
<DL>
<DD>Called by the server (via the <code>service</code> method)
 to allow a servlet to handle a OPTIONS request.

 The OPTIONS request determines which HTTP methods 
 the server supports and
 returns an appropriate header. For example, if a servlet
 overrides <code>doGet</code>, this method returns the
 following header:

 <p><code>Allow: GET, HEAD, TRACE, OPTIONS</code>

 <p>There's no need to override this method unless the
 servlet implements new HTTP methods, beyond those 
 implemented by HTTP 1.1.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>req</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletRequest.html"><CODE>HttpServletRequest</CODE></A> object that
			contains the request the client made of
			the servlet<DD><CODE>resp</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletResponse.html"><CODE>HttpServletResponse</CODE></A> object that
			contains the response the servlet returns
			to the client<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an input or output error occurs
				while the servlet is handling the
				OPTIONS request<DD><CODE><A HREF="../../../javax/servlet/ServletException.html">ServletException</A></CODE> - if the request for the
					OPTIONS cannot be handled</DL>
</DD>
</DL>
<HR>

<A NAME="doTrace(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
doTrace</H3>
<PRE>
protected void <B>doTrace</B>(<A HREF="../../../javax/servlet/http/HttpServletRequest.html">HttpServletRequest</A>&nbsp;req,
                       <A HREF="../../../javax/servlet/http/HttpServletResponse.html">HttpServletResponse</A>&nbsp;resp)
                throws <A HREF="../../../javax/servlet/ServletException.html">ServletException</A>,
                       java.io.IOException</PRE>
<DL>
<DD>Called by the server (via the <code>service</code> method)
 to allow a servlet to handle a TRACE request.

 A TRACE returns the headers sent with the TRACE
 request to the client, so that they can be used in
 debugging. There's no need to override this method.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>req</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletRequest.html"><CODE>HttpServletRequest</CODE></A> object that
			contains the request the client made of
			the servlet<DD><CODE>resp</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletResponse.html"><CODE>HttpServletResponse</CODE></A> object that
			contains the response the servlet returns
			to the client<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an input or output error occurs
				while the servlet is handling the
				TRACE request<DD><CODE><A HREF="../../../javax/servlet/ServletException.html">ServletException</A></CODE> - if the request for the
					TRACE cannot be handled</DL>
</DD>
</DL>
<HR>

<A NAME="service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>
service</H3>
<PRE>
protected void <B>service</B>(<A HREF="../../../javax/servlet/http/HttpServletRequest.html">HttpServletRequest</A>&nbsp;req,
                       <A HREF="../../../javax/servlet/http/HttpServletResponse.html">HttpServletResponse</A>&nbsp;resp)
                throws <A HREF="../../../javax/servlet/ServletException.html">ServletException</A>,
                       java.io.IOException</PRE>
<DL>
<DD>Receives standard HTTP requests from the public
 <code>service</code> method and dispatches
 them to the <code>do</code><i>XXX</i> methods defined in 
 this class. This method is an HTTP-specific version of the 
 <A HREF="../../../javax/servlet/Servlet.html#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)"><CODE>Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)</CODE></A> method. There's no
 need to override this method.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>req</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletRequest.html"><CODE>HttpServletRequest</CODE></A> object that
			contains the request the client made of
			the servlet<DD><CODE>resp</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletResponse.html"><CODE>HttpServletResponse</CODE></A> object that
			contains the response the servlet returns
			to the client<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an input or output error occurs
				while the servlet is handling the
				TRACE request<DD><CODE><A HREF="../../../javax/servlet/ServletException.html">ServletException</A></CODE> - if the request for the
					TRACE cannot be handled<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/Servlet.html#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)"><CODE>Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)"><!-- --></A><H3>
service</H3>
<PRE>
public void <B>service</B>(<A HREF="../../../javax/servlet/ServletRequest.html">ServletRequest</A>&nbsp;req,
                    <A HREF="../../../javax/servlet/ServletResponse.html">ServletResponse</A>&nbsp;res)
             throws <A HREF="../../../javax/servlet/ServletException.html">ServletException</A>,
                    java.io.IOException</PRE>
<DL>
<DD>Dispatches client requests to the protected
 <code>service</code> method. There's no need to
 override this method.<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../javax/servlet/GenericServlet.html#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)">service</A></CODE> in class <CODE><A HREF="../../../javax/servlet/GenericServlet.html">GenericServlet</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>req</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletRequest.html"><CODE>HttpServletRequest</CODE></A> object that
			contains the request the client made of
			the servlet<DD><CODE>resp</CODE> - the <A HREF="../../../javax/servlet/http/HttpServletResponse.html"><CODE>HttpServletResponse</CODE></A> object that
			contains the response the servlet returns
			to the client<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an input or output error occurs
				while the servlet is handling the
				TRACE request<DD><CODE><A HREF="../../../javax/servlet/ServletException.html">ServletException</A></CODE> - if the request for the
					TRACE cannot be handled<DT><B>See Also: </B><DD><A HREF="../../../javax/servlet/Servlet.html#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)"><CODE>Servlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)</CODE></A></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>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="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 CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="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/Cookie.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/servlet/http/HttpServletRequestWrapper.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="HttpServlet.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;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>

</BODY>
</HTML>

⌨️ 快捷键说明

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