org.mule.providers.servlet
Class HttpRequestMessageAdapter

java.lang.Object
  extended byorg.mule.providers.servlet.HttpRequestMessageAdapter
All Implemented Interfaces:
java.io.Serializable, UMOMessageAdapter

public class HttpRequestMessageAdapter
extends java.lang.Object
implements UMOMessageAdapter

HttpRequestMessageAdapter TODO

Version:
$Revision: 1.2 $
Author:
Ross Mason
See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_PAYLOAD_PARAMETER_NAME
           
static java.lang.String PAYLOAD_PARAMETER_NAME
           
 
Constructor Summary
HttpRequestMessageAdapter(java.lang.Object message)
           
 
Method Summary
 boolean getBooleanProperty(java.lang.String name, boolean defaultValue)
          Gets a boolean property from the event
 int getCorrelationGroupSize()
          Determines how many messages are in the correlation group
 java.lang.String getCorrelationId()
          Sets a correlationId for this message.
 int getCorrelationSequence()
          Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)
 double getDoubleProperty(java.lang.String name, double defaultValue)
          Gets a double property from the event
 int getErrorCode()
          If an error occurred during the processing of this message this will return a value greater than zero
 int getIntProperty(java.lang.String name, int defaultValue)
          Gets an integer property from the event
 long getLongProperty(java.lang.String name, long defaultValue)
          Gets a long property from the event
 java.lang.Object getPayload()
           
 byte[] getPayloadAsBytes()
          Converts the message implementation into a String representation
 java.lang.String getPayloadAsString()
          Converts the message implementation into a String representation
 java.lang.Object getProperty(java.lang.Object key)
          Gets a property of the message implementation
 java.lang.Object getProperty(java.lang.String name, java.lang.Object defaultValue)
          Gets a property from the event
 java.util.Iterator getPropertyNames()
           
 java.lang.Object getReplyTo()
          Sets a replyTo address for this message.
 HttpServletRequest getRequest()
           
 java.lang.String getUniqueId()
          gets the unique identifier for the message.
 boolean isBinary()
           
protected  boolean isText(java.lang.String contentType)
           
 java.lang.Object removeProperty(java.lang.Object key)
          Removes a property on this message
 void setBooleanProperty(java.lang.String name, boolean value)
          Sets a boolean property on the event
 void setCorrelationGroupSize(int size)
          Determines how many messages are in the correlation group
 void setCorrelationId(java.lang.String id)
          Sets a correlationId for this message.
 void setCorrelationSequence(int sequence)
          Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)
 void setDoubleProperty(java.lang.String name, double value)
          Sets a double property on the event
 void setErrorCode(int code)
          If an error occurs while processing this message, this error code should be set to a value greater than zero and the palyoad of the this message should contain the error details
 void setIntProperty(java.lang.String name, int value)
          Sets a integerproperty on the event
 void setLongProperty(java.lang.String name, long value)
          Sets a long property on the event
 void setProperty(java.lang.Object key, java.lang.Object value)
          Set a property on the message
 void setReplyTo(java.lang.Object replyTo)
          Sets a replyTo address for this message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAYLOAD_PARAMETER_NAME

public static final java.lang.String PAYLOAD_PARAMETER_NAME
See Also:
Constant Field Values

DEFAULT_PAYLOAD_PARAMETER_NAME

public static final java.lang.String DEFAULT_PAYLOAD_PARAMETER_NAME
See Also:
Constant Field Values
Constructor Detail

HttpRequestMessageAdapter

public HttpRequestMessageAdapter(java.lang.Object message)
                          throws MessageException
Method Detail

getPayload

public java.lang.Object getPayload()
Specified by:
getPayload in interface UMOMessageAdapter
Returns:
the current message

isBinary

public boolean isBinary()

getPayloadAsBytes

public byte[] getPayloadAsBytes()
                         throws java.lang.Exception
Description copied from interface: UMOMessageAdapter
Converts the message implementation into a String representation

Specified by:
getPayloadAsBytes in interface UMOMessageAdapter
Returns:
String representation of the message
Throws:
java.lang.Exception - Implemetation may throw an endpoint specific exception

getPayloadAsString

public java.lang.String getPayloadAsString()
                                    throws java.lang.Exception
Description copied from interface: UMOMessageAdapter
Converts the message implementation into a String representation

Specified by:
getPayloadAsString in interface UMOMessageAdapter
Returns:
String representation of the message payload
Throws:
java.lang.Exception - Implementation may throw an endpoint specific exception

getRequest

public HttpServletRequest getRequest()

getProperty

public java.lang.Object getProperty(java.lang.Object key)
Description copied from interface: UMOMessageAdapter
Gets a property of the message implementation

Specified by:
getProperty in interface UMOMessageAdapter
Parameters:
key - the key on which to lookup the property value
Returns:
the property value or null if the property does not exist

setProperty

public void setProperty(java.lang.Object key,
                        java.lang.Object value)
Description copied from interface: UMOMessageAdapter
Set a property on the message

Specified by:
setProperty in interface UMOMessageAdapter
Parameters:
key - the key on which to associate the value
value - the property value

removeProperty

public java.lang.Object removeProperty(java.lang.Object key)
Description copied from interface: UMOMessageAdapter
Removes a property on this message

Specified by:
removeProperty in interface UMOMessageAdapter
Parameters:
key - the property key to remove
Returns:
the removed property value or null if the property did not exist

getPropertyNames

public java.util.Iterator getPropertyNames()
Specified by:
getPropertyNames in interface UMOMessageAdapter
Returns:
all properties on this message

getUniqueId

public java.lang.String getUniqueId()
                             throws UniqueIdNotSupportedException
Description copied from interface: UMOMessageAdapter
gets the unique identifier for the message. It's up to the implementation to ensure a unique id

Specified by:
getUniqueId in interface UMOMessageAdapter
Returns:
a unique message id
Throws:
UniqueIdNotSupportedException - if the message does not support a unique identifier

isText

protected boolean isText(java.lang.String contentType)

getProperty

public java.lang.Object getProperty(java.lang.String name,
                                    java.lang.Object defaultValue)
Description copied from interface: UMOMessageAdapter
Gets a property from the event

Specified by:
getProperty in interface UMOMessageAdapter
Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

getIntProperty

public int getIntProperty(java.lang.String name,
                          int defaultValue)
Description copied from interface: UMOMessageAdapter
Gets an integer property from the event

Specified by:
getIntProperty in interface UMOMessageAdapter
Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

getLongProperty

public long getLongProperty(java.lang.String name,
                            long defaultValue)
Description copied from interface: UMOMessageAdapter
Gets a long property from the event

Specified by:
getLongProperty in interface UMOMessageAdapter
Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

getDoubleProperty

public double getDoubleProperty(java.lang.String name,
                                double defaultValue)
Description copied from interface: UMOMessageAdapter
Gets a double property from the event

Specified by:
getDoubleProperty in interface UMOMessageAdapter
Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name,
                                  boolean defaultValue)
Description copied from interface: UMOMessageAdapter
Gets a boolean property from the event

Specified by:
getBooleanProperty in interface UMOMessageAdapter
Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

setBooleanProperty

public void setBooleanProperty(java.lang.String name,
                               boolean value)
Description copied from interface: UMOMessageAdapter
Sets a boolean property on the event

Specified by:
setBooleanProperty in interface UMOMessageAdapter
Parameters:
name - the property name or key
value - the property value

setIntProperty

public void setIntProperty(java.lang.String name,
                           int value)
Description copied from interface: UMOMessageAdapter
Sets a integerproperty on the event

Specified by:
setIntProperty in interface UMOMessageAdapter
Parameters:
name - the property name or key
value - the property value

setLongProperty

public void setLongProperty(java.lang.String name,
                            long value)
Description copied from interface: UMOMessageAdapter
Sets a long property on the event

Specified by:
setLongProperty in interface UMOMessageAdapter
Parameters:
name - the property name or key
value - the property value

setDoubleProperty

public void setDoubleProperty(java.lang.String name,
                              double value)
Description copied from interface: UMOMessageAdapter
Sets a double property on the event

Specified by:
setDoubleProperty in interface UMOMessageAdapter
Parameters:
name - the property name or key
value - the property value

setCorrelationId

public void setCorrelationId(java.lang.String id)
Sets a correlationId for this message. The correlation Id can be used by components in the system to manage message relations

transport protocol. As such not all messages will support the notion of a correlationId i.e. tcp or file. In this situation the correlation Id is set as a property of the message where it's up to developer to keep the association with the message. For example if the message is serialised to xml the correlationId will be available in the message.

Specified by:
setCorrelationId in interface UMOMessageAdapter
Parameters:
id - the Id reference for this relationship

getCorrelationId

public java.lang.String getCorrelationId()
Sets a correlationId for this message. The correlation Id can be used by components in the system to manage message relations.

The correlationId is associated with the message using the underlying transport protocol. As such not all messages will support the notion of a correlationId i.e. tcp or file. In this situation the correlation Id is set as a property of the message where it's up to developer to keep the association with the message. For example if the message is serialised to xml the correlationId will be available in the message.

Specified by:
getCorrelationId in interface UMOMessageAdapter
Returns:
the correlationId for this message or null if one hasn't been set

setReplyTo

public void setReplyTo(java.lang.Object replyTo)
Sets a replyTo address for this message. This is useful in an asynchronous environment where the caller doesn't wait for a response and the response needs to be routed somewhere for further processing. The value of this field can be any valid endpointUri url.

Specified by:
setReplyTo in interface UMOMessageAdapter
Parameters:
replyTo - the endpointUri url to reply to

getReplyTo

public java.lang.Object getReplyTo()
Sets a replyTo address for this message. This is useful in an asynchronous environment where the caller doesn't wait for a response and the response needs to be routed somewhere for further processing. The value of this field can be any valid endpointUri url.

Specified by:
getReplyTo in interface UMOMessageAdapter
Returns:
the endpointUri url to reply to or null if one has not been set

getCorrelationSequence

public int getCorrelationSequence()
Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)

Specified by:
getCorrelationSequence in interface UMOMessageAdapter
Returns:
the sequence number or -1 if the sequence is not important

setCorrelationSequence

public void setCorrelationSequence(int sequence)
Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)

Specified by:
setCorrelationSequence in interface UMOMessageAdapter
Parameters:
sequence - the sequence number or -1 if the sequence is not important

getCorrelationGroupSize

public int getCorrelationGroupSize()
Determines how many messages are in the correlation group

Specified by:
getCorrelationGroupSize in interface UMOMessageAdapter
Returns:
total messages in this group or -1 if the size is not known

setCorrelationGroupSize

public void setCorrelationGroupSize(int size)
Determines how many messages are in the correlation group

Specified by:
setCorrelationGroupSize in interface UMOMessageAdapter
Parameters:
size - the total messages in this group or -1 if the size is not known

getErrorCode

public int getErrorCode()
If an error occurred during the processing of this message this will return a value greater than zero

Specified by:
getErrorCode in interface UMOMessageAdapter
Returns:

setErrorCode

public void setErrorCode(int code)
If an error occurs while processing this message, this error code should be set to a value greater than zero and the palyoad of the this message should contain the error details

Specified by:
setErrorCode in interface UMOMessageAdapter
Parameters:
code -


Copyright © 2003-2005 SymphonySoft Limited. All Rights Reserved.