Spring Remoting by Burlap Example
Both, Hessian and Burlap are provided by Coucho. Burlap is the xml-based alternative of Hessian.
By the help of BurlapServiceExporter and BurlapProxyFactoryBean classes, we can implement the remoting service provided by burlap.
Example of Burlap is same as Hessian, you need to change Hessian to Burlap only.
Example of Remoting by Burlap
You need to create following files for creating a simple burlap application:
- Calculation.java
- CalculationImpl.java
- web.xml
- burlap-servlet.xml
- client-beans.xml
- Client.java
1) Calculation.java
It is the simple interface containing one method cube.
2) CalculationImpl.java
This class provides the implementation of Calculation interface.
3) web.xml
In this xml file, we are defining DispatcherServlet as the front controller. If any request is followed by .http extension, it will be forwarded to DispatcherServlet.
4) burlap-servlet.xml
It must be created inside the WEB-INF folder. Its name must be servletname-servlet.xml. It defines bean for CalculationImpl and BurlapServiceExporter.
5) client-beans.xml
In this xml file, we are defining bean for BurlapProxyFactoryBean. You need to define two properties of this class.
- serviceUrl
- serviceInterface
In this example, our project name is burlap, i.e. used as the context root in the serviceURL.
6) Client.java
This class gets the instance of Calculation and calls the cube method.
How to run this example
Start and deploy the project, here we are assuming that server is running on 8888 port number. If the port number is different, change the serviceURL in client-beans.xml.
Then, Compile and Run the Client.java file.