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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected 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 wrapped HttpServletRequest can be validated. Wrapping is done within the
OpenApiValidationFilter.
servletRequest - 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)
InvalidResponseException will be thrown leading
to an error response.
Only wrapped HttpServletResponse can be validated. Wrapping is done within the
OpenApiValidationFilter.
servletRequest - the servlet requestservletResponse - the HttpServletResponse to validatehandler - a handlermodelAndView - a model and viewCopyright © 2016–2022 Atlassian. All rights reserved.