HTTPClient
Class RetryModule
java.lang.Object
|
+--HTTPClient.RetryModule
- All Implemented Interfaces:
- GlobalConstants, HTTPClientModule, HTTPClientModuleConstants
- class RetryModule
- extends java.lang.Object
- implements HTTPClientModule, GlobalConstants
This module handles request retries when a connection closes prematurely.
It is triggered by the RetryException thrown by the StreamDemultiplexor.
This module is somewhat unique in that it doesn't strictly limit itself
to the HTTPClientModule interface and its return values. That is, it
sends request directly using the HTTPConnection.sendRequest() method. This
is necessary because this module will not only resend its request but it
also resend all other requests in the chain. Also, it rethrows the
RetryException in Phase1 to restart the processing of the modules.
- Since:
- V0.3
| Fields inherited from interface HTTPClient.HTTPClientModuleConstants |
REQ_CONTINUE, REQ_NEWCON_RST, REQ_NEWCON_SND,
REQ_RESPONSE, REQ_RESTART, REQ_RETURN, REQ_SHORTCIRC,
RSP_CONTINUE, RSP_NEWCON_REQ, RSP_NEWCON_SND,
RSP_REQUEST, RSP_RESTART, RSP_SEND, RSP_SHORTCIRC |
| Fields inherited from interface HTTPClient.GlobalConstants |
CD_0, CD_CHUNKED, CD_CLOSE, CD_CONTLEN,
CD_HDRS, CD_MP_BR, CD_NONE, HTTP,
HTTP_1_0, HTTP_1_1, HTTP_NG, HTTPS,
SHTTP |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RetryModule
RetryModule()
requestHandler
public int requestHandler(Request req,
Response[] resp)
- Invoked by the HTTPClient.
- Specified by:
requestHandler in interface HTTPClientModule
- Following copied from interface:
HTTPClient.HTTPClientModule
- Parameters:
request - the request - may be modified as neededresponse - the response if the status is REQ_RESPONSE or REQ_RETURN- Returns:
- status code REQ_XXX specifying further action
- Throws:
java.io.IOException
- if an IOException occurs on the socketModuleException - if an exception occurs during the handling
of the request
responsePhase1Handler
public void responsePhase1Handler(Response resp,
RoRequest roreq)
throws java.io.IOException,
ModuleException
- Invoked by the HTTPClient.
- Specified by:
responsePhase1Handler in interface HTTPClientModule
- Following copied from interface:
HTTPClient.HTTPClientModule
- Parameters:
response - the response - may be modifiedrequest - the original request- Throws:
java.io.IOException - if an IOException occurs on the socketModuleException
- if an exception occurs during the handling
of the response
responsePhase2Handler
public int responsePhase2Handler(Response resp,
Request req)
- Invoked by the HTTPClient.
- Specified by:
responsePhase2Handler in interface HTTPClientModule
- Following copied from interface:
HTTPClient.HTTPClientModule
- Parameters:
response - the response - may be modifiedrequest - 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.- Returns:
- status code RSP_XXX specifying further action
- Throws:
java.io.IOException - if an IOException occurs on the socketModuleException
- if an exception occurs during the handling
of the response
responsePhase3Handler
public void responsePhase3Handler(Response resp,
RoRequest req)
- Invoked by the HTTPClient.
- Specified by:
responsePhase3Handler in interface HTTPClientModule
- Following copied from interface:
HTTPClient.HTTPClientModule
- Parameters:
response - the response - may be modifiedrequest - the original request- Throws:
java.io.IOException - if an IOException occurs on the socketModuleException
- if an exception occurs during the handling
of the response
trailerHandler
public void trailerHandler(Response resp,
RoRequest req)
- Invoked by the HTTPClient.
- Specified by:
trailerHandler in interface HTTPClientModule
- Following copied from interface:
HTTPClient.HTTPClientModule
- Parameters:
response - the responserequest - the request- Throws:
java.io.IOException - if an IOException occurs on the socketModuleException
- if an exception occurs during the handling
of the trailers