org.restlet.engine.connector
Class HttpClientInboundWay

java.lang.Object
  extended by org.restlet.engine.connector.Way
      extended by org.restlet.engine.connector.InboundWay
          extended by org.restlet.engine.connector.ClientInboundWay
              extended by org.restlet.engine.connector.HttpClientInboundWay
All Implemented Interfaces:
BufferProcessor, CompletionListener, SelectionListener

public class HttpClientInboundWay
extends ClientInboundWay

HTTP client inbound way.

Author:
Jerome Louvel

Constructor Summary
HttpClientInboundWay(Connection<Client> connection, int bufferSize)
          Constructor.
 
Method Summary
 void clear()
          Recycles the way so it can be reused.
protected  Response createResponse(Status status)
          Creates a response object for the given status.
 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  boolean hasIoInterest()
          Indicates if we want to be selected for IO processing when the socket related socket is prepared.
 boolean isEmpty()
          Indicates if the way is empty.
 void onError(Status status)
          Called on error.
 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.
 
Methods inherited from class org.restlet.engine.connector.ClientInboundWay
copyResponseTransportHeaders, createStatus, getActualMessage, getConnection, getHelper, getInterestOperations, onHeadersCompleted, onReceived, readStartLine
 
Methods inherited from class org.restlet.engine.connector.InboundWay
createEntity, fillLine, getBuilderIndex, getEntityRegistration, isLineReadable, onDrain, onFill, onFillEof, onPostProcessing, processIoBuffer, readHeader, setBuilderIndex, setEntityRegistration, updateState
 
Methods inherited from class org.restlet.engine.connector.Way
canLoop, clearLineBuilder, couldDrain, couldFill, getBuffer, getHeaders, 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

HttpClientInboundWay

public HttpClientInboundWay(Connection<Client> connection,
                            int bufferSize)
Constructor.

Parameters:
connection - The parent connection.
bufferSize - The byte buffer size.
Throws:
IOException
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 InboundWay

createResponse

protected Response createResponse(Status status)
Description copied from class: ClientInboundWay
Creates a response object for the given status.

Specified by:
createResponse in class ClientInboundWay
Parameters:
status - The response status.
Returns:
The new response object.

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.

hasIoInterest

protected boolean hasIoInterest()
Description copied from class: Way
Indicates if we want to be selected for IO processing when the socket related socket is prepared.

Overrides:
hasIoInterest in class Way
Returns:
True if we want to be selected for IO processing when the socket is ready.

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.

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 ClientInboundWay
Parameters:
endDetected - Indicates if the end of the socket channel was detected.
Throws:
IOException

onError

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

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

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 InboundWay


Copyright © 2005-2013 Restlet.