*
* @return The FlexClient or null if the provided id was null.
*/
public FlexClient setupFlexClient(String id)
{
FlexClient flexClient = null;
if (id != null)
{
// This indicates that we're dealing with a non-legacy client that hasn't been
// assigned a FlexClient Id yet. Reset to null to generate a fresh Id.
if (id.equals("nil"))
id = null;
flexClient = getMessageBroker().getFlexClientManager().getFlexClient(id);
// Make sure the FlexClient and FlexSession are associated.
FlexSession session = FlexContext.getFlexSession();
flexClient.registerFlexSession(session);
// And place the FlexClient in FlexContext for this request.
FlexContext.setThreadLocalFlexClient(flexClient);
}
return flexClient;
}