org.mule.api
Interface MuleSession

All Superinterfaces:
Serializable
All Known Implementing Classes:
DefaultMuleSession

public interface MuleSession
extends Serializable

MuleSession is the context in which a request is processed by Mule. The scope of the MuleSession context includes all Mule Flows and Services that the request is routed through on the same or different Mule instances. A MuleSession instance has a unique id, session scope properties and an optional security context.

In order for the session to be propagated from one Flow or Service to the next a transports that support message properties needs to be used. A SessionHandler is used to store the session in an outbound message property and then retrieve it from an inbound property using a specific strategy.

See Also:
SessionHandler

Method Summary
 void clearProperties()
           
 FlowConstruct getFlowConstruct()
          Deprecated. 
 String getId()
          Returns the unique id for this session
<T> T
getProperty(Object key)
          Deprecated. 
<T> T
getProperty(String key)
          Will retrieve a session scope property.
 Iterator getPropertyNames()
          Deprecated. Use getPropertyNamesAsSet() instead (Will be removed in 4.0)
 Set<String> getPropertyNamesAsSet()
           
 SecurityContext getSecurityContext()
          The security context for this session.
 boolean isValid()
          Determines if this session is valid.
 void merge(MuleSession updatedSession)
          Merge current session with an updated version Result session will contain all the properties from updatedSession plus those properties in the current session that couldn't be serialized In case updatedSession is null, then no change will be applied.
 Object removeProperty(Object key)
          Deprecated. 
 Object removeProperty(String key)
          Will retrieve a session scope property and remove it from the session
 void setFlowConstruct(FlowConstruct flowConstruct)
          Deprecated. 
 void setProperty(String key, Object value)
          Deprecated. 
 void setProperty(String key, Serializable value)
          Will set a session scope property.
 void setSecurityContext(SecurityContext context)
          The security context for this session.
 void setValid(boolean value)
          Determines if this session is valid.
 

Method Detail

isValid

boolean isValid()
Determines if this session is valid. A session becomes invalid if an exception occurs while processing

Returns:
true if the session is valid, false otherwise

setValid

void setValid(boolean value)
Determines if this session is valid. A session becomes invalid if an exception occurs while processing

Parameters:
value - true if the session is valid, false otherwise

getId

String getId()
Returns the unique id for this session

Returns:
the unique id for this session

setSecurityContext

void setSecurityContext(SecurityContext context)
The security context for this session. If not null outbound, inbound and/or method invocations will be authenticated using this context

Parameters:
context - the context for this session or null if the request is not secure.

getSecurityContext

SecurityContext getSecurityContext()
The security context for this session. If not null outbound, inbound and/or method invocations will be authenticated using this context

Returns:
the context for this session or null if the request is not secure.

setProperty

void setProperty(String key,
                 Serializable value)
Will set a session scope property.

Parameters:
key - the key for the object data being stored on the session
value - the value of the session data

setProperty

@Deprecated
void setProperty(String key,
                            Object value)
Deprecated. 


getProperty

<T> T getProperty(String key)
Will retrieve a session scope property.

Parameters:
key - the key for the object data being stored on the session
Returns:
the value of the session data or null if the property does not exist

getProperty

@Deprecated
<T> T getProperty(Object key)
Deprecated. 


removeProperty

Object removeProperty(String key)
Will retrieve a session scope property and remove it from the session

Parameters:
key - the key for the object data being stored on the session
Returns:
the value of the session data or null if the property does not exist

removeProperty

@Deprecated
Object removeProperty(Object key)
Deprecated. 


getPropertyNames

Iterator getPropertyNames()
Deprecated. Use getPropertyNamesAsSet() instead (Will be removed in 4.0)

Returns an iterater of property keys for the session properties on this session

Returns:
an iterater of property keys for the session properties on this session

getPropertyNamesAsSet

Set<String> getPropertyNamesAsSet()
Returns:
property keys for all session properties

merge

void merge(MuleSession updatedSession)
Merge current session with an updated version Result session will contain all the properties from updatedSession plus those properties in the current session that couldn't be serialized In case updatedSession is null, then no change will be applied.

Parameters:
updatedSession - mule session with updated properties

clearProperties

void clearProperties()

getFlowConstruct

@Deprecated
FlowConstruct getFlowConstruct()
Deprecated. 

WANRING: This method will always return null unless you created the DefaultMuleSession with a flowConstruct or set one using the setter. This method should not be used, and is only here for bacwards compatability


setFlowConstruct

@Deprecated
void setFlowConstruct(FlowConstruct flowConstruct)
Deprecated. 

WANRING: This method should not be used, and is only here for bacwards compatability



Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.