本文整理汇总了Java中ca.uhn.fhir.rest.server.ETagSupportEnum类的典型用法代码示例。如果您正苦于以下问题:Java ETagSupportEnum类的具体用法?Java ETagSupportEnum怎么用?Java ETagSupportEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ETagSupportEnum类属于ca.uhn.fhir.rest.server包,在下文中一共展示了ETagSupportEnum类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initialize
点赞 2
import ca.uhn.fhir.rest.server.ETagSupportEnum; //导入依赖的package包/类
@Override
protected void initialize() throws ServletException {
// ... define your resource providers here ...
// ETag support is enabled by default
setETagSupport(ETagSupportEnum.ENABLED);
}
开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:8,
代码来源:ServerETagExamples.java
示例2: invokeServer
点赞 2
import ca.uhn.fhir.rest.server.ETagSupportEnum; //导入依赖的package包/类
@Override
public IBundleProvider invokeServer(RequestDetails theRequest, Object[] theMethodParams) throws InvalidRequestException, InternalErrorException {
theMethodParams[myIdIndex] = theRequest.getId();
if (myVersionIdIndex != null) {
theMethodParams[myVersionIdIndex] = new IdDt(theRequest.getId().getVersionIdPart());
}
Object response = invokeServerMethod(theMethodParams);
IBundleProvider retVal = toResourceList(response);
if (theRequest.getServer().getETagSupport() == ETagSupportEnum.ENABLED) {
String ifNoneMatch = ((Request)theRequest).getServletRequest().getHeader(Constants.HEADER_IF_NONE_MATCH_LC);
if (retVal.size() == 1 && StringUtils.isNotBlank(ifNoneMatch)) {
List<IResource> responseResources = retVal.getResources(0, 1);
IResource responseResource = responseResources.get(0);
ifNoneMatch = MethodUtil.parseETagValue(ifNoneMatch);
if (responseResource.getId() != null && responseResource.getId().hasVersionIdPart()) {
if (responseResource.getId().getVersionIdPart().equals(ifNoneMatch)) {
ourLog.debug("Returning HTTP 301 because request specified {}={}", Constants.HEADER_IF_NONE_MATCH, ifNoneMatch);
throw new NotModifiedException("Not Modified");
}
}
}
}
return retVal;
}
开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:29,
代码来源:ReadMethodBinding.java
示例3: getETagSupport
点赞 2
import ca.uhn.fhir.rest.server.ETagSupportEnum; //导入依赖的package包/类
@Override
public ETagSupportEnum getETagSupport() {
return ETagSupportEnum.DISABLED;
}
开发者ID:bhits,
项目名称:iexhub,
代码行数:5,
代码来源:JaxRsConsentRestProvider.java
示例4: getETagSupport
点赞 2
import ca.uhn.fhir.rest.server.ETagSupportEnum; //导入依赖的package包/类
@Override
public ETagSupportEnum getETagSupport() {
return ETagSupportEnum.DISABLED;
}
开发者ID:bhits,
项目名称:iexhub,
代码行数:5,
代码来源:JaxRsPatientRestProvider.java
示例5: initialize
点赞 2
import ca.uhn.fhir.rest.server.ETagSupportEnum; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void initialize() throws ServletException {
super.initialize();
/*
* We want to support FHIR DSTU2 format. This means that the server
* will use the DSTU2 bundle format and other DSTU2 encoding changes.
*
* If you want to use DSTU1 instead, change the following line, and change the 2 occurrences of dstu2 in web.xml to dstu1
*/
FhirVersionEnum fhirVersion = FhirVersionEnum.DSTU2;
setFhirContext(new FhirContext(fhirVersion));
// Get the spring context from the web container (it's declared in web.xml)
myAppCtx = ContextLoaderListener.getCurrentWebApplicationContext();
/*
* The hapi-fhir-server-resourceproviders-dev.xml file is a spring configuration
* file which is automatically generated as a part of hapi-fhir-jpaserver-base and
* contains bean definitions for a resource provider for each resource type
*/
List<IResourceProvider> beans = myAppCtx.getBean("myResourceProvidersDstu2", List.class);
setResourceProviders(beans);
/*
* The system provider implements non-resource-type methods, such as
* transaction, and global history.
*/
Object systemProvider = myAppCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu2.class);
setPlainProviders(systemProvider);
/*
* The conformance provider exports the supported resources, search parameters, etc for
* this server. The JPA version adds resource counts to the exported statement, so it
* is a nice addition.
*/
IFhirSystemDao<Bundle> systemDao = myAppCtx.getBean("mySystemDaoDstu2", IFhirSystemDao.class);
JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao);
confProvider.setImplementationDescription("Example Server");
setServerConformanceProvider(confProvider);
/*
* Enable ETag Support (this is already the default)
*/
setETagSupport(ETagSupportEnum.ENABLED);
/*
* This tells the server to use "browser friendly" MIME types if it
* detects that the request is coming from a browser, in the hopes that the
* browser won't just treat the content as a binary payload and try
* to download it (which is what generally happens if you load a
* FHIR URL in a browser).
*
* This means that the server isn't technically complying with the
* FHIR specification for direct browser requests, but this mode
* is very helpful for testing and troubleshooting since it means
* you can look at FHIR URLs directly in a browser.
*/
setUseBrowserFriendlyContentTypes(true);
/*
* Default to XML and pretty printing
*/
setDefaultPrettyPrint(true);
setDefaultResponseEncoding(EncodingEnum.JSON);
/*
* This is a simple paging strategy that keeps the last 10 searches in memory
*/
setPagingProvider(new FifoMemoryPagingProvider(10));
/*
* Load interceptors for the server from Spring (these are defined in hapi-fhir-server-config.xml
*/
List<IServerInterceptor> interceptorBeans = myAppCtx.getBean("myServerInterceptors", List.class);
for (IServerInterceptor interceptor : interceptorBeans) {
this.registerInterceptor(interceptor);
}
}
开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:82,
代码来源:JpaServerDemo.java
示例6: invokeServer
点赞 2
import ca.uhn.fhir.rest.server.ETagSupportEnum; //导入依赖的package包/类
@Override
public IBundleProvider invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws InvalidRequestException, InternalErrorException {
IIdType requestId = theRequest.getId();
theMethodParams[myIdIndex] = ParameterUtil.convertIdToType(requestId, myIdParameterType);
Object response = invokeServerMethod(theServer, theRequest, theMethodParams);
IBundleProvider retVal = toResourceList(response);
if (retVal.size() == 1) {
List<IBaseResource> responseResources = retVal.getResources(0, 1);
IBaseResource responseResource = responseResources.get(0);
// If-None-Match
if (theRequest.getServer().getETagSupport() == ETagSupportEnum.ENABLED) {
String ifNoneMatch = theRequest.getHeader(Constants.HEADER_IF_NONE_MATCH_LC);
if (StringUtils.isNotBlank(ifNoneMatch)) {
ifNoneMatch = ParameterUtil.parseETagValue(ifNoneMatch);
if (responseResource.getIdElement() != null && responseResource.getIdElement().hasVersionIdPart()) {
if (responseResource.getIdElement().getVersionIdPart().equals(ifNoneMatch)) {
ourLog.debug("Returning HTTP 304 because request specified {}={}", Constants.HEADER_IF_NONE_MATCH, ifNoneMatch);
throw new NotModifiedException("Not Modified");
}
}
}
}
// If-Modified-Since
String ifModifiedSince = theRequest.getHeader(Constants.HEADER_IF_MODIFIED_SINCE_LC);
if (isNotBlank(ifModifiedSince)) {
Date ifModifiedSinceDate = DateUtils.parseDate(ifModifiedSince);
Date lastModified = null;
if (responseResource instanceof IResource) {
InstantDt lastModifiedDt = ResourceMetadataKeyEnum.UPDATED.get((IResource) responseResource);
if (lastModifiedDt != null) {
lastModified = lastModifiedDt.getValue();
}
} else {
lastModified = responseResource.getMeta().getLastUpdated();
}
if (lastModified != null && lastModified.getTime() <= ifModifiedSinceDate.getTime()) {
ourLog.debug("Returning HTTP 304 because If-Modified-Since does not match");
throw new NotModifiedException("Not Modified");
}
}
} // if we have at least 1 result
return retVal;
}
开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:54,
代码来源:ReadMethodBinding.java