• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ODataHttpHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: service

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@Override
protected void service(final HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
  try {
    OData odata = OData.newInstance();
    EdmxReference reference = new EdmxReference(URI.create("../v4.0/cs02/vocabularies/Org.OData.Core.V1.xml"));
    reference.addInclude(new EdmxReferenceInclude("Org.OData.Core.V1", "Core"));
    final ServiceMetadata serviceMetadata = odata.createServiceMetadata(
        new EdmTechProvider(),
        Collections.singletonList(reference),
        new MetadataETagSupport(metadataETag));

    HttpSession session = request.getSession(true);
    DataProvider dataProvider = (DataProvider) session.getAttribute(DataProvider.class.getName());
    if (dataProvider == null) {
      dataProvider = new DataProvider(odata, serviceMetadata.getEdm());
      session.setAttribute(DataProvider.class.getName(), dataProvider);
      LOG.info("Created new data provider.");
    }

    ODataHttpHandler handler = odata.createHandler(serviceMetadata);
    // Register processors.
    handler.register(new TechnicalEntityProcessor(dataProvider, serviceMetadata));
    handler.register(new TechnicalPrimitiveComplexProcessor(dataProvider, serviceMetadata));
    handler.register(new TechnicalActionProcessor(dataProvider, serviceMetadata));
    handler.register(new TechnicalBatchProcessor(dataProvider));
    // Register helpers.
    handler.register(new ETagSupport());
    handler.register(new DefaultDebugSupport());
    // Process the request.
    handler.process(request, response);
  } catch (final RuntimeException e) {
    LOG.error("Server Error", e);
    throw new ServletException(e);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:37,代码来源:TechnicalServlet.java


示例17: service

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


示例18: service

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

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


示例19: processRequestWithEntityCollectionProcessor

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
private void processRequestWithEntityCollectionProcessor(ODataHttpHandler oDataHttpHandler, EntityCollectionProcessor entityCollectionProcessor) {
    oDataHttpHandler.register(entityCollectionProcessor);
    oDataHttpHandler.process(httpServletRequest, httpServletResponse);
}
 
开发者ID:sbcd90,项目名称:olingo-jersey,代码行数:5,代码来源:CarServiceImpl.java


示例20: createHandler

import org.apache.olingo.server.api.ODataHttpHandler; //导入依赖的package包/类
@Override
public ODataHttpHandler createHandler(ServiceMetadata serviceMetadata) {
  return odata.createHandler(serviceMetadata);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:5,代码来源:ODataNettyImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SM类代码示例发布时间:2022-05-22
下一篇:
Java H264Packetizer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap