Class IpfFhirServlet

  • All Implemented Interfaces:
    IRestfulServer<ServletRequestDetails>, IRestfulServerDefaults, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
    Direct Known Subclasses:
    IpfBootFhirServlet

    public class IpfFhirServlet
    extends RestfulServer
    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:
    Serialized Form
    • Constructor Detail

      • IpfFhirServlet

        public IpfFhirServlet()
      • IpfFhirServlet

        public IpfFhirServlet​(FhirVersionEnum fhirVersion)
        Initialize the servlet with a FHIR version. During initialization, a new FHIR Context is created and initialized with strictErrorHandler and narrativeGenerator.
        Parameters:
        fhirVersion - FHIR version
      • IpfFhirServlet

        public IpfFhirServlet​(FhirContext fhirContext)
        Initializes the servlet with a pre-instantiated FHIR Context. No further changes are done to this FHIRContext instance.
        Parameters:
        fhirContext - FHIR Context
    • Method Detail

      • 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 interface javax.servlet.Servlet
        Overrides:
        init in class javax.servlet.GenericServlet
        Parameters:
        config - servlet config
        Throws:
        javax.servlet.ServletException - servlet exception
      • destroy

        public void destroy()
        Specified by:
        destroy in interface javax.servlet.Servlet
        Overrides:
        destroy in class RestfulServer
      • getDefaultNarrativeGenerator

        protected INarrativeGenerator getDefaultNarrativeGenerator()
        Returns:
        the narrative generator, null by default
      • getLoggingInterceptor

        protected Object getLoggingInterceptor()
        Returns:
        the logging interceptor if logging is true
      • 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 class RestfulServer
      • getServletName

        public String getServletName()
        Specified by:
        getServletName in interface javax.servlet.ServletConfig
        Overrides:
        getServletName in class javax.servlet.GenericServlet
      • setServletName

        public void setServletName​(String servletName)
      • isLogging

        public boolean isLogging()
      • setLogging

        public void setLogging​(boolean logging)
      • setFhirVersion

        public void setFhirVersion​(FhirVersionEnum fhirVersion)
      • 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)
      • isStrictErrorHandler

        public boolean isStrictErrorHandler()
      • setStrictErrorHandler

        public void setStrictErrorHandler​(boolean strictErrorHandler)
      • setNarrativeGenerator

        public void setNarrativeGenerator​(INarrativeGenerator narrativeGenerator)