Class RequestValidatingInterceptor
- java.lang.Object
-
- ca.uhn.fhir.rest.server.interceptor.BaseValidatingInterceptor<String>
-
- ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor
-
public class RequestValidatingInterceptor extends BaseValidatingInterceptor<String>
This interceptor intercepts each incoming request and if it contains a FHIR resource, validates that resource. The interceptor may be configured to run any validator modules, and will then add headers to the response or fail the request with anHTTP 422 Unprocessable Entity.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_RESPONSE_HEADER_NAMEX-HAPI-Request-Validationstatic StringREQUEST_VALIDATION_RESULTAuser dataentry will be created with this key which contains theValidationResultfrom validating the request.-
Fields inherited from class ca.uhn.fhir.rest.server.interceptor.BaseValidatingInterceptor
DEFAULT_RESPONSE_HEADER_VALUE
-
-
Constructor Summary
Constructors Constructor Description RequestValidatingInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanincomingRequestPostProcessed(RequestDetails theRequestDetails, javax.servlet.http.HttpServletRequest theRequest, javax.servlet.http.HttpServletResponse theResponse)booleanisAddValidationResultsToResponseOperationOutcome()If set to true (default is true), the validation results will be added to the OperationOutcome being returned to the client, unless the response being returned is not an OperationOutcome to begin with (e.g.booleanoutgoingResponse(RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theResponseObject)voidsetAddValidationResultsToResponseOperationOutcome(boolean theAddValidationResultsToResponseOperationOutcome)If set to true (default is true), the validation results will be added to the OperationOutcome being returned to the client, unless the response being returned is not an OperationOutcome to begin with (e.g.voidsetResponseHeaderName(String theResponseHeaderName)Sets the name of the response header to add validation failures to-
Methods inherited from class ca.uhn.fhir.rest.server.interceptor.BaseValidatingInterceptor
addValidatorModule, fail, getAddResponseOutcomeHeaderOnSeverity, getMaximumHeaderLength, getResponseOutcomeHeaderName, getValidatorModules, isIgnoreValidatorExceptions, postProcessResult, postProcessResultOnFailure, setAddResponseHeaderOnSeverity, setAddResponseOutcomeHeaderOnSeverity, setFailOnSeverity, setIgnoreValidatorExceptions, setMaximumHeaderLength, setResponseHeaderValue, setResponseHeaderValueNoIssues, setResponseOutcomeHeaderName, setValidatorModules, validate
-
-
-
-
Field Detail
-
DEFAULT_RESPONSE_HEADER_NAME
public static final String DEFAULT_RESPONSE_HEADER_NAME
X-HAPI-Request-Validation- See Also:
- Constant Field Values
-
REQUEST_VALIDATION_RESULT
public static final String REQUEST_VALIDATION_RESULT
Auser dataentry will be created with this key which contains theValidationResultfrom validating the request.
-
-
Constructor Detail
-
RequestValidatingInterceptor
public RequestValidatingInterceptor()
-
-
Method Detail
-
incomingRequestPostProcessed
public boolean incomingRequestPostProcessed(RequestDetails theRequestDetails, javax.servlet.http.HttpServletRequest theRequest, javax.servlet.http.HttpServletResponse theResponse) throws ca.uhn.fhir.rest.server.exceptions.AuthenticationException
- Throws:
ca.uhn.fhir.rest.server.exceptions.AuthenticationException
-
isAddValidationResultsToResponseOperationOutcome
public boolean isAddValidationResultsToResponseOperationOutcome()
If set to true (default is true), the validation results will be added to the OperationOutcome being returned to the client, unless the response being returned is not an OperationOutcome to begin with (e.g. if the client has requestedReturn: prefer=representation)
-
outgoingResponse
public boolean outgoingResponse(RequestDetails theRequestDetails, org.hl7.fhir.instance.model.api.IBaseResource theResponseObject)
-
setAddValidationResultsToResponseOperationOutcome
public void setAddValidationResultsToResponseOperationOutcome(boolean theAddValidationResultsToResponseOperationOutcome)
If set to true (default is true), the validation results will be added to the OperationOutcome being returned to the client, unless the response being returned is not an OperationOutcome to begin with (e.g. if the client has requestedReturn: prefer=representation)
-
setResponseHeaderName
public void setResponseHeaderName(String theResponseHeaderName)
Sets the name of the response header to add validation failures to
-
-