com.atlassian.plugins.rest.common.validation
Class ValidationInterceptor

java.lang.Object
  extended by com.atlassian.plugins.rest.common.validation.ValidationInterceptor
All Implemented Interfaces:
ResourceInterceptor

public class ValidationInterceptor
extends java.lang.Object
implements ResourceInterceptor

Uses JSR-303 to validate incoming entity objects. If validation fails, it will return a 400 with a ValidationErrors instance containing the constraint violations. The error messages will be processed with either SAL or the provided custom MessageInterpolator.

Since:
2.0

Constructor Summary
ValidationInterceptor(com.atlassian.sal.api.message.I18nResolver i18nResolver)
           
ValidationInterceptor(javax.validation.MessageInterpolator messageInterpolator)
           
 
Method Summary
 void intercept(MethodInvocation invocation)
          Intercepts the method invocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationInterceptor

public ValidationInterceptor(com.atlassian.sal.api.message.I18nResolver i18nResolver)

ValidationInterceptor

public ValidationInterceptor(javax.validation.MessageInterpolator messageInterpolator)
Method Detail

intercept

public void intercept(MethodInvocation invocation)
               throws java.lang.IllegalAccessException,
                      java.lang.reflect.InvocationTargetException
Description copied from interface: ResourceInterceptor
Intercepts the method invocation

Specified by:
intercept in interface ResourceInterceptor
Parameters:
invocation - Context information about the invocation
Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException


Copyright © 2014 Atlassian. All Rights Reserved.