Package org.restlet.ext.nio.internal.way
Class InboundWay
- java.lang.Object
-
- org.restlet.ext.nio.internal.way.Way
-
- org.restlet.ext.nio.internal.way.InboundWay
-
- All Implemented Interfaces:
BufferProcessor,CompletionListener,SelectionListener
- Direct Known Subclasses:
ClientInboundWay,ServerInboundWay
@Deprecated public abstract class InboundWay extends Way
Deprecated.Will be removed to favor lower-level network extensions allowing more control at the Restlet API level.A network connection way though which messages are received. Messages can be either requests or responses.
-
-
Field Summary
Fields Modifier and Type Field Description private intbuilderIndexDeprecated.The line builder index.private SelectionRegistrationentityRegistrationDeprecated.The NIO selection registration of the entity.
-
Constructor Summary
Constructors Constructor Description InboundWay(Connection<?> connection, int bufferSize)Deprecated.Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclear()Deprecated.Recycles the way so it can be reused.protected RepresentationcreateEntity(Series<Header> headers)Deprecated.Returns the message entity if available.protected booleanfillLine()Deprecated.Read the current message line (start line or header line).protected intgetBuilderIndex()Deprecated.Returns the line builder index.protected SelectionRegistrationgetEntityRegistration()Deprecated.Returns the NIO selection registration of the entity.intgetInterestOperations()Deprecated.Returns the operations of interest.protected booleanisLineReadable()Deprecated.Indicates if the next message line is readable.intonDrain(Buffer buffer, int maxDrained, java.lang.Object... args)Deprecated.Drains the byte buffer by writing available bytes to the socket channel.voidonError(Status status)Deprecated.Called on error.intonFill(Buffer buffer, java.lang.Object... args)Deprecated.Fills the byte buffer by writing the current message.voidonFillEof()Deprecated.Called back when a fill operation returns with an EOF status.protected voidonHeadersCompleted()Deprecated.Callback invoked when a message has been received.voidonMessageCompleted(boolean endDetected)Deprecated.Callback method invoked when the current message has been completely received or sent.protected voidonPostProcessing()Deprecated.Called back after the IO processing to indicate if there is further IO interest.protected abstract voidonReceived(Response message)Deprecated.Call back invoked when the message is received.voidonTimeOut()Deprecated.Called back by the controller when an IO time out has been detected.intprocessIoBuffer()Deprecated.Processes the IO buffer by filling and draining it.protected HeaderreadHeader()Deprecated.Read a message header.protected abstract voidreadStartLine()Deprecated.Read the start line of the current message received.protected voidsetBuilderIndex(int builderIndex)Deprecated.Sets the line builder index.protected voidsetEntityRegistration(SelectionRegistration entityRegistration)Deprecated.Sets the NIO selection registration of the entity.voidupdateState()Deprecated.Updates the way IO and message states.-
Methods inherited from class org.restlet.ext.nio.internal.way.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
-
-
-
-
Field Detail
-
builderIndex
private volatile int builderIndex
Deprecated.The line builder index.
-
entityRegistration
private volatile SelectionRegistration entityRegistration
Deprecated.The NIO selection registration of the entity.
-
-
Constructor Detail
-
InboundWay
public InboundWay(Connection<?> connection, int bufferSize)
Deprecated.Constructor.- Parameters:
connection- The parent connection.bufferSize- The byte buffer size.
-
-
Method Detail
-
clear
public void clear()
Deprecated.Description copied from class:WayRecycles the way so it can be reused. Typically invoked by a connection pool.
-
createEntity
protected Representation createEntity(Series<Header> headers)
Deprecated.Returns the message entity if available.- Parameters:
headers- The headers to use.- Returns:
- The inbound message if available.
-
fillLine
protected boolean fillLine() throws java.io.IOExceptionDeprecated.Read the current message line (start line or header line).- Returns:
- True if the line is ready for reading.
- Throws:
java.io.IOException
-
getBuilderIndex
protected int getBuilderIndex()
Deprecated.Returns the line builder index.- Returns:
- The line builder index.
-
getEntityRegistration
protected SelectionRegistration getEntityRegistration()
Deprecated.Returns the NIO selection registration of the entity.- Returns:
- The NIO selection registration of the entity.
-
getInterestOperations
public int getInterestOperations()
Deprecated.Description copied from class:WayReturns the operations of interest.- Specified by:
getInterestOperationsin classWay- Returns:
- The operations of interest.
-
isLineReadable
protected boolean isLineReadable() throws java.io.IOExceptionDeprecated.Indicates if the next message line is readable.- Returns:
- True if the next message line is readable.
- Throws:
java.io.IOException
-
onDrain
public int onDrain(Buffer buffer, int maxDrained, java.lang.Object... args) throws java.io.IOException
Deprecated.Description copied from class:WayDrains the byte buffer by writing available bytes to the socket channel.- Specified by:
onDrainin interfaceBufferProcessor- Specified by:
onDrainin classWay- Parameters:
buffer- 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.- Returns:
- The number of bytes drained.
- Throws:
java.io.IOException
-
onError
public void onError(Status status)
Deprecated.Description copied from class:WayCalled on error.
-
onFill
public int onFill(Buffer buffer, java.lang.Object... args) throws java.io.IOException
Deprecated.Description copied from class:WayFills the byte buffer by writing the current message.- Specified by:
onFillin interfaceBufferProcessor- Specified by:
onFillin classWay- Parameters:
buffer- The IO buffer to drain.args- The optional arguments to pass back to the callbacks.- Returns:
- The number of bytes filled.
- Throws:
java.io.IOException
-
onFillEof
public void onFillEof()
Deprecated.Called back when a fill operation returns with an EOF status.
-
onHeadersCompleted
protected void onHeadersCompleted() throws java.io.IOExceptionDeprecated.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.- Specified by:
onHeadersCompletedin classWay- Throws:
java.io.IOException
-
onMessageCompleted
public void onMessageCompleted(boolean endDetected) throws java.io.IOExceptionDeprecated.Description copied from class:WayCallback method invoked when the current message has been completely received or sent.- Specified by:
onMessageCompletedin interfaceCompletionListener- Overrides:
onMessageCompletedin classWay- Parameters:
endDetected- Indicates if the end of the socket channel was detected.- Throws:
java.io.IOException
-
onPostProcessing
protected void onPostProcessing()
Deprecated.Description copied from class:WayCalled back after the IO processing to indicate if there is further IO interest. By default, it sets the IO state toIoState.INTEREST.- Specified by:
onPostProcessingin classWay
-
onReceived
protected abstract void onReceived(Response message) throws java.io.IOException
Deprecated.Call back invoked when the message is received.- Parameters:
message- The new message received.- Throws:
java.io.IOException
-
onTimeOut
public void onTimeOut()
Deprecated.Description copied from class:WayCalled back by the controller when an IO time out has been detected.
-
processIoBuffer
public int processIoBuffer() throws java.io.IOExceptionDeprecated.Description copied from class:WayProcesses the IO buffer by filling and draining it.- Overrides:
processIoBufferin classWay- Throws:
java.io.IOException
-
readHeader
protected Header readHeader() throws java.io.IOException
Deprecated.Read a message header.- Returns:
- The new message header or null.
- Throws:
java.io.IOException
-
readStartLine
protected abstract void readStartLine() throws java.io.IOExceptionDeprecated.Read the start line of the current message received.- Throws:
java.io.IOException
-
setBuilderIndex
protected void setBuilderIndex(int builderIndex)
Deprecated.Sets the line builder index.- Parameters:
builderIndex- The line builder index.
-
setEntityRegistration
protected void setEntityRegistration(SelectionRegistration entityRegistration)
Deprecated.Sets the NIO selection registration of the entity.- Parameters:
entityRegistration- The NIO selection registration of the entity.
-
updateState
public void updateState()
Deprecated.Description copied from class:WayUpdates the way IO and message states.- Overrides:
updateStatein classWay
-
-