Edit D:\app\Administrator\product\11.2.0\dbhome_1\owb\lib\int\HTTPClient\doc\api\HTTPClient\HTTPClientModule.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc on Mon May 07 18:52:23 PDT 2001 --> <TITLE> HTTPClient API: Interface HTTPClientModule </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_top"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_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="../HTTPClient/FilenameMangler.html"><B>PREV CLASS</B></A> <A HREF="../HTTPClient/HTTPClientModuleConstants.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="HTTPClientModule.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> HTTPClient</FONT> <BR> Interface HTTPClientModule</H2> <DL> <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../HTTPClient/CookieModule.html">CookieModule</A></DD> </DL> <HR> <DL> <DT>public interface <B>HTTPClientModule</B><DT>extends <A HREF="../HTTPClient/HTTPClientModuleConstants.html">HTTPClientModuleConstants</A></DL> <P> This is the interface that a module must implement. There are two parts during a request: the construction of the request, and the handling of the response. A request may cycle through these parts multiple times when a module generates additional subrequests (such as a redirection status handling module might do). <P>In the first step the request handler is invoked; here the headers, the request-uri, etc. can be modified, or a complete response can be generated. Then, if no response was generated, the request is sent over the wire. In the second step the response handlers are invoked. These may modify the response or, in phase 2, may generate a new request; the returned status from the phase 2 handler specifies how the processing of the request or response should further proceed. <P>The response handling is split into three phases. In the first phase the response handling cannot be modified; this is so that all modules get a chance to see the returned response. Modules will typically make notes of responses and do certain header processing here (for example the cookie module does it's work in this phase). In the second phase modules may generate new subrequests or otherwise control the further handling of the response. This is typically used for response status handling (such as for redirections and authentication). Finally, if no new subrequest was generated, the phase 3 response handlers are invoked so that modules can perform any necessary cleanups and final processing (no additional subrequests can be made anymore). It is recommended that any response processing which needn't be done if the request is not returned to the user is deferred until this phase. For example, the Content-MD5, Content-Encoding and Transfer-Encoding modules do their work in this phase as the response body is usually discarded if a new subrequest is generated. <P>When the user invokes any request method (such as <code>Get(...)</code>) a list of of modules to be used is built. Then, for each module in the list, an instance is created using the <code>Class.newInstance()</code> method. This means that each module must have a constructor which takes no arguments. This instance is then used to handle the request, its response, and any additional subrequests and their responses. In this way a module can easily keep state between related subrequests. For example, a redirection module might want to keep track of the number of redirections made to detect redirect loops; it could do this by defining an instance variable and incrementing it each time the request handler is invoked. <P> <DL> <DT><B>Since: </B><DD>V0.3</DD> <DT><B>Version: </B><DD>0.3-3 06/05/2001</DD> <DT><B>Author: </B><DD>Ronald Tschal?</DD> </DL> <HR> <P> <!-- ======== INNER CLASS SUMMARY ======== --> <!-- =========== FIELD SUMMARY =========== --> <A NAME="fields_inherited_from_class_HTTPClient.HTTPClientModuleConstants"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TD><B>Fields inherited from interface HTTPClient.<A HREF="../HTTPClient/HTTPClientModuleConstants.html">HTTPClientModuleConstants</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../HTTPClient/HTTPClientModuleConstants.html#REQ_CONTINUE">REQ_CONTINUE</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#REQ_NEWCON_RST">REQ_NEWCON_RST</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#REQ_NEWCON_SND">REQ_NEWCON_SND</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#REQ_RESPONSE">REQ_RESPONSE</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#REQ_RESTART">REQ_RESTART</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#REQ_RETURN">REQ_RETURN</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#REQ_SHORTCIRC">REQ_SHORTCIRC</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#RSP_CONTINUE">RSP_CONTINUE</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#RSP_NEWCON_REQ">RSP_NEWCON_REQ</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#RSP_NEWCON_SND">RSP_NEWCON_SND</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#RSP_REQUEST">RSP_REQUEST</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#RSP_RESTART">RSP_RESTART</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#RSP_SEND">RSP_SEND</A>, <A HREF="../HTTPClient/HTTPClientModuleConstants.html#RSP_SHORTCIRC">RSP_SHORTCIRC</A></CODE></TD> </TR> </TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=2><FONT SIZE="+2"> <B>Method Summary</B></FONT></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HTTPClientModule.html#requestHandler(HTTPClient.Request, HTTPClient.Response[])">requestHandler</A></B>(<A HREF="../HTTPClient/Request.html">Request</A> request, <A HREF="../HTTPClient/Response.html">Response</A>[] response)</CODE> <BR> This is invoked before the request is sent.</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="../HTTPClient/HTTPClientModule.html#responsePhase1Handler(HTTPClient.Response, HTTPClient.RoRequest)">responsePhase1Handler</A></B>(<A HREF="../HTTPClient/Response.html">Response</A> response, <A HREF="../HTTPClient/RoRequest.html">RoRequest</A> request)</CODE> <BR> The phase 1 response handler.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/HTTPClientModule.html#responsePhase2Handler(HTTPClient.Response, HTTPClient.Request)">responsePhase2Handler</A></B>(<A HREF="../HTTPClient/Response.html">Response</A> response, <A HREF="../HTTPClient/Request.html">Request</A> request)</CODE> <BR> The phase 2 response handler.</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="../HTTPClient/HTTPClientModule.html#responsePhase3Handler(HTTPClient.Response, HTTPClient.RoRequest)">responsePhase3Handler</A></B>(<A HREF="../HTTPClient/Response.html">Response</A> response, <A HREF="../HTTPClient/RoRequest.html">RoRequest</A> request)</CODE> <BR> The phase 3 response handler.</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="../HTTPClient/HTTPClientModule.html#trailerHandler(HTTPClient.Response, HTTPClient.RoRequest)">trailerHandler</A></B>(<A HREF="../HTTPClient/Response.html">Response</A> response, <A HREF="../HTTPClient/RoRequest.html">RoRequest</A> request)</CODE> <BR> The chunked transfer-encoding (and in future maybe others) can contain trailer fields at the end of the body.</TD> </TR> </TABLE> <P> <!-- ============ FIELD DETAIL =========== --> <!-- ========= CONSTRUCTOR DETAIL ======== --> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=1><FONT SIZE="+2"> <B>Method Detail</B></FONT></TD> </TR> </TABLE> <A NAME="requestHandler(HTTPClient.Request, HTTPClient.Response[])"><!-- --></A><H3> requestHandler</H3> <PRE> public int <B>requestHandler</B>(<A HREF="../HTTPClient/Request.html">Request</A> request, <A HREF="../HTTPClient/Response.html">Response</A>[] response) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A>, <A HREF="../HTTPClient/ModuleException.html">ModuleException</A></PRE> <DL> <DD>This is invoked before the request is sent. A module will typically use this to make a note of headers, to modify headers and/or data, or even generate and return a response (e.g. for a cache module). If a response is generated the module must return the appropriate return code (<var>REQ_RESPONSE</var> or <var>REQ_RETURN</var>). <P>Return codes for phase 1 (defined in HTTPClientModuleConstants.java) <DL> <DT>REQ_CONTINUE <DI>continue processing <DT>REQ_RESTART <DI>restart processing with first module <DT>REQ_SHORTCIRC <DI>stop processing and send <DT>REQ_RESPONSE <DI>go to phase 2 <DT>REQ_RETURN <DI>return response immediately (no processing) <DT>REQ_NEWCON_RST <DI>use a new HTTPConnection, restart processing <DT>REQ_NEWCON_SND <DI>use a new HTTPConnection, send immediately </DL><DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>request</CODE> - the request - may be modified as needed<DD><CODE>response</CODE> - the response if the status is REQ_RESPONSE or REQ_RETURN<DT><B>Returns:</B><DD>status code REQ_XXX specifying further action<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - if an IOException occurs on the socket<DD><A HREF="../HTTPClient/ModuleException.html">ModuleException</A> - if an exception occurs during the handling of the request</DL> </DD> </DL> <HR> <A NAME="responsePhase1Handler(HTTPClient.Response, HTTPClient.RoRequest)"><!-- --></A><H3> responsePhase1Handler</H3> <PRE> public void <B>responsePhase1Handler</B>(<A HREF="../HTTPClient/Response.html">Response</A> response, <A HREF="../HTTPClient/RoRequest.html">RoRequest</A> request) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A>, <A HREF="../HTTPClient/ModuleException.html">ModuleException</A></PRE> <DL> <DD>The phase 1 response handler. This will be invoked for every response. Modules will typically make notes of the response and do any header processing which must always be performed.<DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>response</CODE> - the response - may be modified<DD><CODE>request</CODE> - the original request<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - if an IOException occurs on the socket<DD><A HREF="../HTTPClient/ModuleException.html">ModuleException</A> - if an exception occurs during the handling of the response</DL> </DD> </DL> <HR> <A NAME="responsePhase2Handler(HTTPClient.Response, HTTPClient.Request)"><!-- --></A><H3> responsePhase2Handler</H3> <PRE> public int <B>responsePhase2Handler</B>(<A HREF="../HTTPClient/Response.html">Response</A> response, <A HREF="../HTTPClient/Request.html">Request</A> request) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A>, <A HREF="../HTTPClient/ModuleException.html">ModuleException</A></PRE> <DL> <DD>The phase 2 response handler. A module may modify the response or generate a new request (e.g. for redirection). This handler will only be invoked for a given module if all previous modules returned <var>RSP_CONTINUE</var>. If the request is modified the handler must return an appropriate return code (<var>RSP_REQUEST</var>, <var>RSP_SEND</var>, <var>RSP_NEWCON_REQ</var> or <var>RSP_NEWCON_SND</var>). If any other code is return the request must not be modified. <P>Return codes for phase 2 (defined in HTTPClientModuleConstants.java) <DL> <DT>RSP_CONTINUE <DI>continue processing <DT>RSP_RESTART <DI>restart processing with first module (phase 1) <DT>RSP_SHORTCIRC <DI>stop processing and return <DT>RSP_REQUEST <DI>go to phase 1 <DT>RSP_SEND <DI>send request immediately (no processing) <DT>RSP_NEWCON_REQ <DI>go to phase 1 using a new HTTPConnection <DT>RSP_NEWCON_SND <DI>send request using a new HTTPConnection </DL><DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>response</CODE> - the response - may be modified<DD><CODE>request</CODE> - the request; if the status is RSP_REQUEST then this must contain the new request; however do not modify this if you don't return a RSP_REQUEST status.<DT><B>Returns:</B><DD>status code RSP_XXX specifying further action<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - if an IOException occurs on the socket<DD><A HREF="../HTTPClient/ModuleException.html">ModuleException</A> - if an exception occurs during the handling of the response</DL> </DD> </DL> <HR> <A NAME="responsePhase3Handler(HTTPClient.Response, HTTPClient.RoRequest)"><!-- --></A><H3> responsePhase3Handler</H3> <PRE> public void <B>responsePhase3Handler</B>(<A HREF="../HTTPClient/Response.html">Response</A> response, <A HREF="../HTTPClient/RoRequest.html">RoRequest</A> request) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A>, <A HREF="../HTTPClient/ModuleException.html">ModuleException</A></PRE> <DL> <DD>The phase 3 response handler. This will only be invoked if no new subrequest was generated in phase 2. Modules should defer any repsonse handling which need only be done if the response is returned to the user to this phase.<DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>response</CODE> - the response - may be modified<DD><CODE>request</CODE> - the original request<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - if an IOException occurs on the socket<DD><A HREF="../HTTPClient/ModuleException.html">ModuleException</A> - if an exception occurs during the handling of the response</DL> </DD> </DL> <HR> <A NAME="trailerHandler(HTTPClient.Response, HTTPClient.RoRequest)"><!-- --></A><H3> trailerHandler</H3> <PRE> public void <B>trailerHandler</B>(<A HREF="../HTTPClient/Response.html">Response</A> response, <A HREF="../HTTPClient/RoRequest.html">RoRequest</A> request) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A>, <A HREF="../HTTPClient/ModuleException.html">ModuleException</A></PRE> <DL> <DD>The chunked transfer-encoding (and in future maybe others) can contain trailer fields at the end of the body. Since the <code>responsePhaseXHandler()</code>'s are invoked before the body is read and therefore do not have access to the trailers (unless they force the complete body to be read) this method will be invoked when the trailers have been read and parsed (sort of a post-response handling). <P>Note: This method <strong>must not</strong> modify any part of the response other than the trailers.<DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>response</CODE> - the response<DD><CODE>request</CODE> - the request<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - if an IOException occurs on the socket<DD><A HREF="../HTTPClient/ModuleException.html">ModuleException</A> - if an exception occurs during the handling of the trailers</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="../HTTPClient/FilenameMangler.html"><B>PREV CLASS</B></A> <A HREF="../HTTPClient/HTTPClientModuleConstants.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="HTTPClientModule.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> </BODY> </HTML>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de