java.lang.Object |
↳ |
com.atlassian.confluence.xwork.ConfluenceActionValidatorManager |
Class Overview
Copy of the XWork ActionValidatorManager that clears the context of validators before it caches them.
Since validator contexts were composed of actions, this was causing action instances to end up in
the cache where they would hang around forever holding onto references to the entire Spring context.
This class makes use of a delegating validationContext. This is to prevent race conditions. It delegates to
a threadlocal to ensure that any validation messages are set on the appropriate context and any information is
retrieved from the correct context. As the context contains rather large (in Mb) objects, it is absolutely essential
that it is set to null when the method returns.
Contains code that is Copyright (c) 2002-2003 by OpenSymphony, used under the Apache license, original
author credits included below:
Summary
Public Methods |
synchronized
static
List
|
getValidators(Class clazz, String context)
Returns a list of validators for the given class and context.
|
static
void
|
validate(Object object, String context, ValidatorContext validatorContext)
Validates an action give its context and a validation context.
|
static
void
|
validate(Object object, String context)
Validates the given object using action and its context.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
Constants
protected
static
final
String
VALIDATION_CONFIG_SUFFIX
The file suffix for any validation file.
Constant Value:
"-validation.xml"
Public Constructors
public
ConfluenceActionValidatorManager
()
Public Methods
public
static
synchronized
List
getValidators
(Class clazz, String context)
Returns a list of validators for the given class and context. This is the primary
lookup method for validators.
Parameters
clazz
| the class to lookup. |
context
| the context of the action class - can be null. |
Returns
- a list of all validators for the given class and context.
public
static
void
validate
(Object object, String context, ValidatorContext validatorContext)
Validates an action give its context and a validation context.
Parameters
object
| the action to validate. |
context
| the action's context. |
Throws
ValidationException
| if an error happens when validating the action.
|
public
static
void
validate
(Object object, String context)
Validates the given object using action and its context.
Parameters
object
| the action to validate. |
context
| the action's context. |
Throws
ValidationException
| if an error happens when validating the action.
|
Protected Methods
protected
static
String
buildValidatorKey
(Class clazz, String context)
Builds a key for validators - used when caching validators.
Parameters
clazz
| the action. |
context
| the action's context. |
Returns
- a validator key which is the class name plus context.