Good day.
I am new to Spring and I don't know if its possible to get HttpSession from "plainService" object using HttpInvokerServiceExporter?
Firstly I create plainService bean - class which implements interface with rpc methods.
Secondly create invoker bean using plainService bean and interface with rpc methods
And finally create urlMapping bean using invoker
It works correctly but I don't know how to get HttpSession object in PlainServiceImpl class.
Have any idea?
There are my classes:
=========================
common.PlainService interface
=========================
=========================Code:public interface PlainService { String getDummyText(); }
common.PlainService interface implementation
=========================
config files:Code:public class PlainServiceImpl implements PlainService { public String getDummyText() { return "DummyText"; } }
=========================
springContext.xml
=========================
=========================Code:<bean id="plainService" class="service.impl.PlainServiceImpl"></bean> <bean id="invoker" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"> <property name="service" ref="plainService" /> <property name="serviceInterface" value="common.plainService"/> </bean> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/plain.service">invoker</prop> </props> </property> </bean>
WEB-INF/web.xml
=========================
Code:<servlet> <servlet-name>servlet-service</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:springContext.xml</param-value> </init-param> </servlet>


Reply With Quote