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


Java ServiceDocumentProcessor类代码示例

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


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

示例1: serviceDocumentNonDefault

import org.apache.olingo.server.api.processor.ServiceDocumentProcessor; //导入依赖的package包/类
@Test
public void serviceDocumentNonDefault() throws Exception {
  final ServiceDocumentProcessor processor = mock(ServiceDocumentProcessor.class);
  doThrow(new ODataApplicationException("msg", 100, Locale.ENGLISH)).when(processor)
      .readServiceDocument(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
          any(ContentType.class));
  final ODataResponse response = dispatch(HttpMethod.GET, "/", processor);
  assertEquals(HttpStatusCode.CONTINUE.getStatusCode(), response.getStatusCode());

  verify(processor).readServiceDocument(
      any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));

  // We support HEAD now too
  final ServiceDocumentProcessor processor2 = mock(ServiceDocumentProcessor.class);
  doThrow(new ODataApplicationException("msg", 100, Locale.ENGLISH)).when(processor2)
  .readServiceDocument(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
      any(ContentType.class));
  final ODataResponse response2 = dispatch(HttpMethod.HEAD, "/", processor2);
  assertEquals(HttpStatusCode.CONTINUE.getStatusCode(), response2.getStatusCode());

  verify(processor2).readServiceDocument(
      any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));

  dispatchMethodNotAllowed(HttpMethod.POST, "/", processor);
  dispatchMethodNotAllowed(HttpMethod.PATCH, "/", processor);
  dispatchMethodNotAllowed(HttpMethod.PUT, "/", processor);
  dispatchMethodNotAllowed(HttpMethod.DELETE, "/", processor);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:29,代码来源:ODataHandlerImplTest.java

示例2: dispatch

import org.apache.olingo.server.api.processor.ServiceDocumentProcessor; //导入依赖的package包/类
public void dispatch(final ODataRequest request, final ODataResponse response) throws ODataApplicationException,
    ODataLibraryException {
  switch (uriInfo.getKind()) {
  case metadata:
    checkMethods(request.getMethod(), HttpMethod.GET, HttpMethod.HEAD);
    final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
        request, handler.getCustomContentTypeSupport(), RepresentationType.METADATA);
    handler.selectProcessor(MetadataProcessor.class)
        .readMetadata(request, response, uriInfo, requestedContentType);
    break;

  case service:
    checkMethods(request.getMethod(), HttpMethod.GET, HttpMethod.HEAD);
    if ("".equals(request.getRawODataPath())) {
      handler.selectProcessor(RedirectProcessor.class)
          .redirect(request, response);
    } else {
      final ContentType serviceContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
          request, handler.getCustomContentTypeSupport(), RepresentationType.SERVICE);
      handler.selectProcessor(ServiceDocumentProcessor.class)
          .readServiceDocument(request, response, uriInfo, serviceContentType);
    }
    break;

  case resource:
  case entityId:
    handleResourceDispatching(request, response);
    break;

  case batch:
    checkMethod(request.getMethod(), HttpMethod.POST);
    new BatchHandler(handler, handler.selectProcessor(BatchProcessor.class))
        .process(request, response, true);
    break;

  default:
    throw new ODataHandlerException(NOT_IMPLEMENTED_MESSAGE,
        ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:41,代码来源:ODataDispatcher.java

示例3: readServiceDocument

import org.apache.olingo.server.api.processor.ServiceDocumentProcessor; //导入依赖的package包/类
@Override
public void readServiceDocument(ServiceDocumentRequest request, ServiceDocumentResponse response)
    throws ODataLibraryException, ODataApplicationException {
  selectProcessor(ServiceDocumentProcessor.class).readServiceDocument(request.getODataRequest(),
      response.getODataResponse(), request.getUriInfo(), request.getResponseContentType());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:7,代码来源:ProcessorServiceHandler.java


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