Class DefaultValidationReportHandler
java.lang.Object
com.atlassian.oai.validator.springmvc.DefaultValidationReportHandler
- All Implemented Interfaces:
ValidationReportHandler
Default implementation of
ValidationReportHandler. It logs request/response
validation findings to project logger. In case of:
- error - throws
InvalidRequestExceptionfor request orInvalidResponseExceptionfor response and write messages to log.error - info/warn/ignore - write messages to log.info
- no issue - log.debug end of validation
ValidationReportFormat and inject it to constructor.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultValidationReportHandler(ValidationReportFormat validationReportFormat) -
Method Summary
Modifier and TypeMethodDescriptionprotected RuntimeExceptioncreateValidationException(ValidationReport validationReport, ValidationReport.MessageContext.Location location) voidhandleRequestReport(String loggingKey, ValidationReport validationReport) Method which gives you way how to override logging of request validation issues.voidhandleResponseReport(String loggingKey, ValidationReport validationReport) Method which gives you way how to override logging of response validation issues.protected voidlogApiValidation(BiConsumer<String, String[]> logConsumer, ValidationReport.MessageContext.Location location, String loggingKey, Set<ValidationReport.Level> validationLevels, String message) protected voidprocessApiValidationReport(ValidationReport.MessageContext.Location location, String loggingKey, ValidationReport validationReport)
-
Constructor Details
-
DefaultValidationReportHandler
public DefaultValidationReportHandler() -
DefaultValidationReportHandler
-
-
Method Details
-
handleRequestReport
Description copied from interface:ValidationReportHandlerMethod which gives you way how to override logging of request validation issues.- Specified by:
handleRequestReportin interfaceValidationReportHandler- Parameters:
loggingKey- request identifier - method and request pathvalidationReport- result of validation
-
handleResponseReport
Description copied from interface:ValidationReportHandlerMethod which gives you way how to override logging of response validation issues.- Specified by:
handleResponseReportin interfaceValidationReportHandler- Parameters:
loggingKey- request identifier - method and request pathvalidationReport- result of validation
-
processApiValidationReport
protected void processApiValidationReport(ValidationReport.MessageContext.Location location, String loggingKey, ValidationReport validationReport) -
logApiValidation
protected void logApiValidation(BiConsumer<String, String[]> logConsumer, ValidationReport.MessageContext.Location location, String loggingKey, Set<ValidationReport.Level> validationLevels, String message) -
createValidationException
protected RuntimeException createValidationException(ValidationReport validationReport, ValidationReport.MessageContext.Location location)
-