Using Hessian remoting technology in spring

Source: Internet
Author: User
Tags serialization

Spring currently provides integration of remoting technologies such as RMI, Httpinvoker, Hessian, burlap, and WebService. Spring masks the differences in these implementation technologies by simply developing a simple Java object (Plain old Java Objects,pojo) and then writing the configuration file in the format set by spring.

A comparison of several remoting implementations

The remoting implementation technology supported by spring is very numerous, and although spring masks the differences in the use of these technologies, choosing a suitable remoting technology still has a very positive effect on the system, and the following are the pros and cons of these implementation technologies.

(1) Rmi:rmi uses Java serialization mechanisms to implement invocation and return value marshaling (marshal) and deserialization (Unmarshal), which can be used as parameters and return values using any serializable object. The disadvantage is that RMI can only be accessed through the RMI protocol and cannot be accessed through the HTTP protocol and cannot penetrate the firewall.

(2) Hessian:hessian is also the transfer of the network object to the binary stream through HTTP transmission, but it is the use of their own serialization mechanism to achieve the grouping and deserialization, the data types are supported by a limited, does not support complex objects. The advantage of Hessian is that it can be done through firewalls. Hessian is a lightweight remoting on HTTP tool that provides RMI functionality using simple methods. Simpler and quicker than Webservice,hessian. The binary RPC protocol is used because it is a binary protocol, so it is ideal for sending binary data

(3) Burlap:burlap is a transfer of the network object to the XML Text format passed through HTTP, the supported objects and Hessian compared to less. XML generally takes up more space than binary streams, and it takes more time to pass over the network than binary streams, and the parsing process of XML consumes more memory. Burlap can penetrate firewalls, and because the format of the transfer is XML text, can be integrated with other systems (such as. NET), in a way, burlap is an non-standard webservice.

(4) Httpinvoker:httpinvoker the parameters and return values are grouped and deserialized through the Java serialization mechanism, which has the advantage of RMI to support all serializable objects. HTTP Invoker is the use of HTTP protocol to transmit binary stream, but also has the advantages of Hessian, burlap.

Hessian, Burlap, Httpinvoker, etc. are to be run on a servlet-enabled Web server.

Hessian remoting technology used in spring

Use the following steps:

1, the configuration in the Web.xml

<context-param>

<param-name>contextconfiglocation</param-name>

<param-value>

/web-inf/config/applicationcontext.xml,

/web-inf/hessian-servlet.xml

</param-value>

</context-param>

<servlet>

<servlet-name> Hessian</servlet-name>

<servlet-class>

Org.springframework.web.servlet.DispatcherServlet

</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.