|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.engine.connector.Way
org.restlet.engine.connector.InboundWay
public abstract class InboundWay
A network connection way though which messages are received. Messages can be either requests or responses.
| Constructor Summary | |
|---|---|
InboundWay(Connection<?> connection,
int bufferSize)
Constructor. |
|
| Method Summary | |
|---|---|
void |
clear()
Recycles the way so it can be reused. |
protected Representation |
createEntity(Series<Header> headers)
Returns the message entity if available. |
protected boolean |
fillLine()
Read the current message line (start line or header line). |
protected int |
getBuilderIndex()
Returns the line builder index. |
protected SelectionRegistration |
getEntityRegistration()
Returns the NIO selection registration of the entity. |
int |
getInterestOperations()
Returns the operations of interest. |
protected boolean |
isLineReadable()
Indicates if the next message line is readable. |
int |
onDrain(Buffer buffer,
int maxDrained,
Object... args)
Drains the byte buffer by writing available bytes to the socket channel. |
void |
onError(Status status)
Called on error. |
int |
onFill(Buffer buffer,
Object... args)
Fills the byte buffer by writing the current message. |
void |
onFillEof()
Called back when a fill operation returns with an EOF status. |
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 |
onPostProcessing()
Called back after the IO processing to indicate if there is further IO interest. |
protected abstract void |
onReceived(Response message)
Call back invoked when the message is received. |
void |
onTimeOut()
Called back by the controller when an IO time out has been detected. |
int |
processIoBuffer()
Processes the IO buffer by filling and draining it. |
protected Header |
readHeader()
Read a message header. |
protected abstract void |
readStartLine()
Read the start line of the current message received. |
protected void |
setBuilderIndex(int builderIndex)
Sets the line builder index. |
protected void |
setEntityRegistration(SelectionRegistration entityRegistration)
Sets the NIO selection registration of the entity. |
void |
updateState()
Updates the way IO and message states. |
| Methods inherited from class org.restlet.engine.connector.Way |
|---|
canLoop, clearLineBuilder, couldDrain, couldFill, getActualMessage, getBuffer, getConnection, getHeaders, getHelper, 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 |
|---|
public InboundWay(Connection<?> connection,
int bufferSize)
connection - The parent connection.bufferSize - The byte buffer size.| Method Detail |
|---|
public void clear()
Way
clear in class Wayprotected Representation createEntity(Series<Header> headers)
headers - The headers to use.
protected boolean fillLine()
throws IOException
IOExceptionprotected int getBuilderIndex()
protected SelectionRegistration getEntityRegistration()
public int getInterestOperations()
Way
getInterestOperations in class Way
protected boolean isLineReadable()
throws IOException
IOException
public void onMessageCompleted(boolean endDetected)
throws IOException
Way
onMessageCompleted in interface CompletionListeneronMessageCompleted in class WayendDetected - Indicates if the end of the socket channel was detected.
IOException
public int onDrain(Buffer buffer,
int maxDrained,
Object... args)
throws IOException
Way
onDrain in interface BufferProcessoronDrain in class Waybuffer - The IO buffer to drain.maxDrained - The maximum number of bytes drained by this call.args - The optional arguments to pass back to the callbacks.
IOExceptionpublic void onError(Status status)
Way
onError in class Waystatus - The error status.
public int onFill(Buffer buffer,
Object... args)
throws IOException
Way
onFill in interface BufferProcessoronFill in class Waybuffer - The IO buffer to drain.args - The optional arguments to pass back to the callbacks.
IOExceptionpublic void onFillEof()
protected void onPostProcessing()
WayIoState.INTEREST.
onPostProcessing in class Way
protected void onHeadersCompleted()
throws IOException
onHeadersCompleted in class WayIOException
protected abstract void onReceived(Response message)
throws IOException
message - The new message received.
IOExceptionpublic void onTimeOut()
Way
onTimeOut in class Way
public int processIoBuffer()
throws IOException
Way
processIoBuffer in class WayIOException
protected Header readHeader()
throws IOException
IOException
protected abstract void readStartLine()
throws IOException
IOExceptionprotected void setBuilderIndex(int builderIndex)
builderIndex - The line builder index.protected void setEntityRegistration(SelectionRegistration entityRegistration)
entityRegistration - The NIO selection registration of the entity.public void updateState()
Way
updateState in class Way
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||