1
我正在嘗試將odata4j集成到現有的CXF服務應用程序中。該servlet已經託管了現有的肥皂和休息服務。我的應用程序服務器是tomcat。OData4j和CXF與彈簧
我的web.xml:
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
現有的SOAP和REST服務是通過JAXRS和JAXWS配置文件來配置。
我已經創建了我的JPA的OData製片廠:
public class CmecfOdataProducerFactoryImpl implements ODataProducerFactory {
String namespace = "MyOData";
private int maxResults = 100;
@Override
public ODataProducer create(Properties prprts) {
String persistenceName = null;
try {
persistenceName = ServiceLocator.getInstance().getResource("java:/comp/env/persistenceUnitName", String.class);
} catch (Exception ex) {
Logger.getLogger(CmecfOdataProducerFactoryImpl.class.getName()).log(Level.SEVERE, null, ex);
}
EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceName);
JPAProducer producer = new JPAProducer(emf, namespace, maxResults);
return producer;
}
}
什麼是包括這個OData服務的乾淨的方式?
感謝您的幫助!