Results 1 to 4 of 4

Thread: How to get HttpSession using HttpInvokerServiceExporter?

  1. #1
    Join Date
    Dec 2008
    Posts
    3

    Default 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. #2
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    What do you want to achieve with httpSessions?

  3. #3
    Join Date
    Dec 2008
    Posts
    3

    Default

    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.

  4. #4
    Join Date
    Sep 2004
    Posts
    1,086

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •