本文整理汇总了Java中org.apache.olingo.server.api.ODataHttpHandler.register方法的典型用法代码示例。如果您正苦于以下问题:Java ODataHttpHandler.register方法的具体用法?Java ODataHttpHandler.register怎么用?Java ODataHttpHandler.register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.server.api.ODataHttpHandler
的用法示例。
在下文中一共展示了ODataHttpHandler.register方法的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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例13: 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);
}
}
示例14: 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);
}
}
示例15: 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);
}