org.mule.transport.tcp.protocols
Class SafeProtocol
java.lang.Object
org.mule.transport.tcp.protocols.SafeProtocol
- All Implemented Interfaces:
- TcpProtocol
- Direct Known Subclasses:
- MuleMessageSafeProtocol
public class SafeProtocol
- extends java.lang.Object
- implements TcpProtocol
This precedes every message with a cookie.
It should probably not be used in production.
We use ths protocol as the default because previously people tended to use DefaultProtocol without considering packet fragmentation etc.
You should probably change to LengthProtocol.
Remember - both sender and receiver must use the same protocol.
Field Summary |
static java.lang.String |
COOKIE
|
Method Summary |
ResponseOutputStream |
createResponse(java.net.Socket socket)
This lets protocols encode a response stream. |
java.lang.Object |
read(java.io.InputStream is)
Reads the input stream and returns a whole message. |
void |
setMaxMessageLength(int maxMessageLength)
|
void |
write(java.io.OutputStream os,
java.lang.Object data)
Write the specified message to the output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COOKIE
public static final java.lang.String COOKIE
- See Also:
- Constant Field Values
SafeProtocol
public SafeProtocol()
read
public java.lang.Object read(java.io.InputStream is)
throws java.io.IOException
- Description copied from interface:
TcpProtocol
- Reads the input stream and returns a whole message.
- Specified by:
read
in interface TcpProtocol
- Parameters:
is
- the input stream
- Returns:
- an array of byte containing a full message
- Throws:
java.io.IOException
- if an exception occurs
write
public void write(java.io.OutputStream os,
java.lang.Object data)
throws java.io.IOException
- Description copied from interface:
TcpProtocol
- Write the specified message to the output stream.
- Specified by:
write
in interface TcpProtocol
- Parameters:
os
- the output stream to write todata
- the data to write
- Throws:
java.io.IOException
- if an exception occurs
createResponse
public ResponseOutputStream createResponse(java.net.Socket socket)
throws java.io.IOException
- Description copied from interface:
TcpProtocol
- This lets protocols encode a response stream. If the protocol does not support a
response stream (ie does not support streaming) then the stream should thrown an
exception when used.
- Specified by:
createResponse
in interface TcpProtocol
- Parameters:
socket
- The destination to write to
- Returns:
- A stream whose output will be encoded
- Throws:
java.io.IOException
setMaxMessageLength
public void setMaxMessageLength(int maxMessageLength)
Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.