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.
 java.util.Queue<Response> getMessages()
          Returns the queue of messages.
 boolean isEmpty()
          Indicates if the way is empty.
protected  boolean isReady()
          Indicates if the IoState.READY state can be granted.
 void onCompleted(boolean endDetected)
          Callback method invoked when the current message has been completely received or sent.
 void onError(Status status)
          Called on error.
 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.ClientInboundWay
copyResponseTransportHeaders, createStatus, getActualMessage, getConnection, getHelper, getInterestOperations, onReceived, onReceived, readStartLine
 
Methods inherited from class org.restlet.engine.connector.InboundWay
createEntity, fillLine, getBuilderIndex, getEntityRegistration, isLineReadable, onDrain, onFill, onFillEof, onPostProcessing, processIoBuffer, readHeader, setBuilderIndex, setEntityRegistration
 
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:
java.io.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 java.util.Queue<Response> getMessages()
Returns the queue of messages.

Returns:
The queue of messages.

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.

isReady

protected boolean isReady()
Indicates if the IoState.READY state can be granted.

Returns:
True if the IoState.READY state can be granted.

onCompleted

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

Specified by:
onCompleted in interface CompletionListener
Overrides:
onCompleted in class ClientInboundWay
Parameters:
endDetected - Indicates if the end of the socket channel was detected.
Throws:
java.io.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

updateState

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

Overrides:
updateState in class InboundWay


Copyright © 2005-2013 Restlet S.A.S..