Platinum Partner

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.

Simple example

Accessing a remote service is easy:

MyService myService = (MyService) ServiceProxyFactory
.createProxy(MyService.class, "http://example.com/MyService");

Exposing a service on the server can be done solely in web.xml or with the optional Spring support. Web.xml configuration:

<servlet>
<servlet-name>myservice</servlet-name>
<servlet-class>no.tornado.brap.servlet.ProxyServlet</servlet-class>
<init-param>
<param-name>service</param-name>
<param-value>com.example.MyServiceImpl</param-value>
</init-param>
<init-param>
<param-name>authorizationProvider</param-name>
<param-value>no.tornado.brap.auth.AuthenticationNotRequiredAuthorizer</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>myservice</servlet-name>
<url-pattern>/MyService</url-pattern>
</servlet-mapping>

More info

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.

Getting BRAP

BRAP is available in the central Maven repository . Add the following to your pom.xml:

<!-- Client -->
<dependency>
<groupId>no.tornado.brap</groupId>
<artifactId>brap-client</artifactId>
<version>0.9.1</version>
</dependency>

<!-- Server -->
<dependency>
<groupId>no.tornado.brap</groupId>
<artifactId>brap-server</artifactId>
<version>0.9.1</version>
</dependency>

<!-- Optional Spring support on the server -->
<dependency>
<groupId>no.tornado.brap</groupId>
<artifactId>brap-spring</artifactId>
<version>0.9.1</version>
</dependency>

<!-- Optional modification support on the server -->
<dependency>
<groupId>no.tornado.brap</groupId>
<artifactId>brap-modification</artifactId>
<version>0.9.1</version>
</dependency>


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!

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}