本文整理汇总了Java中org.apache.olingo.server.api.edmx.EdmxReference类的典型用法代码示例。如果您正苦于以下问题:Java EdmxReference类的具体用法?Java EdmxReference怎么用?Java EdmxReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EdmxReference类属于org.apache.olingo.server.api.edmx包,在下文中一共展示了EdmxReference类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareHandler
import org.apache.olingo.server.api.edmx.EdmxReference; //导入依赖的package包/类
private ODataHttpHandler prepareHandler() {
OData oData = OData.newInstance();
ServiceMetadata edm = oData.createServiceMetadata(new CarsEdmProvider(), new ArrayList<EdmxReference>());
ODataHttpHandler handler = oData.createHandler(edm);
return handler;
}
示例2: process
import org.apache.olingo.server.api.edmx.EdmxReference; //导入依赖的package包/类
/**
* Process.
*
* @param req the req
* @return the response entity
*/
@RequestMapping(value = "*")
public ResponseEntity<String> process(HttpServletRequest req) {
try {
OData odata = OData.newInstance();
ServiceMetadata edm = odata.createServiceMetadata(edmProvider,
new ArrayList<EdmxReference>());
ODataHandler handler = new ODataHandler(odata, edm);
handler.register(enityCollectionProcessor);
ODataResponse response = handler.process(createODataRequest(req,
split));
String responseStr = StreamUtils.copyToString(
response.getContent(), Charset.defaultCharset());
MultiValueMap<String, String> headers = new HttpHeaders();
for (String key : response.getHeaders().keySet()) {
headers.add(key, response.getHeaders().get(key).toString());
}
return new ResponseEntity<String>(responseStr, headers,
HttpStatus.valueOf(response.getStatusCode()));
} catch (Exception ex) {
throw new EdmException();
}
}
示例3: service
import org.apache.olingo.server.api.edmx.EdmxReference; //导入依赖的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);
}
}