Title:
Notice: Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
# Servlet Support
Originally the Olingo OData 2.0 server library has been implemented
based on JAX-RS to take advantage of the REST based CXF features.
With the development of Olingo URI parser it was possible now also
to offer a purely servlet-based approach. This has some advantages
on restricted runtime environments and reduces the amount of
required dependencies. Disadvantage is that some REST features
which are out of the box are not available.
Both solutions JAX-RS and Non-JAX-RS are supported.
For testing the feature it is recommended to start with the
[sample setup](/doc/odata2/sample-setup.html) using the Olingo archetype and do the following
modifications.
### Maven Dependencies
For a plain servlet based approach it is possible to exclude JAX-RS
dependencies. A simple way is to exclude them with Maven:
org.apache.olingo
olingo-odata2-lib
2.0.4
javax.ws.rs
javax.ws.rs-api
A JAX-RS implementation dependency like Apache CXF is not required
for runtime.
### Adopt web.xml
For using the servlet based approach a Servlet must be configured in web.xml file (and probably an old servlet replaced):
ReferenceScenarioServlet
org.apache.olingo.odata2.core.servlet.ODataServlet
org.apache.olingo.odata2.service.factory
org.apache.olingo.odata2.ref.processor.ScenarioServiceFactory
1
ReferenceScenarioServlet
/ReferenceScenario.svc/*
Ensure that all runtime dependencies to Apache CXF are removed from the sample project.
After this modification the service should work like before.