Package flex.messaging.io.amf.client.exceptions

Examples of flex.messaging.io.amf.client.exceptions.ClientStatusException


    this.context = context;

    if( !connected )
    {
      String message = "AMF connection is not connected";
      ClientStatusException cse = new ClientStatusException( message, ClientStatusException.AMF_CALL_FAILED_CODE );
      throw cse;
    }

    String responseURI = getResponseURI();

    ActionMessage requestMessage = new ActionMessage( getObjectEncoding() );

    if( amfHeaders != null )
    {
      for( MessageHeader header : amfHeaders )
        requestMessage.addHeader( header );
    }

    MessageBody amfMessage = new MessageBody( command, responseURI, arguments );
    requestMessage.addBody( amfMessage );

    // Setup for AMF message serializer
    actionContext.setRequestMessage( requestMessage );
    ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
    AmfMessageSerializer amfMessageSerializer = new AmfMessageSerializer();
    amfMessageSerializer.initialize( serializationContext, outBuffer, null/* debugTrace */);

    try
    {
      amfMessageSerializer.writeMessage( requestMessage );
      Object result = send( outBuffer );
      return result;
    }
    catch( Exception e )
    {
      if( e instanceof ClientStatusException )
        throw ( ClientStatusException )e;
      else if( e instanceof ServerStatusException )
        throw ( ServerStatusException )e;
      // Otherwise, wrap into a ClientStatusException.
      ClientStatusException exception = new ClientStatusException( e, ClientStatusException.AMF_CALL_FAILED_CODE );
      throw exception;
    }
    finally
    {
      try
View Full Code Here


      serializationContext.createASObjectForMissingType = true;
      internalConnect();
    }
    catch( IOException e )
    {
      ClientStatusException exception = new ClientStatusException( e, ClientStatusException.AMF_CONNECT_FAILED_CODE );
      throw exception;
    }
  }
View Full Code Here

    public Object call(String command, Object ... arguments) throws ClientStatusException , ServerStatusException
    {
        if (!connected)
        {
            String message = "AMF connection is not connected";
            ClientStatusException cse = new ClientStatusException(message, ClientStatusException.AMF_CALL_FAILED_CODE);
            throw cse;
        }

        String responseURI = getResponseURI();

        // TODO: Support customizable batching of messages.
        ActionMessage requestMessage = new ActionMessage(getObjectEncoding());

        if (amfHeaders != null)
        {
            for (MessageHeader header : amfHeaders)
                requestMessage.addHeader(header);
        }

        MessageBody amfMessage = new MessageBody(command, responseURI, arguments);
        requestMessage.addBody(amfMessage);

        // Setup for AMF message serializer
        actionContext.setRequestMessage(requestMessage);
        ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
        AmfMessageSerializer amfMessageSerializer = new AmfMessageSerializer();
        amfMessageSerializer.initialize(serializationContext, outBuffer, null/*debugTrace*/);

        try
        {
            amfMessageSerializer.writeMessage(requestMessage);
            Object result = send(outBuffer);
            return result;
        }
        catch (Exception e)
        {
            if (e instanceof ClientStatusException)
                throw (ClientStatusException)e;
            else if (e instanceof ServerStatusException)
                throw (ServerStatusException)e;
            // Otherwise, wrap into a ClientStatusException.
            ClientStatusException exception = new ClientStatusException(e, ClientStatusException.AMF_CALL_FAILED_CODE);
            throw exception;
        }
        finally
        {
            try
View Full Code Here

            serializationContext.createASObjectForMissingType = true;
            internalConnect();
        }
        catch (IOException e)
        {
            ClientStatusException exception = new ClientStatusException(e, ClientStatusException.AMF_CONNECT_FAILED_CODE);
            throw exception;
        }
    }
View Full Code Here

            throws ClientStatusException, ServerStatusException {
        this.context = context;

        if (!connected) {
            String message = "AMF connection is not connected";
            ClientStatusException cse = new ClientStatusException(message, ClientStatusException.AMF_CALL_FAILED_CODE);
            throw cse;
        }

        String responseURI = getResponseURI();

        ActionMessage requestMessage = new ActionMessage(getObjectEncoding());

        if (amfHeaders != null) {
            for (MessageHeader header : amfHeaders) {
                requestMessage.addHeader(header);
            }
        }

        MessageBody amfMessage = new MessageBody(command, responseURI, arguments);
        requestMessage.addBody(amfMessage);

        // Setup for AMF message serializer
        actionContext.setRequestMessage(requestMessage);
        ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
        AmfMessageSerializer amfMessageSerializer = new AmfMessageSerializer();
        amfMessageSerializer.initialize(serializationContext, outBuffer, null/* debugTrace */);

        try {
            amfMessageSerializer.writeMessage(requestMessage);
            Object result = send(outBuffer);
            return result;
        } catch (Exception e) {
            if (e instanceof ClientStatusException) {
                throw (ClientStatusException) e;
            } else if (e instanceof ServerStatusException) {
                throw (ServerStatusException) e;
            }
            // Otherwise, wrap into a ClientStatusException.
            ClientStatusException exception = new ClientStatusException(e, ClientStatusException.AMF_CALL_FAILED_CODE);
            throw exception;
        } finally {
            try {
                outBuffer.close();
            } catch (IOException ignore) {
View Full Code Here

        try {
            serializationContext = new SerializationContext();
            serializationContext.createASObjectForMissingType = true;
            internalConnect();
        } catch (IOException e) {
            ClientStatusException exception = new ClientStatusException(e, ClientStatusException.AMF_CONNECT_FAILED_CODE);
            throw exception;
        }
    }
View Full Code Here

TOP

Related Classes of flex.messaging.io.amf.client.exceptions.ClientStatusException

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.