Smile CDR v2022.08.PRE
On this page:

11.2FHIR Endpoint Examples


This page contains example interceptors that can be registered against a FHIR Endpoint module, including:

11.2.1Example: Override CapabilityStatement Generation


The following interceptor can be used to replace the built-in automatic CapabilityStatement generation provided by Smile CDR. This is useful if you are implementing a specific implementation guide that requires a static CapabilityStatement.

 * This interceptor overrides the built-in automatic CpaabilityStatement generator in
 * Smile CDR and instead uses a static resource when a client invokes the
 * "capabilities" operation (i.e. /metadata)
public class OverrideCapabilityStatementInterceptor extends StaticCapabilityStatementInterceptor {

	 * Constructor
	 * Note that this class does not have any @Hook methods since the actual interceptor
	 * hook is defined in the superclass. We just use this constructor in our
	 * implementation to configure the interceptor.
	public OverrideCapabilityStatementInterceptor() {

		// This interceptor uses a CapabilityStatement resource that is available
		// on the classpath. This file can be built into the interceptor project by
		// placing it in "src/main/resources/", or it can be placed in the Smile CDR
		// installation in the "classes/" directory.

		// Alternately, you can build the CapabilityStatement programatically
		CapabilityStatement cs = new CapabilityStatement();