Hessian source analysis and hack--let Hessian carry information from remote callers

Source: Internet
Author: User

Project selected Hessian as the implementation of the Web service, is indeed very lightweight, and the speed of the same as directly with the socket, all is binary transmission save a lot of overhead. However, in the use of the business need is to obtain the remote IP address, host name and other information. Turn Hessian documents and Google the N times did not, forced to Caucho and spring forum to ask, have not been answered. Today's heart a horizontal Hessian source code added to the project single step tracking, finally a little harvest. Shortcoming share out, on the one hand to the needs of friends, mainly hope you find out whether there are bugs, and whether there are better improvements.

One: Leave spring aside, to see the call of pure Hessian

According to the Hessian document introduced in the demo, in the Web.xml inside the following configuration

Java code

<servlet>
  <servlet-name>hello</servlet-name>
  <servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>
   <init-param>
    <param-name>home-class</param-name>
    <param-value>example.BasicService</param-value>
   </init-param>
   <init-param>
    <param-name>home-api</param-name>
    <param-value>example.Basic</param-value>
   </init-param>
  </servlet>
  <servlet-mapping>
   <url-pattern>/hello</url-pattern>
   <servlet-name>hello</servlet-name>
  </servlet-mapping>

So the entrance to the Hessian call is Hessianservlet this servlet, go inside and see

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.