當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。