org.restlet.engine.connector
Class HttpClientOutboundWay

java.lang.Object
  extended by org.restlet.engine.connector.Way
      extended by org.restlet.engine.connector.OutboundWay
          extended by org.restlet.engine.connector.ClientOutboundWay
              extended by org.restlet.engine.connector.HttpClientOutboundWay
All Implemented Interfaces:
BufferProcessor, CompletionListener, SelectionListener

public class HttpClientOutboundWay
extends ClientOutboundWay

HTTP client outbound way.

Author:
Jerome Louvel

Constructor Summary
HttpClientOutboundWay(Connection<?> connection, int bufferSize)
          Constructor.
 
Method Summary
 void clear()
          Recycles the way so it can be reused.
 int getLoadScore()
          Returns a score representing the way load and that could be compared with other ways of the same parent connection.
 Queue<Response> getMessages()
          Returns the queue of messages.
protected  void handle(Response response)
          Add a message to the outbound way.
 boolean isEmpty()
          Indicates if the way is empty.
 void onError(Status status)
          Called on error.
 void onHeadersCompleted()
          Callback invoked when a message has been sent.
 void onMessageCompleted(boolean endDetected)
          Callback method invoked when the current message has been completely received or sent.
 void onTimeOut()
          Called back by the controller when an IO time out has been detected.
 void updateState()
          Updates the way IO and message states.
 
Methods inherited from class org.restlet.engine.connector.ClientOutboundWay
addHeaders, addRequestHeaders, getActualMessage, getConnection, writeStartLine
 
Methods inherited from class org.restlet.engine.connector.OutboundWay
addEntityHeaders, addGeneralHeaders, flushBuffer, getEntityChannel, getEntityChannelType, getEntityFileChannel, getEntityInterestOps, getEntitySelectableChannel, getEntitySelectionKey, getHeaderIndex, getInterestOperations, getVersion, hasIoInterest, onDrain, onFill, onFillEof, onPostProcessing, processIoBuffer, setEntityChannel, setEntityChannelType, setEntitySelectionKey, setHeaderIndex, shouldBeChunked, writeLine
 
Methods inherited from class org.restlet.engine.connector.Way
canLoop, clearLineBuilder, couldDrain, couldFill, getBuffer, getHeaders, getHelper, getIoState, getLineBuilder, getLineBuilderState, getLogger, getMessage, getMessageState, getRegistration, isAvailable, onClosed, onSelected, postProcess, preProcess, setHeaders, setIoState, setLineBuilderState, setMessage, setMessageState, setRegistration, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpClientOutboundWay

public HttpClientOutboundWay(Connection<?> connection,
                             int bufferSize)
Constructor.

Parameters:
connection - The parent connection.
bufferSize - The byte buffer size.
Method Detail

clear

public void clear()
Description copied from class: Way
Recycles the way so it can be reused. Typically invoked by a connection pool.

Overrides:
clear in class OutboundWay

getLoadScore

public int getLoadScore()
Description copied from class: Way
Returns a score representing the way load and that could be compared with other ways of the same parent connection.

Overrides:
getLoadScore in class Way
Returns:
A score representing the way load.

getMessages

public Queue<Response> getMessages()
Returns the queue of messages.

Returns:
The queue of messages.

handle

protected void handle(Response response)
Description copied from class: OutboundWay
Add a message to the outbound way.

Specified by:
handle in class OutboundWay

isEmpty

public boolean isEmpty()
Description copied from class: Way
Indicates if the way is empty.

Overrides:
isEmpty in class Way
Returns:
True if the way is empty.

onError

public void onError(Status status)
Description copied from class: Way
Called on error.

Overrides:
onError in class OutboundWay
Parameters:
status - The error status.

onHeadersCompleted

public void onHeadersCompleted()
                        throws IOException
Description copied from class: OutboundWay
Callback invoked when a message has been sent. Note that only the start line and the headers must have been sent, not the optional body.

Overrides:
onHeadersCompleted in class OutboundWay
Throws:
IOException

onMessageCompleted

public void onMessageCompleted(boolean endDetected)
                        throws IOException
Description copied from class: Way
Callback method invoked when the current message has been completely received or sent.

Specified by:
onMessageCompleted in interface CompletionListener
Overrides:
onMessageCompleted in class ClientOutboundWay
Parameters:
endDetected - Indicates if the end of the socket channel was detected.
Throws:
IOException

onTimeOut

public void onTimeOut()
Description copied from class: Way
Called back by the controller when an IO time out has been detected.

Overrides:
onTimeOut in class OutboundWay

updateState

public void updateState()
Description copied from class: Way
Updates the way IO and message states.

Overrides:
updateState in class OutboundWay


Copyright © 2005-2013 Restlet.