Class IpfFhirServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
ca.uhn.fhir.rest.server.RestfulServer
org.openehealth.ipf.commons.ihe.fhir.IpfFhirServlet
- All Implemented Interfaces:
IRestfulServer<ServletRequestDetails>
,IRestfulServerDefaults
,Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
- Direct Known Subclasses:
IpfBootFhirServlet
HAPI FHIR
RestfulServer
implementation, adding a few configuration bits using servlet
init parameters:
- logging (boolean): add global logging interceptor
- highlight (boolean): add response formatting if request was issued from a browser
- pretty (boolean): pretty-print the response
- pagingProviderSize (integer): maximum number of concurrent paging requests
- strict (boolean): strict parsing, i.e. return error on invalid resources
- Since:
- 3.2
- Author:
- Christian Ohr
- See Also:
-
Field Summary
Fields inherited from class ca.uhn.fhir.rest.server.RestfulServer
DEFAULT_ETAG_SUPPORT, DEFAULT_PREFER_RETURN, REQUEST_START_TIME, SERVLET_CONTEXT_ATTRIBUTE
-
Constructor Summary
ConstructorDescriptionIpfFhirServlet
(FhirContext fhirContext) Initializes the servlet with a pre-instantiated FHIR Context.IpfFhirServlet
(FhirVersionEnum fhirVersion) Initialize the servlet with a FHIR version. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
protected INarrativeGenerator
protected IPagingProvider
getDefaultPagingProvider
(int pagingProviderSize) Returns the instance ofIPagingProvider
to be used.protected Object
int
void
init
(javax.servlet.ServletConfig config) RestfulServer assumes that all resource providers are known at init time, which is not the case here.protected void
Called upon initialization of the servlet, which is too early to know about the existing FHIR consumers initialization of Camel routes and endpoints.boolean
boolean
boolean
boolean
void
setDefaultPageSize
(Integer defaultPageSize) void
setFhirContext
(FhirContext fhirContext) void
setFhirVersion
(FhirVersionEnum fhirVersion) void
setLogging
(boolean logging) void
setMaximumPageSize
(Integer maximumPageSize) void
setNarrativeGenerator
(INarrativeGenerator narrativeGenerator) void
setPagingProviderSize
(int pagingProviderSize) void
setPrettyPrint
(boolean prettyPrint) void
setResponseHighlighting
(boolean responseHighlighting) void
setServletName
(String servletName) void
setStrictErrorHandler
(boolean strictErrorHandler) Methods inherited from class ca.uhn.fhir.rest.server.RestfulServer
addHeadersToResponse, addRequestIdToResponse, createConfiguration, createPoweredByAttributes, createPoweredByHeader, createPoweredByHeaderComponentName, createPoweredByHeaderProductName, createPoweredByHeaderProductVersion, determineResourceMethod, doDelete, doGet, doOptions, doPost, doPut, escapedLength, getAddProfileTag, getBundleInclusionRule, getCapabilityStatement, getCopyright, getDefaultPreferReturn, getDefaultResponseEncoding, getElementsSupport, getETagSupport, getFhirContext, getImplementationDescription, getInterceptors_, getInterceptorService, getOrCreateRequestId, getPagingProvider, getPlainProviders, getProviderMethodBindings, getRequestPath, getResourceBindings, getResourceProviders, getServerAddressStrategy, getServerBaseForRequest, getServerBindings, getServerConformanceMethod, getServerConformanceProvider, getServerName, getServerVersion, handleRequest, init, isDefaultPrettyPrint, isIgnoreServerParsedRequestParameters, isUncompressIncomingContents, newRequestDetails, newRequestDetails, newRequestId, populateRequestDetailsFromRequestPath, registerInterceptor, registerProvider, registerProviders, registerProviders, registerProviders, returnResponse, service, setAddProfileTag, setBundleInclusionRule, setCopyright, setDefaultPreferReturn, setDefaultPrettyPrint, setDefaultResponseEncoding, setElementsSupport, setETagSupport, setIgnoreServerParsedRequestParameters, setImplementationDescription, setInterceptors, setInterceptors, setInterceptorService, setPagingProvider, setPlainProviders, setPlainProviders, setProviders, setResourceProviders, setResourceProviders, setServerAddressStrategy, setServerConformanceProvider, setServerName, setServerVersion, setTenantIdentificationStrategy, setUncompressIncomingContents, throwUnknownFhirOperationException, throwUnknownFhirOperationException, throwUnknownResourceTypeException, unregisterAllProviders, unregisterInterceptor, unregisterProvider, unregisterProviders, validateRequest
Methods inherited from class javax.servlet.http.HttpServlet
doHead, doTrace, getLastModified, service
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, log, log
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ca.uhn.fhir.rest.api.server.IRestfulServer
canStoreSearchResults
-
Field Details
-
DEFAULT_SERVLET_NAME
- See Also:
-
-
Constructor Details
-
IpfFhirServlet
public IpfFhirServlet() -
IpfFhirServlet
Initialize the servlet with a FHIR version. During initialization, a new FHIR Context is created and initialized withstrictErrorHandler
andnarrativeGenerator
.- Parameters:
fhirVersion
- FHIR version
-
IpfFhirServlet
Initializes the servlet with a pre-instantiated FHIR Context. No further changes are done to this FHIRContext instance.- Parameters:
fhirContext
- FHIR Context
-
-
Method Details
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException RestfulServer assumes that all resource providers are known at init time, which is not the case here.- Specified by:
init
in interfacejavax.servlet.Servlet
- Overrides:
init
in classjavax.servlet.GenericServlet
- Parameters:
config
- servlet config- Throws:
javax.servlet.ServletException
- servlet exception
-
destroy
public void destroy()- Specified by:
destroy
in interfacejavax.servlet.Servlet
- Overrides:
destroy
in classRestfulServer
-
getDefaultPagingProvider
Returns the instance ofIPagingProvider
to be used. This implementation returnsFifoMemoryPagingProvider
, you may overwrite this e.g. to add a provider backed by a decent Cache implementation. In this case, not forget to set the paging parameters accessible viagetPagingProviderSize()
,getDefaultPageSize()
andgetMaximumPageSize()
.You can also return null in order to disable paging.
The way how paging is actually implemented depends on the respective FHIR consumer endpoints
- Parameters:
pagingProviderSize
- maximum number of parallel paged requests. Note that each request may have an arbitrary number of result resources though.- Returns:
- implementation of
IPagingProvider
- See Also:
-
getDefaultNarrativeGenerator
- Returns:
- the narrative generator, null by default
-
getLoggingInterceptor
- Returns:
- the logging interceptor if
logging
is true
-
setFhirContext
- Overrides:
setFhirContext
in classRestfulServer
-
initialize
protected void initialize()Called upon initialization of the servlet, which is too early to know about the existing FHIR consumers initialization of Camel routes and endpoints.- Overrides:
initialize
in classRestfulServer
-
getServletName
- Specified by:
getServletName
in interfacejavax.servlet.ServletConfig
- Overrides:
getServletName
in classjavax.servlet.GenericServlet
-
setServletName
-
isLogging
public boolean isLogging() -
setLogging
public void setLogging(boolean logging) -
getFhirVersion
-
setFhirVersion
-
isResponseHighlighting
public boolean isResponseHighlighting() -
setResponseHighlighting
public void setResponseHighlighting(boolean responseHighlighting) -
isPrettyPrint
public boolean isPrettyPrint() -
setPrettyPrint
public void setPrettyPrint(boolean prettyPrint) -
getPagingProviderSize
public int getPagingProviderSize() -
setPagingProviderSize
public void setPagingProviderSize(int pagingProviderSize) -
getDefaultPageSize
- Specified by:
getDefaultPageSize
in interfaceIRestfulServerDefaults
- Overrides:
getDefaultPageSize
in classRestfulServer
-
setDefaultPageSize
- Overrides:
setDefaultPageSize
in classRestfulServer
-
getMaximumPageSize
- Specified by:
getMaximumPageSize
in interfaceIRestfulServerDefaults
- Overrides:
getMaximumPageSize
in classRestfulServer
-
setMaximumPageSize
- Overrides:
setMaximumPageSize
in classRestfulServer
-
isStrictErrorHandler
public boolean isStrictErrorHandler() -
setStrictErrorHandler
public void setStrictErrorHandler(boolean strictErrorHandler) -
getNarrativeGenerator
-
setNarrativeGenerator
-