public class OpenApiValidationInterceptor
extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter
You can customize logging output of interceptor by implementing
interface ValidationReportHandler and providing instance
to constructor.
| Modifier and Type | Field and Description |
|---|---|
protected com.atlassian.oai.validator.springmvc.OpenApiValidationService |
openApiValidationService |
| Constructor and Description |
|---|
OpenApiValidationInterceptor(org.springframework.core.io.support.EncodedResource apiSpecification) |
OpenApiValidationInterceptor(OpenApiInteractionValidator validator) |
OpenApiValidationInterceptor(OpenApiInteractionValidator validator,
ValidationReportHandler validationReportHandler) |
OpenApiValidationInterceptor(com.atlassian.oai.validator.springmvc.OpenApiValidationService openApiValidationService) |
OpenApiValidationInterceptor(com.atlassian.oai.validator.springmvc.OpenApiValidationService openApiValidationService,
ValidationReportHandler validationReportHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
postHandle(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
Object handler,
org.springframework.web.servlet.ModelAndView modelAndView)
Validates the given response.
|
boolean |
preHandle(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
Object handler)
Validates the given requests.
|
protected final com.atlassian.oai.validator.springmvc.OpenApiValidationService openApiValidationService
public OpenApiValidationInterceptor(@Nonnull org.springframework.core.io.support.EncodedResource apiSpecification) throws IOException
IOExceptionpublic OpenApiValidationInterceptor(@Nonnull OpenApiInteractionValidator validator)
public OpenApiValidationInterceptor(@Nonnull OpenApiInteractionValidator validator, @Nonnull ValidationReportHandler validationReportHandler)
public OpenApiValidationInterceptor(@Nonnull com.atlassian.oai.validator.springmvc.OpenApiValidationService openApiValidationService)
public OpenApiValidationInterceptor(@Nonnull com.atlassian.oai.validator.springmvc.OpenApiValidationService openApiValidationService, @Nonnull ValidationReportHandler validationReportHandler)
public boolean preHandle(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
Object handler)
throws Exception
InvalidRequestException will be thrown leading to an error response.
Only ResettableRequestServletWrapper can be validated. Wrapping is done within the
OpenApiValidationFilter.
preHandle in interface org.springframework.web.servlet.HandlerInterceptorpreHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapterservletRequest - the HttpServletRequest to validateservletResponse - the servlet responsehandler - a handlertrue if the request is valid against or not defined in the API specification or
the servlet is not a ResettableRequestServletWrapperException - if the request is invalid against the API specification or the requests body
can't be readpublic void postHandle(javax.servlet.http.HttpServletRequest servletRequest,
javax.servlet.http.HttpServletResponse servletResponse,
Object handler,
org.springframework.web.servlet.ModelAndView modelAndView)
throws Exception
InvalidResponseException will be thrown leading
to an error response.
Only ContentCachingResponseWrapper can be validated. Wrapping is done within the
OpenApiValidationFilter.
postHandle in interface org.springframework.web.servlet.HandlerInterceptorpostHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapterservletRequest - the servlet requestservletResponse - the HttpServletResponse to validatehandler - a handlermodelAndView - a model and viewException - if the response is invalid against the API specification or the response body can't be readCopyright © 2016–2019 Atlassian. All rights reserved.