本文整理匯總了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());
}