Announcement Announcement Module
Collapse
No announcement yet.
How to get HttpSession using HttpInvokerServiceExporter? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get HttpSession using HttpInvokerServiceExporter?

    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
    =========================
    Code:
    public class PlainServiceImpl implements PlainService {
        public String getDummyText() {
    	return "DummyText";
        }
    }
    config files:
    =========================
    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>

  • #2
    What do you want to achieve with httpSessions?

    Comment


    • #3
      I need to embed authorization mechanism in my GWT application, thats why I have to use httpSession to determine if user have rights to perform any rpc queries.

      Comment


      • #4
        I'd suggest using Spring Security then, I guess they already have a solution for it out of the box.

        Comment

        Working...
        X