[
https://issues.apache.org/jira/browse/OLINGO-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14255854#comment-14255854
]
Lior Okman commented on OLINGO-193:
-----------------------------------
Hi Michael,
Yes, my patch builds on the CFX project, and allows the usage of CXFServlet
with the spring.ODataRootLocator. I haven't tried to use ODataServlet directly
(without CXF). Since CXF treats Spring as a first class citizen, and using it
means that it is easier to configure the rest of the classes while using Spring
managed resources.
Assuming the OData service factory is a bean registered in Spring:
{code:xml}
<bean class="com.sap.roolingo.odata.MyServiceFactory" id="odataServiceFactory"/>
{code}
Then with only the patch for the core library, registering Olingo in Spring
with CXFServlet is done like this (as per the Apache CXF documentation):
{code:xml}
<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>
{code}
If the rest of the contributed code is accepted, then instead of the above,
using Olingo with Spring becomes this:
{code:xml}
<odata:server address="/OData.svc" factory="odataServiceFactory"
id="SomeIdForTheService"/>
{code}
Best regards,
Lior
> 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: move-up.diff, root-locator-reuse.diff,
> spring-core-olingo.diff, spring.diff, unittests.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/[email protected]/msg02186.html
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)