Package com.google.gwt.user.client.rpc

Examples of com.google.gwt.user.client.rpc.SerializationStreamReader


        throw new SerializationException(e);
      }
    }
    else if (getMode() == SerialMode.DE_RPC) {
      try {
        SerializationStreamReader reader = ClientWriterFactory.createReader(message);
        return (T) reader.readObject();
      }
      catch (RuntimeException e) {
        throw new SerializationException(e);
      }
    } else if (getMode() == SerialMode.PLAIN) {
View Full Code Here


//                    SerializationStreamReader reader = ((SerializationStreamFactory)rpcService).createStreamReader(encodedData);
//                    @SuppressWarnings("unchecked")
//              ArrayList<Message> messages = (ArrayList<Message>) reader.readObject();
//              for (Message message : messages)

                  SerializationStreamReader reader = ((SerializationStreamFactory)rpcService).createStreamReader(encodedData);
                    @SuppressWarnings("unchecked")
              Message message = (Message) reader.readObject();
             
                    processMessage(message);
                  } catch (SerializationException e) {
                    throw new RuntimeException("Unable to deserialize " + encodedData, e);
                  }
View Full Code Here

        GWTMockUtilities.restore();

        DomainEvent theDomainEvent = new DummyDomainEvent();
        final String theSerializedEvent = "[4,3,2,1,[\"de.novanic.eventservice.client.event.DefaultDomainEvent/3924906731\",\"de.novanic.eventservice.client.event.domain.DefaultDomain/240262385\",\"test_domain\",null],0,5]";

        SerializationStreamReader theSerializationStreamReaderMock = mock(SerializationStreamReader.class);
        when(theSerializationStreamReaderMock.readObject()).thenReturn(theDomainEvent);

        mockInitSerializationStreamFactory(theSerializationStreamReaderMock, theSerializedEvent);

        myGWTStreamingClientConnector.listen(theEventNotification, null);
        assertFalse(theEventNotification.isNotified());
View Full Code Here

        final String theSerializedEvent = "[4,3,2,1,[\"de.novanic.eventservice.client.event.DefaultDomainEvent/3924906731\",\"de.novanic.eventservice.client.event.domain.DefaultDomain/240262385\",\"test_domain\",null],0,5]";

        DomainEvent theDomainEvent = new DummyDomainEvent();

        SerializationStreamReader theSerializationStreamReaderMock = mock(SerializationStreamReader.class);
        when(theSerializationStreamReaderMock.readObject()).thenReturn(theDomainEvent);

        mockInitSerializationStreamFactory(theSerializationStreamReaderMock, theSerializedEvent);

        myGWTStreamingClientConnector.listen(theEventNotification, null);
        assertFalse(theEventNotification.isNotified());
View Full Code Here

        final String theSerializedEvent = "[4,3,2,1,[\"de.novanic.eventservice.client.event.DefaultDomainEvent/3924906731\",\"de.novanic.eventservice.client.event.domain.DefaultDomain/240262385\",\"test_domain\",null],0,5]";

        DomainEvent theDomainEvent = new DummyDomainEvent();

        SerializationStreamReader theSerializationStreamReaderMock = mock(SerializationStreamReader.class);
        when(theSerializationStreamReaderMock.readObject()).thenReturn(theDomainEvent);

        mockInitSerializationStreamFactory(theSerializationStreamReaderMock, theSerializedEvent);

        myGWTStreamingClientConnector.listen(theEventNotification, null);
        assertFalse(theEventNotification.isNotified());
View Full Code Here

        EventNotificationTestHandler theEventNotification = new EventNotificationTestHandler();

        final String theSerializedEvent = "corrupt_serialized_event";

        SerializationStreamReader theSerializationStreamReaderMock = mock(SerializationStreamReader.class);
        when(theSerializationStreamReaderMock.readObject()).thenThrow(new SerializationException("The event is corrupt and can not be deserialized!"));

        mockInitSerializationStreamFactory(theSerializationStreamReaderMock, theSerializedEvent);

        myGWTStreamingClientConnector.listen(theEventNotification, null);
        assertFalse(theEventNotification.isNotified());
View Full Code Here

     * @return de-serialized event
     */
    protected DomainEvent deserializeEvent(String anEvent) {
        try {
            SerializationStreamFactory theSerializationStreamFactory = GWT.create(EventService.class);
            SerializationStreamReader theSerializationStreamReader = theSerializationStreamFactory.createStreamReader(anEvent);
            return (DomainEvent)theSerializationStreamReader.readObject();
        } catch(SerializationException e) {
            throw new RemoteEventServiceRuntimeException("Error on de-serializing event \"" + anEvent + "\"!", e);
        }
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public T getObject() {
        if ((this.object == null) && (getText() != null)) {
            try {
                // Create a stream reader
                SerializationStreamReader streamReader = getSerializationStreamFactory()
                        .createStreamReader(getText());

                // Deserialize the object
                if (isString()) {
                    this.object = (T) streamReader.readString();
                } else {
                    this.object = (T) streamReader.readObject();
                }

            } catch (Exception e) {
                this.object = null;
                e.printStackTrace();
View Full Code Here

        throw new SerializationException(e);
      }
    }
    else {
      try {
        SerializationStreamReader reader = ClientWriterFactory.createReader(message);
        return (T) reader.readObject();
      }
      catch (RuntimeException e) {
        throw new SerializationException(e);
      }
    }
View Full Code Here

    // invoked.
    Throwable caught = null;
    while (true) {
      try {
        String serializedForm0 = Utilities.htmlDecode(serializedForm);
        final SerializationStreamReader reader = this.createSerializationStreamReader(serializedForm0);
        final int command = reader.readInt();
        if (command == CometConstants.TERMINATE_COMET_SESSION) {
          this.stop();
          callback.onTerminate();
          break;
        }

        if (command == CometConstants.OBJECT_PAYLOAD) {
          final Object object = reader.readObject();
          callback.onPayload(object);
          break;
        }

        if (command == CometConstants.EXCEPTION_PAYLOAD) {
          caught = (Throwable) reader.readObject();
          break;
        }

        this.onUnknownCommand(command);
        break;
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.rpc.SerializationStreamReader

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.