本文整理汇总了Java中ca.uhn.example.provider.PatientResourceProvider类的典型用法代码示例。如果您正苦于以下问题:Java PatientResourceProvider类的具体用法?Java PatientResourceProvider怎么用?Java PatientResourceProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PatientResourceProvider类属于ca.uhn.example.provider包,在下文中一共展示了PatientResourceProvider类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import ca.uhn.example.provider.PatientResourceProvider; //导入依赖的package包/类
/**
* This method is called automatically when the
* servlet is initializing.
*/
@Override
public void initialize() {
/*
* Two resource providers are defined. Each one handles a specific
* type of resource.
*/
List<IResourceProvider> providers = new ArrayList<IResourceProvider>();
providers.add(new PatientResourceProvider());
providers.add(new OrganizationResourceProvider());
setResourceProviders(providers);
/*
* Use a narrative generator. This is a completely optional step,
* but can be useful as it causes HAPI to generate narratives for
* resources which don't otherwise have one.
*/
INarrativeGenerator narrativeGen = new DefaultThymeleafNarrativeGenerator();
getFhirContext().setNarrativeGenerator(narrativeGen);
/*
* Use nice coloured HTML when a browser is used to request the content
*/
registerInterceptor(new ResponseHighlighterInterceptor());
}
示例2: initialize
import ca.uhn.example.provider.PatientResourceProvider; //导入依赖的package包/类
/**
* This method is called automatically when the
* servlet is initializing.
*/
@Override
public void initialize() {
/*
* Two resource providers are defined. Each one handles a specific
* type of resource.
*/
List<IResourceProvider> providers = new ArrayList<IResourceProvider>();
providers.add(new PatientResourceProvider());
providers.add(new OrganizationResourceProvider());
setResourceProviders(providers);
/*
* Use a narrative generator. This is a completely optional step,
* but can be useful as it causes HAPI to generate narratives for
* resources which don't otherwise have one.
*/
INarrativeGenerator narrativeGen = new DefaultThymeleafNarrativeGenerator();
getFhirContext().setNarrativeGenerator(narrativeGen);
/*
* Tells HAPI to use content types which are not technically FHIR compliant when a browser is detected as the
* requesting client. This prevents browsers from trying to download resource responses instead of displaying them
* inline which can be handy for troubleshooting.
*/
setUseBrowserFriendlyContentTypes(true);
}
示例3: initialize
import ca.uhn.example.provider.PatientResourceProvider; //导入依赖的package包/类
/**
* This method is called automatically when the
* servlet is initializing.
*/
@Override
public void initialize() {
/*
* Two resource providers are defined. Each one handles a specific
* type of resource.
*/
List<IResourceProvider> providers = new ArrayList<IResourceProvider>();
providers.add(new PatientResourceProvider());
providers.add(new OrganizationResourceProvider());
setResourceProviders(providers);
/*
* Use a narrative generator. This is a completely optional step,
* but can be useful as it causes HAPI to generate narratives for
* resources which don't otherwise have one.
*/
INarrativeGenerator narrativeGen = new DefaultThymeleafNarrativeGenerator();
getFhirContext().setNarrativeGenerator(narrativeGen);
/*
* Enable CORS
*/
CorsConfiguration config = new CorsConfiguration();
CorsInterceptor corsInterceptor = new CorsInterceptor(config);
config.addAllowedHeader("Accept");
config.addAllowedHeader("Content-Type");
config.addAllowedOrigin("*");
config.addExposedHeader("Location");
config.addExposedHeader("Content-Location");
config.setAllowedMethods(Arrays.asList("GET","POST","PUT","DELETE","OPTIONS"));
registerInterceptor(corsInterceptor);
/*
* This server interceptor causes the server to return nicely
* formatter and coloured responses instead of plain JSON/XML if
* the request is coming from a browser window. It is optional,
* but can be nice for testing.
*/
registerInterceptor(new ResponseHighlighterInterceptor());
/*
* Tells the server to return pretty-printed responses by default
*/
setDefaultPrettyPrint(true);
}