org.restlet.engine.connector
Class ClientInboundWay

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

public abstract class ClientInboundWay
extends InboundWay

Client-side inbound way.

Author:
Jerome Louvel

Constructor Summary
ClientInboundWay(Connection<?> connection, int bufferSize)
          Constructor.
 
Method Summary
protected  void copyResponseTransportHeaders(Series<Header> headers, Response response)
          Copies headers into a response.
protected abstract  Response createResponse(Status status)
          Creates a response object for the given status.
protected  Status createStatus(int code)
          Returns the status corresponding to a given status code.
 Message getActualMessage()
          Returns the actual message, request or response.
 Connection<Client> getConnection()
          Returns the parent connection.
 ClientConnectionHelper getHelper()
          Returns the parent connector helper.
 int getInterestOperations()
          Returns the operations of interest.
protected  void onHeadersCompleted()
          Callback invoked when a message has been received.
 void onMessageCompleted(boolean endDetected)
          Callback method invoked when the current message has been completely received or sent.
protected  void onReceived(Response message)
          Call back invoked when the message is received.
protected  void readStartLine()
          Read the start line of the current message received.
 
Methods inherited from class org.restlet.engine.connector.InboundWay
clear, createEntity, fillLine, getBuilderIndex, getEntityRegistration, isLineReadable, onDrain, onError, onFill, onFillEof, onPostProcessing, onTimeOut, processIoBuffer, readHeader, setBuilderIndex, setEntityRegistration, updateState
 
Methods inherited from class org.restlet.engine.connector.Way
canLoop, clearLineBuilder, couldDrain, couldFill, getBuffer, getHeaders, getIoState, getLineBuilder, getLineBuilderState, getLoadScore, getLogger, getMessage, getMessageState, getRegistration, hasIoInterest, isAvailable, isEmpty, 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

ClientInboundWay

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

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

copyResponseTransportHeaders

protected void copyResponseTransportHeaders(Series<Header> headers,
                                            Response response)
Copies headers into a response.

Parameters:
headers - The headers to copy.
response - The response to update.

createResponse

protected abstract Response createResponse(Status status)
Creates a response object for the given status.

Parameters:
status - The response status.
Returns:
The new response object.

createStatus

protected Status createStatus(int code)
Returns the status corresponding to a given status code.

Parameters:
code - The status code.
Returns:
The status corresponding to a given status code.

getActualMessage

public Message getActualMessage()
Description copied from class: Way
Returns the actual message, request or response.

Specified by:
getActualMessage in class Way
Returns:
The actual message, request or response.

getConnection

public Connection<Client> getConnection()
Description copied from class: Way
Returns the parent connection.

Overrides:
getConnection in class Way
Returns:
The parent connection.

getHelper

public ClientConnectionHelper getHelper()
Description copied from class: Way
Returns the parent connector helper.

Overrides:
getHelper in class Way
Returns:
The parent connector helper.

getInterestOperations

public int getInterestOperations()
Description copied from class: Way
Returns the operations of interest.

Overrides:
getInterestOperations in class InboundWay
Returns:
The operations of interest.

onHeadersCompleted

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

Overrides:
onHeadersCompleted in class InboundWay
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 InboundWay
Parameters:
endDetected - Indicates if the end of the socket channel was detected.
Throws:
IOException

onReceived

protected void onReceived(Response message)
                   throws IOException
Description copied from class: InboundWay
Call back invoked when the message is received.

Specified by:
onReceived in class InboundWay
Parameters:
message - The new message received.
Throws:
IOException

readStartLine

protected void readStartLine()
                      throws IOException
Description copied from class: InboundWay
Read the start line of the current message received.

Specified by:
readStartLine in class InboundWay
Throws:
IOException


Copyright © 2005-2013 Restlet.