当前位置: 首页>>代码示例>>Java>>正文


Java ODataHttpHandler类代码示例

本文整理汇总了Java中org.apache.olingo.server.api.ODataHttpHandler的典型用法代码示例。如果您正苦于以下问题:Java ODataHttpHandler类的具体用法?Java ODataHttpHandler怎么用?Java ODataHttpHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ODataHttpHandler类属于org.apache.olingo.server.api包,在下文中一共展示了ODataHttpHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@Override
public void service(HttpServletRequest request, HttpServletResponse response)
        throws IOException {
    Client client = (Client) request.getAttribute(Client.class.getName());
    String schemaName = (String) request.getAttribute(ODataFilter.SCHEMA_NAME);

    org.teiid.metadata.Schema teiidSchema = client.getMetadataStore().getSchema(schemaName);
    if (teiidSchema == null || !isVisible(client.getVDB(), teiidSchema)) {
        // TODO: send error response, this is exception
        throw new TeiidRuntimeException(ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16022));
    }

    OData odata = OData.newInstance();
    Schema schema = OData4EntitySchemaBuilder.buildMetadata(teiidSchema);
    Edm edm = odata.createEdm(new TeiidEdmProvider(client.getMetadataStore(), schema));

    ODataHttpHandler handler = odata.createHandler(edm);
    boolean prepared = true;
    if (request.getParameter("prepared") != null) { //$NON-NLS-1$
        prepared = Boolean.getBoolean(request.getParameter("prepared")); //$NON-NLS-1$
    }
    handler.register(new TeiidProcessor(client, prepared));
    handler.process(request, response);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:25,代码来源:ODataServlet.java

示例2: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@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);
  }

}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoServlet.java

示例3: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoServlet.java

示例4: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:DemoServlet.java

示例5: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@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);
  }

}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoServlet.java

示例6: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:DemoServlet.java

示例7: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoServlet.java

示例8: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoServlet.java

示例9: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:DemoServlet.java

示例10: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:23,代码来源:CarsServlet.java

示例11: process

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
public void process(final HttpServletRequest request, HttpServletResponse response) throws SQLException{

		SessionContext context = createContext(request);										
		setSession(createSession(context));					
		OData odata = OData.newInstance();
		SQLEdmProvider edmProvider = new SQLEdmProvider(getSession().getMetaData());
		edmProvider.setCursors(cursors);
		edmProvider.setFunctions(functions);
		ServiceMetadata edm = odata.createServiceMetadata(edmProvider, new ArrayList<EdmxReference>());
		ODataHttpHandler handler = odata.createHandler(edm);
		SQLEntityCollectionProcessor processor = new SQLEntityCollectionProcessor(getSession());
		processor.setCursors(cursors);
		handler.register(processor);	      
		handler.register(new SQLEntityProcessor(getSession()));
		handler.register(new SQLPrimitiveProcessor(getSession(),functions));
		handler.register(new CustomContentTypes());
		handler.register(new SQLBatchProcessor());
		handler.register( new SQLErrorProcessor(config));
		handler.process(request, response);	
		

	}
 
开发者ID:jbaliuka,项目名称:sql-analytic,代码行数:23,代码来源:SQLOdataHandler.java

示例12: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@Override
protected void service(
    HttpServletRequest request,
    HttpServletResponse response) throws ServletException, IOException {

  String serviceName = extractServiceName(request);
  if (serviceName == null) {
    response.sendError(
        HttpServletResponse.SC_BAD_REQUEST, "Service name required in URI path");
    return;
  }

  CsdlEdmProvider edmProvider = toEdmProvider(serviceName);
  if (edmProvider == null) {
    response.sendError(
        HttpServletResponse.SC_NOT_FOUND, "Unknown service name " + serviceName);
    return;
  }

  OData odata = OData.newInstance();
  ServiceMetadata metadata = odata.createServiceMetadata(edmProvider, Collections.emptyList());
  ODataHttpHandler handler = odata.createHandler(metadata);
  for (Processor processor : processors) {
    handler.register(processor);
  }

  HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper(request) {
    @Override
    public String getServletPath() {
      return request.getServletPath() + '/' + serviceName;
    }
  };
  handler.process(requestWrapper, response);
}
 
开发者ID:pukkaone,项目名称:odata-spring-boot-starter,代码行数:35,代码来源:ODataServlet.java

示例13: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    OData odata = ElasticOData.newInstance();
    ServiceMetadata matadata = createServiceMetadata(req, odata, createEdmProvider());
    ODataHttpHandler handler = odata.createHandler(matadata);
    registerProcessors(handler);
    handler.process(req, resp);
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:10,代码来源:ODataServlet.java

示例14: prepareHandler

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
private ODataHttpHandler prepareHandler() {
    OData oData = OData.newInstance();

    ServiceMetadata edm = oData.createServiceMetadata(new CarsEdmProvider(), new ArrayList<EdmxReference>());
    ODataHttpHandler handler = oData.createHandler(edm);

    return handler;
}
 
开发者ID:sbcd90,项目名称:olingo-jersey,代码行数:9,代码来源:CarServiceImpl.java

示例15: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@Override
protected void service(final HttpServletRequest req, final HttpServletResponse resp)
    throws ServletException, IOException {
  try {

    /*
     * create odata handler and configure it with CsdlEdmProvider and Processor. todo: this needs
     * to be rewritten the list does not have to be recreated each time. The advantage of this is
     * that the multiple threads calling this are seperated.
     */
    OData odata = OData.newInstance();
    ServiceMetadata edm = odata.createServiceMetadata(new RedHxServiceEdmProvider(),
        new ArrayList<EdmxReference>());
    ODataHttpHandler handler = odata.createHandler(edm);

    System.out.println("HFB5: in service call. " + req.getAuthType() + ", " + req.getContentType()
        + ", " + req.getPathInfo());
    handler.register(new RedHxChassisCollectionProcessor());
    handler.register(new RedHxDiscoveryProcessor(odata, edm.getEdm()));

    // let the handler do the work
    handler.process(req, resp);

    /**
     * todo Olingo source. fix ODataHandler line 203 public void register(final Processor
     * processor) { processors.add(0, processor); }
     *
     * so that it can not insert duplicte Processor classes.
     */
  } catch (RuntimeException ex) {
    LOG.error("Server Error occurred in RedHxServlet", ex);

    throw new ServletException(ex);
  }
}
 
开发者ID:RedHelixOrg,项目名称:RedHelix-1,代码行数:36,代码来源:RedHxServlet.java


注:本文中的org.apache.olingo.server.api.ODataHttpHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。