Package flex.messaging.client

Examples of flex.messaging.client.FlexClient$EndpointQueue


     */
    public FlushResult flush(List outboundQueue)
    {
      int delay = delayTimeBetweenFlushes;
      // Read custom delay from client's FlexClient instance
      FlexClient flexClient = getFlexClient();
      if (flexClient != null)
      {
      Object obj = flexClient.getAttribute("market-data-delay");
        if (obj != null)
        {
        try {
          delay = Integer.parseInt((String) obj);
        } catch (NumberFormatException ignore) {
View Full Code Here


public class FlexClientConfigService
{

  public void setAttribute(String name, Object value)
  {
    FlexClient flexClient = FlexContext.getFlexClient();
    flexClient.setAttribute(name, value);
  }
View Full Code Here

    flexClient.setAttribute(name, value);
  }

  public List getAttributes()
  {
    FlexClient flexClient = FlexContext.getFlexClient();
    List attributes = new ArrayList();
    Enumeration attrNames = flexClient.getAttributeNames();
    while (attrNames.hasMoreElements())
    {
      String attrName = (String) attrNames.nextElement();
      attributes.add(new Attribute(attrName, flexClient.getAttribute(attrName)));
    }

    return attributes;
   
  }
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

        {
            // 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

    *
    * @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;
   }
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

    *
    * @return The FlexClient or null if the message did not contain a FlexClient id value.
    */
   public FlexClient setupFlexClient(Message message)
   {
       FlexClient flexClient = null;
       if (message.getHeaders().containsKey(Message.FLEX_CLIENT_ID_HEADER))
       {
           String id = (String)message.getHeaders().get(Message.FLEX_CLIENT_ID_HEADER);
           // If the id is null, reset to the special token value that let's us differentiate
           // between legacy clients and 2.5+ clients.
View Full Code Here

     *
     * @see AbstractEndpoint#setupFlexClient(String)
     */
    public FlexClient setupFlexClient(String id)
    {
        FlexClient flexClient = super.setupFlexClient(id);
       
        // Scan for duplicate HTTP-sessions and if found, invalidate them and throw a MessageException.
        // A request attribute is used to deal with batched AMF messages that arrive in a single request by trigger multiple passes through this method.
        boolean duplicateSessionDetected = (FlexContext.getHttpRequest().getAttribute(REQUEST_ATTR_DUPLICATE_SESSION_FLAG) != null)
                                           ? true : false;
       
        if (!duplicateSessionDetected)
        {
            List sessions = flexClient.getFlexSessions();
            int n = sessions.size();
            if (n > 1)
            {
                int count = 0;           
                for (int i = 0; i < n; i++)
                {
                    if (sessions.get(i) instanceof HttpFlexSession)
                        count++;
                    if (count > 1)
                    {
                        FlexContext.getHttpRequest().setAttribute(REQUEST_ATTR_DUPLICATE_SESSION_FLAG, Boolean.TRUE);
                        duplicateSessionDetected = true;
                        break;
                    }
                }
            }
        }
       
        // If more than one was found, remote host isn't using session cookies. Kill all duplicate sessions and return an error.
        // Simplest to just re-scan the list given that it will be very short, but use an iterator for concurrent modification.
        if (duplicateSessionDetected)
        {
            List sessions = flexClient.getFlexSessions();
            for (Iterator iter = sessions.iterator(); iter.hasNext();)
            {
                FlexSession session = (FlexSession)iter.next();
                if (session instanceof HttpFlexSession)
                    session.invalidate();
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

TOP

Related Classes of flex.messaging.client.FlexClient$EndpointQueue

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.