Package flex.messaging.client

Examples of flex.messaging.client.FlexClient


     */
    public static Principal getUserPrincipal()
    {
        if (isPerClientAuthentication())
        {
            FlexClient client = getFlexClient();
            if (client != null)
                return client.getUserPrincipal();
        }
        else
        {
            FlexSession session = getFlexSession();
            if (session != null)
View Full Code Here


            double msgVersion = endpoint.getMessagingVersion();
            if (msgVersion > 0)
                replyMessage.setHeader(CommandMessage.MESSAGING_VERSION, new Double(msgVersion));

            // Record the flex client ID
            FlexClient flexClient = FlexContext.getFlexClient();
            if (flexClient != null)
                replyMessage.setHeader(Message.FLEX_CLIENT_ID_HEADER, flexClient.getId());
        }
        else if (!serviced)
        {
            MessageException lme = new MessageException();
            // No destination with id ''{0}'' is registered with any service.
View Full Code Here

        // Route the message and the MessageClient (subscription) to the FlexClient to
        // queue the message for delivery to the remote client.
        // Reset the thread local FlexClient and FlexSession to be specific to the client
        // we're pushing to, and then reset the context back to its original request handling state.
        FlexClient requestFlexClient = FlexContext.getFlexClient();
        FlexSession requestFlexSession = FlexContext.getFlexSession();

        FlexClient pushFlexClient = messageClient.getFlexClient();
        FlexContext.setThreadLocalFlexClient(pushFlexClient);
        FlexContext.setThreadLocalSession(null); // Null because we don't have a currently active endpoint for the push client.

        pushFlexClient.push(message, messageClient);

        // and reset thread locals.
        FlexContext.setThreadLocalFlexClient(requestFlexClient);
        FlexContext.setThreadLocalSession(requestFlexSession);
    }
View Full Code Here

        {
            // Handle resubscribes from the same client and duplicate subscribes from different clients
            boolean subscriptionAlreadyExists = (getSubscriber(clientId) != null);
            client = getMessageClient(clientId, endpointId);

            FlexClient flexClient = FlexContext.getFlexClient();
            if (subscriptionAlreadyExists)
            {
                // Block duplicate subscriptions from multiple FlexClients if they
                // attempt to use the same clientId.  (when this is called from a remote
                // subscription, there won't be a flex client so skip this test).
                if (flexClient != null && !flexClient.getId().equals(client.getFlexClient().getId()))
                {
                    ServiceException se = new ServiceException();
                    se.setMessage(10559, new Object[] {clientId});
                    throw se;
                }
View Full Code Here

     */
    public static Principal getUserPrincipal()
    {       
      if (isPerClientAuthentication())
      {
        FlexClient client = getFlexClient();
        if (client != null)
          return client.getUserPrincipal();
      }
      else
      {
        FlexSession session = getFlexSession();
        if (session != null)
View Full Code Here

     * @see flex.messaging.endpoints.AbstractEndpoint#handleChannelDisconnect(CommandMessage)
     */
    protected Message handleChannelDisconnect(CommandMessage disconnectCommand)
    {       
        HttpFlexSession session = (HttpFlexSession)FlexContext.getFlexSession();
        FlexClient flexClient = FlexContext.getFlexClient();
       
        // Shut down any subscriptions established over this channel/endpoint
        // for this specific FlexClient.
        if (flexClient.isValid())
        {
            String endpointId = getId();           
            List messageClients = flexClient.getMessageClients();
            for (Iterator iter = messageClients.iterator(); iter.hasNext();)
            {
                MessageClient messageClient = (MessageClient)iter.next();
                if (messageClient.getEndpointId().equals(endpointId))
                {
View Full Code Here

            double msgVersion = endpoint.getMessagingVersion();
            if (msgVersion > 0)
                replyMessage.setHeader(CommandMessage.MESSAGING_VERSION, new Double(msgVersion));

            // Record the flex client ID
            FlexClient flexClient = FlexContext.getFlexClient();
            if (flexClient != null)
                replyMessage.setHeader(Message.FLEX_CLIENT_ID_HEADER, flexClient.getId());
        }
        else if (!serviced)
        {
            MessageException lme = new MessageException();
            // No destination with id ''{0}'' is registered with any service.
View Full Code Here

        // Route the message and the MessageClient (subscription) to the FlexClient to
        // queue the message for delivery to the remote client.
        // Reset the thread local FlexClient and FlexSession to be specific to the client
        // we're pushing to, and then reset the context back to its original request handling state.
        FlexClient requestFlexClient = FlexContext.getFlexClient();
        FlexSession requestFlexSession = FlexContext.getFlexSession();
       
        FlexClient pushFlexClient = messageClient.getFlexClient();
        FlexContext.setThreadLocalFlexClient(pushFlexClient);
        FlexContext.setThreadLocalSession(null); // Null because we don't have a currently active endpoint for the push client.
               
        pushFlexClient.push(message, messageClient);
       
        // and reset thread locals.
        FlexContext.setThreadLocalFlexClient(requestFlexClient);
        FlexContext.setThreadLocalSession(requestFlexSession);
    }
View Full Code Here

        // We don't do this validation with CLOSE_COMMAND because CLOSE_COMMAND can come in on a
        // different session. For example, when the session expires due to timeout, the streaming client
        // using that session sends a CLOSE_COMMAND on a new session to let the server know to clean client's
        // corresponding server constructs. In that case, server already knows that session has expired so
        // we can simply omit this validation.
        FlexClient flexClient = null;
        List flexClients = FlexContext.getFlexSession().getFlexClients();           
        boolean validFlexClientId = false;
        for (Iterator iter = flexClients.iterator(); iter.hasNext();)
        {
            flexClient = (FlexClient)iter.next();
            if (flexClient.getId().equals(flexClientId) && flexClient.isValid())
            {
                validFlexClientId = true;
                break;
            }
        }
View Full Code Here

            if (operation == CommandMessage.POLL_OPERATION && message.getClientId() == null)
            {
                verifyFlexClientSupport(command);
               
               
                FlexClient flexClient = FlexContext.getFlexClient();
                ack = handleFlexClientPollCommand(flexClient, command);                                                                                           
            }
            else if (operation == CommandMessage.DISCONNECT_OPERATION)
            {
                ack = handleChannelDisconnect(command);
View Full Code Here

TOP

Related Classes of flex.messaging.client.FlexClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.