Java Code Examples for org.apache.olingo.server.api.OData#createHandler()
The following examples show how to use
org.apache.olingo.server.api.OData#createHandler() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 2
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 3
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 4
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(odata, edm.getEdm()); session.setAttribute(Storage.class.getName(), storage); } ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 5
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in DemoServlet", e); throw new ServletException(e); } }
Example 6
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); handler.register(new DemoBatchProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 7
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); handler.register(new DemoActionProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 8
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { try { // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor()); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 9
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 10
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in DemoServlet", e); throw new ServletException(e); } }
Example 11
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 12
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 13
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(odata, edm.getEdm()); session.setAttribute(Storage.class.getName(), storage); } ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 14
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 15
Source File: CarsServlet.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { try { HttpSession session = req.getSession(true); DataProvider dataProvider = (DataProvider) session.getAttribute(DataProvider.class.getName()); if (dataProvider == null) { dataProvider = new DataProvider(); session.setAttribute(DataProvider.class.getName(), dataProvider); LOG.info("Created new data provider."); } OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new CarsEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new CarsProcessor(dataProvider)); handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error", e); throw new ServletException(e); } }
Example 16
Source File: JaxrsODataService.java From cxf with Apache License 2.0 | 6 votes |
@GET @Path("{id:.*}") public Response service(@Context HttpServletRequest req, @Context HttpServletResponse resp) { String requestMapping = req.getContextPath() + req.getServletPath() + "/DemoService.svc"; req.setAttribute("requestMapping", requestMapping); // create odata handler and configure it with EdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor()); // let the handler do the work handler.process(req, resp); return Response.ok().build(); }
Example 17
Source File: ProductsServlet.java From syndesis with Apache License 2.0 | 6 votes |
@Override protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { try { Storage storage = Storage.getInstance(); // create odata handler and configure it with CsdlEdmProvider and Processor OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new ProductsEdmProvider(), new ArrayList<EdmxReference>()); ODataHttpHandler handler = odata.createHandler(edm); handler.register(new ProductsEntityCollectionProcessor(storage)); handler.register(new ProductEntityProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred: ", e); throw new ServletException(e); } }
Example 18
Source File: ODataServiceHandler.java From micro-integrator with Apache License 2.0 | 5 votes |
public ODataServiceHandler(ODataDataHandler dataHandler, String namespace, String configID) throws ODataServiceFault { ODataAdapter processor = new ODataAdapter(dataHandler, namespace, configID); OData odata = OData4Impl.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(processor.getEdmProvider(), new ArrayList<EdmxReference>()); this.handler = odata.createHandler(edm); this.handler.register(processor); }
Example 19
Source File: DemoServlet.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { OData odata = OData.newInstance(); ServiceMetadata edm = odata.createServiceMetadata(new DemoEdmProvider(), new ArrayList<EdmxReference>()); try { HttpSession session = req.getSession(true); Storage storage = (Storage) session.getAttribute(Storage.class.getName()); if (storage == null) { storage = new Storage(odata, edm.getEdm()); session.setAttribute(Storage.class.getName(), storage); } // create odata handler and configure it with EdmProvider and Processor ODataHttpHandler handler = odata.createHandler(edm); handler.register(new DemoEntityCollectionProcessor(storage)); handler.register(new DemoEntityProcessor(storage)); handler.register(new DemoPrimitiveProcessor(storage)); handler.register(new DemoActionProcessor(storage)); handler.register(new DemoBatchProcessor(storage)); // let the handler do the work handler.process(req, resp); } catch (RuntimeException e) { LOG.error("Server Error occurred in ExampleServlet", e); throw new ServletException(e); } }
Example 20
Source File: ServiceDispatcherTest.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public void service(HttpServletRequest request, HttpServletResponse response) throws IOException { OData odata = OData4Impl.newInstance(); ODataHttpHandler handler = odata.createHandler(this.metadata); handler.register(this.handler); handler.process(request, response); }