Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC and HttpInvokerServiceExporter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC and HttpInvokerServiceExporter

    Hello,

    I need to develop web application that can be easily invoked by remote users.
    I want to use Spring framework in order to wire my objects and to provide the http remoting.
    Please see below the web.xml and MyServlet-servlet.xml
    Is it a correct decision to use the Spring-MVC and Spring remoting together in such way?
    Another requirement is to be able to put things in HttpSession and to get them later in my remote object implementation. How can I do it? I have no reference to ServletContext in my remote object?

    Thanks a lot.
    Victor.

    My web.xml:
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext-MyServlet.xml</param-value>
    </context-param>

    <servlet>
    <servlet-name>context</servlet-name>
    <servlet-class>org.springframework.web.context.ContextLoade rServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>


    <servlet>
    <servlet-name>MyServlet</servlet-name>
    <load-on-startup>2</load-on-startup>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    </servlet>

    <servlet-mapping>
    <servlet-name>MyServlet</servlet-name>
    <url-pattern>/MyServlet</url-pattern>
    </servlet-mapping>


    my MyServlet-servlet.xml is as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

    <beans>
    <!--
    <bean name="/MyServlet" class="org.springframework.remoting.httpinvoker.Ht tpInvokerServiceExporter">
    <property name="serviceInterface" value="MyInterface"/>
    <property name="service" ref="MyServiceBean"/>
    </bean>

    <bean id="MyServiceBean" class="MyInterfaceImpl">
    </bean>
    </beans>

  • #2
    Is it a correct decision to use the Spring-MVC and Spring remoting together in such way?
    Spring MVC and Remoting should handle what you want. See the JPetStore sample for various implementations. Also look at Remoting and web services using Spring.

    Another requirement is to be able to put things in HttpSession and to get them later in my remote object implementation. How can I do it? I have no reference to ServletContext in my remote object?
    This seems like a dubious requirement. You would have to add it to your remote service methods, but services should generally be stateless. You can normally get around this by keeping tate at the client during the session.

    Comment


    • #3
      You may also want to check out Acegi Security System for Spring for securing the remote access. If you secure at the service layer, that security will be applied to both your web application and your remote application.

      Comment

      Working...
      X