Class AbstractJaxRsConformanceProvider

  • All Implemented Interfaces:
    ca.uhn.fhir.rest.server.IResourceProvider, ca.uhn.fhir.rest.server.IRestfulServerDefaults

    @Produces({"application/json","application/xml"})
    public abstract class AbstractJaxRsConformanceProvider
    extends AbstractJaxRsProvider
    implements ca.uhn.fhir.rest.server.IResourceProvider
    This is the conformance provider for the jax rs servers. It requires all providers to be registered during startup because the conformance profile is generated during the postconstruct phase.
    Author:
    Peter Van Houte | peter.vanhoute@agfa.com | Agfa Healthcare
    • Constructor Detail

      • AbstractJaxRsConformanceProvider

        protected AbstractJaxRsConformanceProvider​(String implementationDescription,
                                                   String serverName,
                                                   String serverVersion)
        Constructor allowing the description, servername and server to be set
        Parameters:
        implementationDescription - the implementation description. If null, "" is used
        serverName - the server name. If null, "" is used
        serverVersion - the server version. If null, "" is used
      • AbstractJaxRsConformanceProvider

        protected AbstractJaxRsConformanceProvider​(ca.uhn.fhir.context.FhirContext ctx,
                                                   String implementationDescription,
                                                   String serverName,
                                                   String serverVersion)
        Constructor allowing the description, servername and server to be set
        Parameters:
        ctx - the FhirContext instance.
        implementationDescription - the implementation description. If null, "" is used
        serverName - the server name. If null, "" is used
        serverVersion - the server version. If null, "" is used
    • Method Detail

      • setUpPostConstruct

        @PostConstruct
        protected void setUpPostConstruct()
        This method will set the conformance during the postconstruct phase. The method getProviders() is used to get all the resource providers include in the conformance
      • getProviders

        protected abstract ConcurrentHashMap<Class<? extends ca.uhn.fhir.rest.server.IResourceProvider>,​ca.uhn.fhir.rest.server.IResourceProvider> getProviders()
        This method must return all the resource providers which need to be included in the conformance
        Returns:
        a map of the resource providers and their corresponding classes. This class needs to be given explicitly because retrieving the interface using Object.getClass() may not give the correct interface in a jee environment.
      • conformanceUsingOptions

        @OPTIONS
        @Path("/metadata")
        public javax.ws.rs.core.Response conformanceUsingOptions()
                                                          throws IOException
        This method will retrieve the conformance using the http OPTIONS method
        Returns:
        the response containing the conformance
        Throws:
        IOException
      • conformance

        @GET
        @Path("/metadata")
        public javax.ws.rs.core.Response conformance()
                                              throws IOException
        This method will retrieve the conformance using the http GET method
        Returns:
        the response containing the conformance
        Throws:
        IOException
      • addProvider

        public int addProvider​(ca.uhn.fhir.rest.server.IResourceProvider theProvider,
                               Class<? extends ca.uhn.fhir.rest.server.IResourceProvider> theProviderInterface)
                        throws ca.uhn.fhir.context.ConfigurationException
        This method will add a provider to the conformance. This method is almost an exact copy of RestfulServer.findResourceMethods(Object)
        Parameters:
        theProvider - an instance of the provider interface
        theProviderInterface - the class describing the providers interface
        Returns:
        the numbers of basemethodbindings added
        Throws:
        ca.uhn.fhir.context.ConfigurationException
        See Also:
        RestfulServer.findResourceMethods(Object)
      • getResourceType

        public Class<org.hl7.fhir.instance.model.api.IBaseResource> getResourceType()
        Specified by:
        getResourceType in interface ca.uhn.fhir.rest.server.IResourceProvider