Accessing the HttpSession in mule

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

Accessing the HttpSession in mule

by Richard Swart :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does anyone know how to access the httpsession in a component class that receives an inbound httpRequest? As you can see from the config below I'm transforming the httprequest into a parametermap and can read all of the values from the request successfully. However I need to be able to store some of the user's details in the HttpSession and there seems to be zero examples of this.

<service name="FunctionControllerUMO">
            <inbound>
            <https:inbound-endpoint host="localhost" port="30200" path="mobileFunctionController" synchronous="true" connector-ref="httpsConnector" transformer-refs="HttpRequestBodyToParamMap" responseTransformer-refs="XMLResponseTransformer" />            
            </inbound>
                      <component class="com.infinity.mobile.mule.servlet.FunctionControllerImpl" />
            <default-service-exception-strategy>
                      <vm:outbound-endpoint path="systemErrorHandler"/>
            </default-service-exception-strategy>
</service>  


public class FunctionControllerImpl {
       
        public String execute(HashMap<String, ?> map) {

                        map.get("someparam");

                        // I want to store objects in the session here!!

                }

}

Thanks in advance.

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

    http://xircles.codehaus.org/manage_email



Re: Accessing the HttpSession in mule

by Richard Swart :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't believe there such thing as a HttpSession in Mule. This is a http servlet contruct.

Services are typically stateless, which I also consider as a good design principle for services. If you really want statefull services you'll have to add this yourself by persisting the state in some kind of clustered cache (terracotta, gigaspaces) or a database.

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

    http://xircles.codehaus.org/manage_email



Re: Re: Accessing the HttpSession in mule

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think this call http://www.mulesource.org/docs/site/2.2.1/apidocs/org/mule/api/MuleEvent.html#getSession%28%29 maps to http session when needed.

HTH,
Andrew

Re: Accessing the HttpSession in mule

by Richard Swart :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for both of the responses to this query.

Andrew I think I see what you're saying in that you could use the MuleSession to store values but I'm not sure if this persists between requests for the requesting client?

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

    http://xircles.codehaus.org/manage_email