org.jboss.soa.esb.listeners.gateway.http
Class HttpMessageComposer<T extends HttpRequestWrapper>

java.lang.Object
  extended by org.jboss.soa.esb.listeners.message.AbstractMessageComposer<T>
      extended by org.jboss.soa.esb.listeners.gateway.http.HttpMessageComposer<T>
All Implemented Interfaces:
MessageComposer<T>

public class HttpMessageComposer<T extends HttpRequestWrapper>
extends AbstractMessageComposer<T>

Http Message Composer.

This class is used to compose the HttpServletRquest to ESB aware message and decompse the ESB aware message to HttpServletRespones

This class will put the http request header and other requst information in ESB message properties with the key "RequestInfoMap".

If the request is the submitted from html form(with the Content-Type: application/x-www-form-urlencoded), HttpServletRequest.getParameterMap() result) will be put in ESB message properties. The key for it is "RequestParamterMap". It put the the byte array read from request inputstream in message payload.

In decompose process, the header map in message properties will be added in HttpServletResponse. The value for "ReponseStatus" store in ESB message properties will put in the http response. The message payload byte[] or String object will be wrote to HttpServletResponse. If the object in message payload is not byte[],it will throw exception when the ESB message is decomposed

Author:
Jim Ma

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.soa.esb.listeners.message.MessageComposer
MessageComposer.Factory
 
Field Summary
static java.lang.String HTTP_RESPONSE_STATUS
          Response status key in esb message properties
 
Constructor Summary
HttpMessageComposer()
           
 
Method Summary
 java.lang.Object decompose(Message message, T requestWrapper)
          Decompose the message.
protected  MessagePayloadProxy getPayloadProxy()
           
 HttpRequest getRequestInfo(javax.servlet.http.HttpServletRequest request)
          Method for get request information from a servlet request The result includes the http header and other servlet request information
protected  void populateMessage(Message message, T requestWrapper)
          Populate
 void setConfiguration(ConfigTree config)
          Set the composers configuration.
 
Methods inherited from class org.jboss.soa.esb.listeners.message.AbstractMessageComposer
compose, getConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_RESPONSE_STATUS

public static final java.lang.String HTTP_RESPONSE_STATUS
Response status key in esb message properties

See Also:
Constant Field Values
Constructor Detail

HttpMessageComposer

public HttpMessageComposer()
Method Detail

setConfiguration

public void setConfiguration(ConfigTree config)
Description copied from class: AbstractMessageComposer
Set the composers configuration.

Specified by:
setConfiguration in interface MessageComposer<T extends HttpRequestWrapper>
Overrides:
setConfiguration in class AbstractMessageComposer<T extends HttpRequestWrapper>
Parameters:
config - Composer configuration.

getPayloadProxy

protected MessagePayloadProxy getPayloadProxy()
Overrides:
getPayloadProxy in class AbstractMessageComposer<T extends HttpRequestWrapper>

populateMessage

protected void populateMessage(Message message,
                               T requestWrapper)
                        throws MessageDeliverException
Description copied from class: AbstractMessageComposer
Populate

Specified by:
populateMessage in class AbstractMessageComposer<T extends HttpRequestWrapper>
Parameters:
message - The message instance to be populated.
requestWrapper - The message payload to to be populated into the message.
Throws:
MessageDeliverException - Unable to populate message with payload.

decompose

public java.lang.Object decompose(Message message,
                                  T requestWrapper)
                           throws MessageDeliverException
Description copied from class: AbstractMessageComposer
Decompose the message.

This implementation simple calls Body.get(ActionUtils.POST_ACTION_DATA)}. Override to implement an alternative Message decomposition strategy.

Specified by:
decompose in interface MessageComposer<T extends HttpRequestWrapper>
Overrides:
decompose in class AbstractMessageComposer<T extends HttpRequestWrapper>
Parameters:
message - The message to be decomposed.
requestWrapper - The original input message payload used to compose this (or ther original) message. The original message can sometimes contain information relevant during the decomposition process. Whether or not this parameter can be null depends on the MessageComposer implementation.
Returns:
The message "task object".
Throws:
MessageDeliverException - Failed to decompose message payload.

getRequestInfo

public HttpRequest getRequestInfo(javax.servlet.http.HttpServletRequest request)
Method for get request information from a servlet request The result includes the http header and other servlet request information

Parameters:
request - ServletRequest
Returns:
Request information includes the http header and other information parsed by servlet container from a servlet request