📄 httpservlet.html
字号:
<A NAME="doPut(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)"><!-- --></A><H3>doPut</H3><PRE>protected void <B>doPut</B>(<A HREF="../../../javax/servlet/http/HttpServletRequest.html">HttpServletRequest</A> req, <A HREF="../../../javax/servlet/http/HttpServletResponse.html">HttpServletResponse</A> 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 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 2616 <a href="http://www.ietf.org/rfc/rfc2616.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>java.io.IOException - if an input or output error occurs while the servlet is handling the PUT request<DD><A HREF="../../../javax/servlet/ServletException.html">ServletException</A> - 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> req, <A HREF="../../../javax/servlet/http/HttpServletResponse.html">HttpServletResponse</A> 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>java.io.IOException - if an input or output error occurs while the servlet is handling the DELETE request<DD><A HREF="../../../javax/servlet/ServletException.html">ServletException</A> - 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> req, <A HREF="../../../javax/servlet/http/HttpServletResponse.html">HttpServletResponse</A> 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>java.io.IOException - if an input or output error occurs while the servlet is handling the OPTIONS request<DD><A HREF="../../../javax/servlet/ServletException.html">ServletException</A> - 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> req, <A HREF="../../../javax/servlet/http/HttpServletResponse.html">HttpServletResponse</A> 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>java.io.IOException - if an input or output error occurs while the servlet is handling the TRACE request<DD><A HREF="../../../javax/servlet/ServletException.html">ServletException</A> - 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> req, <A HREF="../../../javax/servlet/http/HttpServletResponse.html">HttpServletResponse</A> 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>java.io.IOException - if an input or output error occurs while the servlet is handling the HTTP request<DD><A HREF="../../../javax/servlet/ServletException.html">ServletException</A> - if the HTTP request 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> req, <A HREF="../../../javax/servlet/ServletResponse.html">ServletResponse</A> 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><A HREF="../../../javax/servlet/GenericServlet.html#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)">service</A> in class <A HREF="../../../javax/servlet/GenericServlet.html">GenericServlet</A></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>res</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>java.io.IOException - if an input or output error occurs while the servlet is handling the HTTP request<DD><A HREF="../../../javax/servlet/ServletException.html">ServletException</A> - if the HTTP request 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 ID="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="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 ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT ID="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/Cookie.html"><B>PREV CLASS</B></A> <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> <A HREF="HttpServlet.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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 + -