Package flex.messaging.io

Examples of flex.messaging.io.MessageSerializer


                    if (context.isRecordMessageSizes())
                        serializationOverhead = System.currentTimeMillis();                    
                }       
               
                // Use the thread local serialization context to serialize the response.
                MessageSerializer serializer = serializationContext.newMessageSerializer();
                serializer.initialize(serializationContext, outBuffer, debugTrace);
                serializer.writeMessage(respMesg);
               
                // Keep track of serializes bytes for performance metrics.
                context.setSerializedBytes(outBuffer.size());
               
                // Serialize message again after adding info if mpio with sizing is enabled.
                if (context.isRecordMessageSizes())
                {
                    try
                    {                          
                        context.getMPIO().messageSize = outBuffer.size();
                       
                        // Reset server send time.          
                        if (context.isRecordMessageTimes())
                        {
                            serializationOverhead = System.currentTimeMillis() - serializationOverhead;
                            context.getMPIO().addToOverhead(serializationOverhead);
                            context.getMPIO().sendTime = System.currentTimeMillis();
                        }
                       
                        // Reserialize the message now that info has been added.
                        outBuffer = new ByteArrayOutputStream();
                        respMesg = context.getResponseMessage();
                        serializer = serializationContext.newMessageSerializer();
                        serializer.initialize(serializationContext, outBuffer, debugTrace);
                        serializer.writeMessage(respMesg);
                    }
                    catch(Exception e)
                    {
                        if (Log.isDebug())
                            logger.debug("MPI set up error: " + e.toString());
View Full Code Here


        if (Log.isError())
            logger.error("Exception occurred during serialization: " + ExceptionUtil.toString(t));

        // Serialize the error messages.
        SerializationContext sc = SerializationContext.getSerializationContext();
        MessageSerializer serializer = sc.newMessageSerializer();
        ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
        AmfTrace debugTrace = Log.isDebug() ? new AmfTrace() : null;
        serializer.initialize(sc, outBuffer, debugTrace);

        try
        {
            serializer.writeMessage(context.getResponseMessage());
            context.setResponseOutput(outBuffer);
        }
        catch (IOException e)
        {
            // Error serializing response.
View Full Code Here

                        // set server send time
                        context.getMPIO().sendTime = System.currentTimeMillis();
                        if(context.isRecordMessageSizes())
                            serializationOverhead = System.currentTimeMillis();
                    }
                    MessageSerializer serializer = sc.newMessageSerializer();
                    serializer.initialize(sc, outBuffer, debugTrace);
                    serializer.writeMessage(respMesg);

                    // keep track of serializes bytes for performance metrics
                    context.setSerializedBytes(outBuffer.size());

                    // serialized message again after adding info if mpio with sizing is enabled
                    if(context.isRecordMessageSizes())
                    {
                        try
                        {
                            context.getMPIO().messageSize = outBuffer.size();

                            // reset server send time
                            if(context.isRecordMessageTimes())
                            {
                                serializationOverhead = System.currentTimeMillis() - serializationOverhead;
                                context.getMPIO().addToOverhead(serializationOverhead);
                                context.getMPIO().sendTime = System.currentTimeMillis();
                            }

                            // reserialize the message now that info has been added
                            outBuffer = new ByteArrayOutputStream();
                            respMesg = context.getResponseMessage();
                            serializer = sc.newMessageSerializer();
                            serializer.initialize(sc, outBuffer, debugTrace);
                            serializer.writeMessage(respMesg);
                        }
                        catch(Exception e)
                        {
                            if (isDebug)
                                logger.debug("MPI set up error: " + e.toString());
View Full Code Here

        if (Log.isError())
            logger.error("Exception occurred during serialization: " + ExceptionUtil.toString(t));

        // serialize the error messages
        SerializationContext sc = SerializationContext.getSerializationContext();
        MessageSerializer serializer = sc.newMessageSerializer();
        ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
        AmfTrace debugTrace = isDebug ? new AmfTrace() : null;
        serializer.initialize(sc, outBuffer, debugTrace);

        try
        {
            serializer.writeMessage(context.getResponseMessage());
            context.setResponseOutput(outBuffer);
        }
        catch (IOException e)
        {
            //Error serializing response
View Full Code Here

                      // set server send time
                      context.getMPIO().sendTime = System.currentTimeMillis();
                        if(context.isRecordMessageSizes())
                          serializationOverhead = System.currentTimeMillis();                     
                    }                  
                    MessageSerializer serializer = sc.newMessageSerializer();
                    serializer.initialize(sc, outBuffer, debugTrace);
                    serializer.writeMessage(respMesg);
                   
                    // keep track of serializes bytes for performance metrics
                    context.setSerializedBytes(outBuffer.size());
                   
                    // serialized message again after adding info if mpio with sizing is enabled
                    if(context.isRecordMessageSizes())
                    {
                      try
                      {                       
                        context.getMPIO().messageSize = outBuffer.size();
                       
                        // reset server send time     
                        if(context.isRecordMessageTimes())
                        {
                            serializationOverhead = System.currentTimeMillis() - serializationOverhead;
                            context.getMPIO().addToOverhead(serializationOverhead);
                              context.getMPIO().sendTime = System.currentTimeMillis();
                        }
                       
                        // reserialize the message now that info has been added
                        outBuffer = new ByteArrayOutputStream();
                        respMesg = context.getResponseMessage();
                        serializer = sc.newMessageSerializer();
                        serializer.initialize(sc, outBuffer, debugTrace);
                        serializer.writeMessage(respMesg);
                      }
                      catch(Exception e)
                      {
                            if (isDebug)
                                logger.debug("MPI set up error: " + e.toString());
View Full Code Here

        if (Log.isError())
            logger.error("Exception occurred during serialization: " + ExceptionUtil.toString(t));

        // serialize the error messages
        SerializationContext sc = SerializationContext.getSerializationContext();
        MessageSerializer serializer = sc.newMessageSerializer();
        ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
        AmfTrace debugTrace = isDebug ? new AmfTrace() : null;
        serializer.initialize(sc, outBuffer, debugTrace);

        try
        {
            serializer.writeMessage(context.getResponseMessage());
            context.setResponseOutput(outBuffer);
        }
        catch (IOException e)
        {
            //Error serializing response
View Full Code Here

      ActionMessage requestMessage = new ActionMessage();
     
      ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
      MessageBody amfMessage = new MessageBody(targetURI, responseURI, new com.thoughtworks.xstream.XStream().fromXML(contenido));
      requestMessage.addBody(amfMessage);
      MessageSerializer amfMessageSerializer = new AmfMessageSerializer();
      amfMessageSerializer.initialize(dsContext, outBuffer, trace);
      amfMessageSerializer.writeMessage(requestMessage);
      return outBuffer.toByteArray();
  } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      return null;
View Full Code Here

TOP

Related Classes of flex.messaging.io.MessageSerializer

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.