Problem transforming exception response while using servlet connector

View: New views
1 Messages — Rating Filter:   Alert me  

Problem transforming exception response while using servlet connector

by Marco Mascia-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Folks,

I am in the process of migrating our application from mule 1.4 to mule 2.2.1 and I am having trouble migrating one piece where we use a service-override for servlet connector.

As shown below, we bascially have 2 different transformations (one for success and another for error condition). One of these 2 transformers is used while sending a response back to the client.

Looking at mule 2.2.1, this didn't seem to be possible.  Can somebody help me migrate this to mule 2.2.1.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        <bean id="servlet-connector" class="org.mule.providers.http.servlet.ServletConnector">
                <property name="serviceOverrides">
                        <map>
                                <entry key="message.receiver" value="com.xxxxx.xxxxx.ExceptionTransformingMessageReceiver"/>
                        </map>
                </property>
        </bean>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

public class ExceptionTransformingMessageReceiver extends org.mule.providers.http.servlet.ServletMessageReceiver {

  public ExceptionTransformingMessageReceiver(UMOConnector connector, UMOComponent component, UMOEndpoint endpoint) throws InitialisationException {
    super(connector, component, endpoint);
  }

  protected UMOMessage applyResponseTransformer(UMOMessage rawResponse) throws TransformerException {

    UMOMessage transformedResponse = null;
    UMOExceptionPayload exception = rawResponse.getExceptionPayload();
    if (exception != null) {
      /*
       * Exception message transformation:- 1. wrap exception up as an Exception Message 2. do the transformation 3. wrap response String as a MuleMessage
       */
        .....
    }
    else {
      /*
       * Normal message transformation
       */
      transformedResponse = super.applyResponseTransformer(rawResponse);
    }
    return transformedResponse;
}    

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Thanks in advance for any help!

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email