mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
WW-1897 Create JSONValidationInterceptor
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@533386 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+3
-1
@@ -80,11 +80,13 @@ public class JSONValidationInterceptor extends AnnotationValidationInterceptor {
|
||||
response.setStatus(validationFailedStatus);
|
||||
response.getWriter().print(buildResponse(validationAware));
|
||||
return Action.NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String validateOnly = request.getParameter("validateOnly");
|
||||
if (validateOnly != null && "true".equals(validateOnly)) {
|
||||
//there were no errors
|
||||
response.getWriter().print("/* {} */");
|
||||
return Action.NONE;
|
||||
} else {
|
||||
return invocation.invoke();
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ public class JSONValidationInterceptorTest extends StrutsTestCase {
|
||||
String json = stringWriter.toString();
|
||||
|
||||
String normalizedActual = TestUtils.normalize(json, true);
|
||||
assertEquals("", normalizedActual);
|
||||
assertEquals("/*{}*/", normalizedActual);
|
||||
assertFalse(invocation.isExecuted());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user