本文整理汇总了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);
}
示例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);
}
}
示例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());
}