PDA

View Full Version : Converting from HessianServlet to Http Invoker method?



mynzai
Dec 14th, 2005, 07:43 AM
Hi,
I have some HessianServlet services that directly inherit from HessianServlet (not using Spring framework) and I want to convert them to use HTTP Invoker remoting. Is there a similar servlet class I can inherit from to do this or must I use the spring framework and xml delcaration to expose my service using this technique?

Thanks,
mynzai

hust_need4speed
Dec 14th, 2005, 07:16 PM
Config it using spring is quite a simple job.
No much work needed. I suggest u have a try.

Ben Alex
Dec 15th, 2005, 07:41 PM
Why extend a servlet, when you can simply configure it via IoC with a ProxyFactory? It's more elegant to use decoration, which is much of the point of AOP. :-)

Mark Fisher
Dec 19th, 2005, 05:40 PM
Indeed - one of the advantages of using http-invoker is that there is no need to extend a Servlet. To expose a service using HttpInvoker, you can use the exporter and simply inject the service, such as:



<beans>

<bean name="/myService.html" class="org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter">
<property name="service" ref="myService"/>
<property name="serviceInterface" value="x.y.MyService"/>
</bean>

<bean id="urlMapping" class="org.springframework.web.servlet.handler.BeanNameUr lHandlerMapping"/>

<bean id="myService" class="x.y.MyServiceImpl"/>

</beans>


Also, the configuration is almost identical for exposing via Hessian or Burlap (only requires changing the class attribute of the bean).

Jhid
Jul 31st, 2009, 04:39 PM
Hi Mark,

I am sorry if I am a newbie to this, but could you please provide me a more-detailed simple examples? Because I am currently stuck with HessianServlet, which always converts the objects that I pass from Client (outside Spring DM) to the service into HashMap type. Please help me on this. Thanks.


Indeed - one of the advantages of using http-invoker is that there is no need to extend a Servlet. To expose a service using HttpInvoker, you can use the exporter and simply inject the service, such as:



<beans>

<bean name="/myService.html" class="org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter">
<property name="service" ref="myService"/>
<property name="serviceInterface" value="x.y.MyService"/>
</bean>

<bean id="urlMapping" class="org.springframework.web.servlet.handler.BeanNameUr lHandlerMapping"/>

<bean id="myService" class="x.y.MyServiceImpl"/>

</beans>


Also, the configuration is almost identical for exposing via Hessian or Burlap (only requires changing the class attribute of the bean).

kristina87
Aug 15th, 2009, 02:16 PM
<beans>

<bean name="/myService.html" class="org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter">
<property name="service" ref="myService"/>
<property name="serviceInterface" value="x.y.MyService"/>
</bean>

<bean id="urlMapping" class="org.springframework.web.servlet.handler.BeanNameUr lHandlerMapping"/>

<bean id="myService" class="x.y.MyServiceImpl"/>

</beans>

Colon-cleanse (http://productreviewsby.me/colon-cleanse/)