本文整理汇总了Java中org.apache.olingo.odata2.api.ep.EntityProvider.writeServiceDocument方法的典型用法代码示例。如果您正苦于以下问题:Java EntityProvider.writeServiceDocument方法的具体用法?Java EntityProvider.writeServiceDocument怎么用?Java EntityProvider.writeServiceDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.odata2.api.ep.EntityProvider
的用法示例。
在下文中一共展示了EntityProvider.writeServiceDocument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readServiceDocument
import org.apache.olingo.odata2.api.ep.EntityProvider; //导入方法依赖的package包/类
/**
* @see ServiceDocumentProcessor
*/
@Override
public ODataResponse readServiceDocument(final GetServiceDocumentUriInfo uriInfo, final String contentType)
throws ODataException {
final Edm edm = getContext().getService().getEntityDataModel();
//Service Document has version 1.0 specifically
if ("HEAD".equals(getContext().getHttpMethod())) {
return ODataResponse.header(ODataHttpHeaders.DATASERVICEVERSION, ODataServiceVersion.V10).build();
} else {
final String serviceRoot = getContext().getPathInfo().getServiceRoot().toASCIIString();
final ODataResponse response = EntityProvider.writeServiceDocument(contentType, edm, serviceRoot);
return ODataResponse.fromResponse(response)
.header(ODataHttpHeaders.DATASERVICEVERSION, ODataServiceVersion.V10).build();
}
}
示例2: readServiceDocument
import org.apache.olingo.odata2.api.ep.EntityProvider; //导入方法依赖的package包/类
@Override
public ODataResponse readServiceDocument(GetServiceDocumentUriInfo uri_info, String content_type)
throws ODataException
{
Edm edm = new EdmWrapper(getContext().getService().getEntityDataModel());
return EntityProvider.writeServiceDocument(content_type, edm, ServiceFactory.ROOT_URL);
}
示例3: testServiceDocumentXml
import org.apache.olingo.odata2.api.ep.EntityProvider; //导入方法依赖的package包/类
@Test
public void testServiceDocumentXml() throws EntityProviderException, ODataException {
ODataResponse response =
EntityProvider.writeServiceDocument(HttpContentType.APPLICATION_ATOM_XML, edm, "http://localhost/");
assertNull("EntityProvider should not set content header", response.getContentHeader());
}
示例4: writeEmptyServiceDocumentOverRuntimeDelegate
import org.apache.olingo.odata2.api.ep.EntityProvider; //导入方法依赖的package包/类
@Test
public void writeEmptyServiceDocumentOverRuntimeDelegate() throws Exception {
ODataResponse response =
EntityProvider.writeServiceDocument(HttpContentType.APPLICATION_ATOM_XML, edm, "http://localhost");
String xmlString = verifyResponse(response);
assertXpathExists("/a:service", xmlString);
assertXpathExists("/a:service/a:workspace", xmlString);
assertXpathExists("/a:service/a:workspace/atom:title", xmlString);
assertXpathEvaluatesTo("Default", "/a:service/a:workspace/atom:title", xmlString);
}