If your familiar with GWT RPC, then you you know that it’s it’s provides a very nice client side framework for doing AJAX requests against Java Servlets. The sad part is that it uses a binary protocol. That protocol is not easily understood by other languages or frameworks.
Counter that with latest AJAX rage, RESTful services with a JSON or XML representation of the data. The nice thing about using JSON with REST services is that clients and servers can easily be built it any language. Wouldn’t it be nice if you use JSON RESTful services from GWT with the ease of GWT RPC?
That’s exactly the reason I started hacking on RestyGWT. It uses a very similar development model as GWT RPC. You create a service interface who’s implementation is code generated via Deferred Binding when your GWT module is built. The developer maps the interface methods to RESTful HTTP requests using the excelent JAX-RS annotations. Just like in GWT RPC, the interface must be ‘asynchronous’. You must use callback method arguments to get the request results. But unlike GWT RPC, the data sent and received will be JSON encoded. RestyGWT will automatically code generate JSON encoders and decoders for any classes sent or received from the rest service.
For more details see the Git Hub home page at: http://github.com/chirino/resty-gwt
As of this point, RestyGWT only implements the most basic JAX-RS annotations and provides a very simple JSON encoding scheme. Despite that, the project is already extremely useful. I would love here what folks think about it.
I’m pleased to announce the release of RMI via JMS 1.0! RMI via JMS allows you do RMI style remoting over any JMS provider. It combines the ease of RMI development with flexibility and loose coupling that JMS provides.
It also supports and even simpler interface remoting model which does not mandate the throwing of RemoteException or extending the RemoteObject interfaces. It even allows remoting classes which don’t implement any interfaces via ASM magic.
Documentation still needs a little work, but the project is now ASL 2.0 Licensed and looking for contributions! Please join the mailing lists to get involved.
Changed the blog over to WordPress from Blogger. I am impressed how polished this app is. Who would have thought a PHP app could get this good?
I just saw a tweet which demonstrates that the STOMP spec still needs more clarification. I think Brian McCallister, the founding architect of protocol, will agree that one of the tenets of the protocol was for it to be simple enough to even use by user which directly connects to a server via telnet.
And to support that use case, newlines after the frame terminator are a natural occurrence. But it might be easier to describe it as:
- A stomp frame may have zero or more newlines preceding it’s command verb.
I promised I would follow up on my previous post on how the “The ActiveMQ Protobuf Implementation Rocks!”.
So you might be asking yourself, what’s the secret sauce? Well before I get into that, let me first explain the class model that our proto compiler generates.
For every message definition in the ‘.proto’ file, the compiler will generate 3 classes:
- the message interface: is implemented by the bean and buffer classes. It has all the ‘getters’.
- the bean class: has all the ‘setters’ and ‘merge’ methods
- the buffer class: has all the encoding and decoding methods. It does not allow mutation.
The message interface also defines the freeze(), frozen(), and copy() methods which allow you to make an instance immutable, check to see if an instance is immutable, and create a mutable copy. Buffer classes are alway immutable. Bean class can transition to being immutable via freeze(). freeze() naturally returns a buffer object. copy() naturally returns a bean object.
This bean model gives substantial flexibility. Besides making it easy to transition from immutable to mutable and back, the message interface lets you implement business methods that operate against either type of instance. You could use the bean class purely in a builder style to always generate a buffer instance, or you could just use them like traditional java bean objects.
Once a bean instance is frozen, any attempts to modify the instance will throw assertion errors if assertions are enabled in your JVM. So the CPU cost of validating program correctness can can be disabled at run time.
Finally, the most important feature of the buffer class is that it holds on to either the byte array that it was created from or the frozen bean that created it, and sometimes both, after it builds one from the other. This has several implications. Firstly, once a buffer is encoded to a byte[], subsequent encoding passes are free. This is also true when a buffer is decoded, as the next encoding is free since it still retains the original encoding of the message. And the other benefit that this provides which the benchmark highlighted, is that deferred decoding is possible. A newly created buffer class will not decode the data until a field is accessed. This also true of the nested messages that are encoded in a buffer. While the outer message may get decoded, the nested message will not be decoded until it’s fields are accessed.