You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Lior Okman (JIRA)" <ji...@apache.org> on 2014/11/12 17:17:33 UTC

[jira] [Commented] (OLINGO-193) Olingo on Spring implementation scenarion

    [ https://issues.apache.org/jira/browse/OLINGO-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14208202#comment-14208202 ] 

Lior Okman commented on OLINGO-193:
-----------------------------------

The attached patch provides two items:
1. A version of ODataRootLocator that can be used by Spring to wire the OData service
         Using just this file, the usage becomes:
               1.1 Add the CXFServlet fragment to web.xml
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    <!-- Don't forget to configure the listener as per Spring's requirement -->
  </listener>
  <servlet>
             <display-name>CXFServlet</display-name>
             <servlet-name>CXFServlet</servlet-name>
             <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    </servlet>
  <servlet-mapping>
            <servlet-name>CXFServlet</servlet-name>
             <url-pattern>/*</url-pattern>
  </servlet-mapping>


               1.2 Create a ServiceFactory and wire it into Spring

                                     <bean class="com.sap.roolingo.odata.MyServiceFactory" id="odataServiceFactory"/>                  


                1.3 Expose the OLingo service like this:

  	<bean id="rootLocator" class="org.apache.olingo.odata2.core.rest.spring.ODataRootLocator" >
 		<property name="serviceFactory" ref="odataServiceFactory" />
 	</bean>
	<bean id="exceptionhandler" class="org.apache.olingo.odata2.core.rest.ODataExceptionMapperImpl"/>
	<bean id="provider" class="org.apache.olingo.odata2.core.rest.app.ODataApplication.MyProvider"/>
	
 	<jaxrs:server id="SomeIdForTheService" address="/OData.svc">
		<jaxrs:serviceBeans>
			<ref bean="rootLocator"/>
			<ref bean="exceptionhandler"/>
			<ref bean="provider" />
		</jaxrs:serviceBeans>
	</jaxrs:server>


2. The olingo-spring module which provides a Spring namespace handler that allows the entire Spring configuration (item 1.3 above) to be replaced with the following:

    <odata:server address="/OData.svc" factory="odataServiceFactory" id="SomeIdForTheService"/>


> Olingo on Spring implementation scenarion
> -----------------------------------------
>
>                 Key: OLINGO-193
>                 URL: https://issues.apache.org/jira/browse/OLINGO-193
>             Project: Olingo
>          Issue Type: New Feature
>          Components: odata2-core
>         Environment: Spring
>            Reporter: Jan Penninkhof
>            Assignee: Michael Bolz
>            Priority: Minor
>              Labels: spring
>         Attachments: spring.diff
>
>
> Currently only a imlementation scenario using CXFNonSpringJaxrsServlet is provided. However, to implement OLingo while bootstrapping Spring at the same time, this scenario won't work. Instead probably CXFServlet should be used instead.
> However, CXFServlet has quite a different API and Olingo currently doesn't have wiring to that API.
> It would be excellent if there would be a version of Olingo that could work in a Spring environment as well, e.g. to allow for reuse of existing Spring components.
> Please also refer to a discussion on this topic in the mail-archive:
> https://www.mail-archive.com/dev@olingo.incubator.apache.org/msg02186.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)