BRAP - Trouble Free, Lightning Fast Remoting With Authentication
If you are building a GUI application, chances are you need to access some services exposed on a remote server. In the past, I often landed on Spring HttpInvoker with Spring Security because I wanted to program against interfaces, use binary remoting for optimal performance, and I needed custom authentication/authorization.
While probably being amongst the better solutions for Java-to-Java remoting, this combination comes at a cost:
- Size on the client. You need quite a chunk of the Spring dependencies making your client too heavy for many usecases.
- Cost of initial setup. Getting HttpInvoker up and running is easy enough, but configuring Spring Security to meet your needs can be a daunting task, at least for the first time user.
Enter BRAP. Using native Java binary serialization, encapsulated over HTTP, and with an easy to understand authentication/authorization scheme, the 16k dependency on your client is well worth it! You can easily use your existing domain objects as credentials for authentication, and there is an optional module for "pass-by-reference"-like behavior, so that changes happening to the method arguments on the server will be reflected on the client after the method invocation returns.
Accessing a remote service is easy:
MyService myService = (MyService) ServiceProxyFactory
Exposing a service on the server can be done solely in web.xml or with the optional Spring support. Web.xml configuration:
That's all the configuration you need to get up and running. But don't let the simplicity fool you - BRAP supports powerful customization and some unique features. Read the short and concise documentation or check out some screencasts.
BRAP is available in the central Maven repository . Add the following to your pom.xml:
<!-- Client -->
<!-- Server -->
<!-- Optional Spring support on the server -->
<!-- Optional modification support on the server -->
There is also something to be said for having read and understood all the code that goes into protecting your remoting services. You can read through all the source code and have a good overview of all the bits and pieces of BRAP within an hour.
I would love to hear what you think of BRAP, and changes/requests are very welcome!
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)