Class DefaultWriteRequest
java.lang.Object
org.apache.mina.core.write.DefaultWriteRequest
- All Implemented Interfaces:
WriteRequest
- Direct Known Subclasses:
ProtocolCodecFilter.EncodedWriteRequest, SslFilter.EncryptedWriteRequest
The default implementation of
WriteRequest.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SocketAddressThe peer destination (useless ???)static final byte[]An empty messageprivate final WriteFutureThe associated Futureprivate ObjectThe message that will ultimately be written to the remote peerprivate final ObjectThe original message as it was written by the IoHandler.private static final WriteFutureAn empty FUTURE -
Constructor Summary
ConstructorsConstructorDescriptionDefaultWriteRequest(Object message) Creates a new instance withoutWriteFuture.DefaultWriteRequest(Object message, WriteFuture future) Creates a new instance withWriteFuture.DefaultWriteRequest(Object message, WriteFuture future, SocketAddress destination) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the destination of this write request.booleanTells if the current message has been encodedvoidsetMessage(Object modifiedMessage) Set the modified message after it has been processed by a filter.toString()
-
Field Details
-
EMPTY_MESSAGE
public static final byte[] EMPTY_MESSAGEAn empty message -
UNUSED_FUTURE
An empty FUTURE -
originalMessage
The original message as it was written by the IoHandler. It will be sent back in the messageSent event -
message
The message that will ultimately be written to the remote peer -
future
The associated Future -
destination
The peer destination (useless ???)
-
-
Constructor Details
-
DefaultWriteRequest
Creates a new instance withoutWriteFuture. You'll get an instance ofWriteFutureeven if you called this constructor becausegetFuture()will return a bogus future.- Parameters:
message- The message that will be written
-
DefaultWriteRequest
Creates a new instance withWriteFuture.- Parameters:
message- The message that will be writtenfuture- The associatedWriteFuture
-
DefaultWriteRequest
Creates a new instance.- Parameters:
message- a message to writefuture- a future that needs to be notified when an operation is finisheddestination- the destination of the message. This property will be ignored unless the transport supports it.
-
-
Method Details
-
getFuture
- Specified by:
getFuturein interfaceWriteRequest- Returns:
WriteFuturethat is associated with this write request.
-
getMessage
- Specified by:
getMessagein interfaceWriteRequest- Returns:
- a message object to be written.
-
setMessage
Set the modified message after it has been processed by a filter.- Specified by:
setMessagein interfaceWriteRequest- Parameters:
modifiedMessage- The modified message
-
getOriginalMessage
- Specified by:
getOriginalMessagein interfaceWriteRequest- Returns:
- the original message which was sent to the session, before any filter transformation.
-
getOriginalRequest
- Specified by:
getOriginalRequestin interfaceWriteRequest- Returns:
- the
WriteRequestwhich was requested originally, which is not transformed by anyIoFilter.
-
getDestination
Returns the destination of this write request.- Specified by:
getDestinationin interfaceWriteRequest- Returns:
nullfor the default destination
-
toString
-
isEncoded
public boolean isEncoded()Tells if the current message has been encoded- Specified by:
isEncodedin interfaceWriteRequest- Returns:
- true if the message has already been encoded
-