mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
Fix wrong closing HTML tags in javadoc comments
This commit is contained in:
+7
-5
@@ -28,18 +28,20 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This is an example of a custom FreemarkerManager, mean to be
|
||||
* instantiated through Spring.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* It will add into Freemarker's model
|
||||
* an utility class called {@link CustomFreemarkerManagerUtil} as a simple
|
||||
* example demonstrating how to extends FreemarkerManager.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* </p>
|
||||
* <p>
|
||||
* The {@link CustomFreemarkerManagerUtil} will be created by Spring and
|
||||
* injected through constructor injection.
|
||||
* <p/>
|
||||
* </p>
|
||||
*/
|
||||
public class CustomFreemarkerManager extends FreemarkerManager {
|
||||
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<H2>Welcome to the Struts data table portlet</H2>
|
||||
<p/>
|
||||
<h2>Welcome to the Struts data table portlet</h2>
|
||||
<p>
|
||||
This a simple table showing the database data:
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
|
||||
@@ -17,9 +17,10 @@ package com.opensymphony.xwork2;
|
||||
|
||||
/**
|
||||
* All actions <b>may</b> implement this interface, which exposes the <code>execute()</code> method.
|
||||
* <p/>
|
||||
* <p>
|
||||
* However, as of XWork 1.1, this is <b>not</b> required and is only here to assist users. You are free to create POJOs
|
||||
* that honor the same contract defined by this interface without actually implementing the interface.
|
||||
* </p>
|
||||
*/
|
||||
public interface Action {
|
||||
|
||||
@@ -44,6 +45,7 @@ public interface Action {
|
||||
public static final String ERROR = "error";
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The action execution require more input
|
||||
* in order to succeed.
|
||||
* This result is typically used if a form
|
||||
@@ -51,10 +53,13 @@ public interface Action {
|
||||
* to provide defaults for a form. The
|
||||
* form associated with the handler should be
|
||||
* shown to the end user.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* This result is also used if the given input
|
||||
* params are invalid, meaning the user
|
||||
* should try providing input again.
|
||||
* </p>
|
||||
*/
|
||||
public static final String INPUT = "input";
|
||||
|
||||
|
||||
@@ -25,16 +25,22 @@ import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The ActionContext is the context in which an {@link Action} is executed. Each context is basically a
|
||||
* container of objects an action needs for execution like the session, parameters, locale, etc. <p>
|
||||
* <p/>
|
||||
* container of objects an action needs for execution like the session, parameters, locale, etc.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The ActionContext is thread local which means that values stored in the ActionContext are
|
||||
* unique per thread. See the {@link ThreadLocal} class for more information. The benefit of
|
||||
* this is you don't need to worry about a user specific action context, you just get it:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <ul><code>ActionContext context = ActionContext.getContext();</code></ul>
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Finally, because of the thread local usage you don't need to worry about making your actions thread safe.
|
||||
* </p>
|
||||
*
|
||||
* @author Patrick Lightbody
|
||||
* @author Bill Lynch (docs)
|
||||
|
||||
@@ -83,23 +83,31 @@ public interface ActionInvocation extends Serializable {
|
||||
/**
|
||||
* Sets the result code, possibly overriding the one returned by the
|
||||
* action.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* The "intended" purpose of this method is to allow PreResultListeners to
|
||||
* override the result code returned by the Action.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If this method is used before the Action executes, the Action's returned
|
||||
* result code will override what was set. However the Action could (if
|
||||
* specifically coded to do so) inspect the ActionInvocation to see that
|
||||
* someone "upstream" (e.g. an Interceptor) had suggested a value as the
|
||||
* result, and it could therefore return the same value itself.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If this method is called between the Action execution and the Result
|
||||
* execution, then the value set here will override the result code the
|
||||
* action had returned. Creating an Interceptor that implements
|
||||
* {@link PreResultListener} will give you this oportunity.
|
||||
* <p/>
|
||||
* {@link PreResultListener} will give you this opportunity.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If this method is called after the Result has been executed, it will
|
||||
* have the effect of raising an IllegalStateException.
|
||||
* </p>
|
||||
*
|
||||
* @param resultCode the result code.
|
||||
* @throws IllegalStateException if called after the Result has been executed.
|
||||
@@ -117,11 +125,15 @@ public interface ActionInvocation extends Serializable {
|
||||
/**
|
||||
* Register a {@link PreResultListener} to be notified after the Action is executed and
|
||||
* before the Result is executed.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* The ActionInvocation implementation must guarantee that listeners will be called in
|
||||
* the order in which they are registered.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Listener registration and execution does not need to be thread-safe.
|
||||
* </p>
|
||||
*
|
||||
* @param listener the listener to add.
|
||||
*/
|
||||
@@ -129,11 +141,13 @@ public interface ActionInvocation extends Serializable {
|
||||
|
||||
/**
|
||||
* Invokes the next step in processing this ActionInvocation.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* If there are more Interceptors, this will call the next one. If Interceptors choose not to short-circuit
|
||||
* ActionInvocation processing and return their own return code, they will call invoke() to allow the next Interceptor
|
||||
* to execute. If there are no more Interceptors to be applied, the Action is executed.
|
||||
* If the {@link ActionProxy#getExecuteResult()} method returns <tt>true</tt>, the Result is also executed.
|
||||
* </p>
|
||||
*
|
||||
* @throws Exception can be thrown.
|
||||
* @return the return code.
|
||||
@@ -142,9 +156,11 @@ public interface ActionInvocation extends Serializable {
|
||||
|
||||
/**
|
||||
* Invokes only the Action (not Interceptors or Results).
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* This is useful in rare situations where advanced usage with the interceptor/action/result workflow is
|
||||
* being manipulated for certain functionality.
|
||||
* </p>
|
||||
*
|
||||
* @return the return code.
|
||||
* @throws Exception can be thrown.
|
||||
|
||||
@@ -20,9 +20,11 @@ import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
|
||||
/**
|
||||
* ActionProxy is an extra layer between XWork and the action so that different proxies are possible.
|
||||
* <p/>
|
||||
* An example of this would be a remote proxy, where the layer between XWork and the action might be RMI or SOAP.
|
||||
*
|
||||
* <p>
|
||||
* An example of this would be a remote proxy, where the layer between XWork and the action might be RMI or SOAP.
|
||||
* </p>
|
||||
*
|
||||
* @author Jason Carreira
|
||||
*/
|
||||
public interface ActionProxy {
|
||||
|
||||
@@ -20,9 +20,11 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* The {@link ActionProxyFactory} is used to create {@link ActionProxy}s to be executed.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* It is the entry point to XWork that is used by a dispatcher to create an {@link ActionProxy} to execute
|
||||
* for a particular namespace and action name.
|
||||
* </p>
|
||||
*
|
||||
* @author Jason Carreira
|
||||
* @see DefaultActionProxyFactory
|
||||
@@ -32,8 +34,10 @@ public interface ActionProxyFactory {
|
||||
/**
|
||||
* Creates an {@link ActionProxy} for the given namespace and action name by looking up the configuration.The ActionProxy
|
||||
* should be fully initialized when it is returned, including having an {@link ActionInvocation} instance associated.
|
||||
* <p/>
|
||||
* <b>Note:</b> This is the most used create method.
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b> This is the most used create method.
|
||||
* </p>
|
||||
*
|
||||
* @param namespace the namespace of the action, can be <tt>null</tt>
|
||||
* @param actionName the name of the action
|
||||
|
||||
@@ -162,10 +162,14 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex
|
||||
|
||||
/**
|
||||
* A default implementation that does nothing an returns "success".
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Subclasses should override this method to provide their business logic.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* See also {@link com.opensymphony.xwork2.Action#execute()}.
|
||||
* </p>
|
||||
*
|
||||
* @return returns {@link #SUCCESS}
|
||||
* @throws Exception can be thrown by subclasses.
|
||||
@@ -246,13 +250,16 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex
|
||||
* <!-- START SNIPPET: pause-method -->
|
||||
* Stops the action invocation immediately (by throwing a PauseException) and causes the action invocation to return
|
||||
* the specified result, such as {@link #SUCCESS}, {@link #INPUT}, etc.
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* The next time this action is invoked (and using the same continuation ID), the method will resume immediately
|
||||
* after where this method was called, with the entire call stack in the execute method restored.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Note: this method can <b>only</b> be called within the {@link #execute()} method.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: pause-method -->
|
||||
*
|
||||
* @param result the result to return - the same type of return value in the {@link #execute()} method.
|
||||
|
||||
@@ -68,8 +68,11 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
|
||||
|
||||
/**
|
||||
* This constructor is private so the builder methods (create*) should be used to create an DefaultActionProxy.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* The reason for the builder methods is so that you can use a subclass to create your own DefaultActionProxy instance
|
||||
* </p>
|
||||
*
|
||||
* (like a RMIActionProxy).
|
||||
*/
|
||||
protected DefaultActionProxy(ActionInvocation inv, String namespace, String actionName, String methodName, boolean executeResult, boolean cleanupContext) {
|
||||
|
||||
@@ -20,11 +20,13 @@ import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Indicates that the implementing class can provide its own {@link Locale}.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* This is useful for when an action may wish override the default locale. All that is
|
||||
* needed is to implement this interface and return your own custom locale.
|
||||
* The {@link TextProvider} interface uses this interface heavily for retrieving
|
||||
* internationalized messages from resource bundles.
|
||||
* </p>
|
||||
*
|
||||
* @author Jason Carreira
|
||||
*/
|
||||
|
||||
@@ -36,10 +36,11 @@ import java.util.Map;
|
||||
/**
|
||||
* ObjectFactory is responsible for building the core framework objects. Users may register their
|
||||
* own implementation of the ObjectFactory to control instantiation of these Objects.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* This default implementation uses the {@link #buildBean(Class,java.util.Map) buildBean}
|
||||
* method to create all classes (interceptors, actions, results, etc).
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* @author Jason Carreira
|
||||
*/
|
||||
|
||||
@@ -20,8 +20,11 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* All results (except for <code>Action.NONE</code>) of an {@link Action} are mapped to a View implementation.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Examples of Views might be:
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>SwingPanelView - pops up a new Swing panel</li>
|
||||
* <li>ActionChainView - executes another action</li>
|
||||
|
||||
@@ -29,22 +29,29 @@ import java.util.ResourceBundle;
|
||||
* bundle associated with each superclass as well. It will stop once a bundle is
|
||||
* found that contains the given text. This gives a cascading style that allow
|
||||
* global texts to be defined for an application base class.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* You can override {@link LocaleProvider#getLocale()} to change the behaviour of how
|
||||
* to choose locale for the bundles that are returned. Typically you would
|
||||
* use the {@link LocaleProvider} interface to get the users configured locale.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* When you want to use your own implementation for Struts 2 project you have to define following
|
||||
* bean and constant in struts.xml:
|
||||
* <bean class="org.demo.MyTextProvider" name="myTextProvider" type="com.opensymphony.xwork2.TextProvider" />
|
||||
* <constant name="struts.xworkTextProvider" value="myTextProvider" />
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* if you want to also use your implementation for framework's messages define another constant (remember to put
|
||||
* into it all framework messages)
|
||||
* <constant name="system" value="myTextProvider" />
|
||||
* <p/>
|
||||
* Take a look on {@link com.opensymphony.xwork2.ActionSupport} for example TextProvider implemntation.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Take a look on {@link com.opensymphony.xwork2.ActionSupport} for example TextProvider implementation.
|
||||
* </p>
|
||||
* @author Jason Carreira
|
||||
* @author Rainer Hermanns
|
||||
* @see LocaleProvider
|
||||
|
||||
@@ -291,12 +291,14 @@ public class TextProviderSupport implements ResourceBundleTextProvider {
|
||||
|
||||
/**
|
||||
* Get the named bundle.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* You can override the getLocale() methodName to change the behaviour of how
|
||||
* to choose locale for the bundles that are returned. Typically you would
|
||||
* use the TextProvider interface to get the users configured locale, or use
|
||||
* your own methodName to allow the user to select the locale and store it in
|
||||
* the session (by using the SessionAware interface).
|
||||
* </p>
|
||||
*
|
||||
* @param aBundleName bundle name
|
||||
* @return a resource bundle
|
||||
|
||||
@@ -19,8 +19,10 @@ import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
|
||||
/**
|
||||
* Handles cases when the result or action is unknown.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* This allows other classes like Struts plugins to provide intelligent defaults easier.
|
||||
* </p>
|
||||
*/
|
||||
public interface UnknownHandler {
|
||||
|
||||
|
||||
@@ -121,8 +121,10 @@ public class ValidationAwareSupport implements ValidationAware, Serializable {
|
||||
|
||||
/**
|
||||
* Clears field errors map.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Will clear the map that contains field errors.
|
||||
* </p>
|
||||
*/
|
||||
public synchronized void clearFieldErrors() {
|
||||
internalGetFieldErrors().clear();
|
||||
@@ -130,8 +132,10 @@ public class ValidationAwareSupport implements ValidationAware, Serializable {
|
||||
|
||||
/**
|
||||
* Clears action errors list.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Will clear the list that contains action errors.
|
||||
* </p>
|
||||
*/
|
||||
public synchronized void clearActionErrors() {
|
||||
internalGetActionErrors().clear();
|
||||
@@ -139,8 +143,10 @@ public class ValidationAwareSupport implements ValidationAware, Serializable {
|
||||
|
||||
/**
|
||||
* Clears messages list.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Will clear the list that contains action messages.
|
||||
* </p>
|
||||
*/
|
||||
public synchronized void clearMessages() {
|
||||
internalGetActionMessages().clear();
|
||||
@@ -148,9 +154,11 @@ public class ValidationAwareSupport implements ValidationAware, Serializable {
|
||||
|
||||
/**
|
||||
* Clears all error list/maps.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Will clear the map and list that contain
|
||||
* field errors and action errors.
|
||||
* </p>
|
||||
*/
|
||||
public synchronized void clearErrors() {
|
||||
internalGetFieldErrors().clear();
|
||||
@@ -159,9 +167,11 @@ public class ValidationAwareSupport implements ValidationAware, Serializable {
|
||||
|
||||
/**
|
||||
* Clears all error and messages list/maps.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Will clear the maps/lists that contain
|
||||
* field errors, action errors and action messages.
|
||||
* </p>
|
||||
*/
|
||||
public synchronized void clearErrorsAndMessages() {
|
||||
internalGetFieldErrors().clear();
|
||||
|
||||
@@ -85,12 +85,15 @@ public class ConfigurationManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Get the current list of ConfigurationProviders. If no custom ConfigurationProviders have been added, this method
|
||||
* will return a list containing only the default ConfigurationProvider, XMLConfigurationProvider. if a custom
|
||||
* will return a list containing only the default ConfigurationProvider, XMLConfigurationProvider. If a custom
|
||||
* ConfigurationProvider has been added, then the XmlConfigurationProvider must be added by hand.
|
||||
* </p>
|
||||
* <p/>
|
||||
* TODO: the lazy instantiation of XmlConfigurationProvider should be refactored to be elsewhere. the behavior described above seems unintuitive.
|
||||
*
|
||||
* <p>
|
||||
* TODO: The lazy instantiation of XmlConfigurationProvider should be refactored to be elsewhere. The behavior described above seems unintuitive.
|
||||
* </p>
|
||||
*
|
||||
* @return the list of registered ConfigurationProvider objects
|
||||
* @see ConfigurationProvider
|
||||
|
||||
@@ -25,8 +25,10 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* Configuration for Interceptors.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* In the xml configuration file this is defined as the <code>interceptors</code> tag.
|
||||
* </p>
|
||||
*
|
||||
* @author Mike
|
||||
*/
|
||||
|
||||
+3
-1
@@ -27,8 +27,10 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* Configuration for InterceptorStack.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* In the xml configuration file this is defined as the <code>interceptor-stack</code> tag.
|
||||
* </p>
|
||||
*
|
||||
* @author Mike
|
||||
* @author Rainer Hermanns
|
||||
|
||||
@@ -26,8 +26,10 @@ import java.util.*;
|
||||
|
||||
/**
|
||||
* Configuration for Package.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* In the xml configuration file this is defined as the <code>package</code> tag.
|
||||
* </p>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Revision$
|
||||
@@ -257,10 +259,14 @@ public class PackageConfig extends Located implements Comparable, Serializable,
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Returns the default result type for this package.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If there is no default result type, but this package has parents - we will try to
|
||||
* look up the default result type of a parent.
|
||||
* </p>
|
||||
*/
|
||||
public String getFullDefaultResultType() {
|
||||
if ((defaultResultType == null) && !parents.isEmpty()) {
|
||||
|
||||
@@ -19,13 +19,15 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* Actions implementing Parameterizable will receive a map of the static parameters defined in the action
|
||||
* configuration.
|
||||
* <p/>
|
||||
* <p/> The {@link com.opensymphony.xwork2.interceptor.StaticParametersInterceptor} must be in the action's interceptor
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The {@link com.opensymphony.xwork2.interceptor.StaticParametersInterceptor} must be in the action's interceptor
|
||||
* queue for this to work.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
*
|
||||
* @author Jason Carreira
|
||||
|
||||
@@ -26,8 +26,10 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* Configuration for Result.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* In the xml configuration file this is defined as the <code>result</code> tag.
|
||||
* </p>
|
||||
*
|
||||
* @author Mike
|
||||
*/
|
||||
|
||||
@@ -26,8 +26,10 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* Configuration class for result types.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* In the xml configuration file this is defined as the <code>result-type</code> tag.
|
||||
* </p>
|
||||
*
|
||||
* @author Mike
|
||||
* @author Rainer Hermanns
|
||||
|
||||
+4
-1
@@ -599,9 +599,12 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This method builds a package context by looking for the parents of this new package.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <p>
|
||||
* If no parents are found, it will return a root package.
|
||||
* </p>
|
||||
*/
|
||||
protected PackageConfig.Builder buildPackageContext(Element packageElement) {
|
||||
String parent = packageElement.getAttribute("extends");
|
||||
|
||||
@@ -80,15 +80,20 @@ public class XmlHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This method will return the content of this particular <code>element</code>.
|
||||
* For example,
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* <result>something_1</result>
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* When the {@link org.w3c.dom.Element} <code><result></code> is passed in as
|
||||
* argument (<code>element</code> to this method, it returns the content of it,
|
||||
* namely, <code>something_1</code> in the example above.
|
||||
* </p>
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
package com.opensymphony.xwork2.inject;
|
||||
@@ -211,12 +215,15 @@ public final class ContainerBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Maps an implementation class to a given dependency type and name. Creates
|
||||
* instances using the container, recursively injecting dependencies.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>Sets scope to value from {@link Scoped} annotation on the
|
||||
* implementation class. Defaults to {@link Scope#PROTOTYPE} if no annotation
|
||||
* is found.
|
||||
* </p>
|
||||
*
|
||||
* @param type of dependency
|
||||
* @param name of dependency
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
package com.opensymphony.xwork2.inject;
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
package com.opensymphony.xwork2.inject;
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
package com.opensymphony.xwork2.inject;
|
||||
|
||||
@@ -64,17 +64,21 @@ public enum Scope {
|
||||
},
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* One instance per thread.
|
||||
* <p/>
|
||||
* <p><b>Note:</b> if a thread local object strongly references its {@link
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b> if a thread local object strongly references its {@link
|
||||
* Container}, neither the {@code Container} nor the object will be
|
||||
* eligible for garbage collection, i.e. memory leak.
|
||||
* </p>
|
||||
*/
|
||||
THREAD {
|
||||
@Override
|
||||
<T> InternalFactory<? extends T> scopeFactory(Class<T> type, String name, final InternalFactory<? extends T> factory) {
|
||||
return new InternalFactory<T>() {
|
||||
final ThreadLocal<T> threadLocal = new ThreadLocal<T>();
|
||||
final ThreadLocal<T> threadLocal = new ThreadLocal<>();
|
||||
|
||||
public T create(final InternalContext context) {
|
||||
T t = threadLocal.get();
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
package com.opensymphony.xwork2.inject.util;
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
/**
|
||||
* Copyright (C) 2006 Google Inc.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
package com.opensymphony.xwork2.inject.util;
|
||||
@@ -37,7 +41,7 @@ import static com.opensymphony.xwork2.inject.util.ReferenceType.STRONG;
|
||||
* after keys and values at any time can lead to some racy semantics. For
|
||||
* example, {@link #size()} returns an upper bound on the size, i.e. the actual
|
||||
* size may be smaller in cases where the key or value has been reclaimed but
|
||||
* the map entry has not been cleaned up yet.
|
||||
* the map entry has not been cleaned up yet.</p>
|
||||
*
|
||||
* <p>Another example: If {@link #get(Object)} cannot find an existing entry
|
||||
* for a key, it will try to create one. This operation is not atomic. One
|
||||
@@ -45,9 +49,9 @@ import static com.opensymphony.xwork2.inject.util.ReferenceType.STRONG;
|
||||
* thread running {@code get()} checks for an entry and decides to create one.
|
||||
* In this case, the newly created value will replace the put value in the
|
||||
* map. Also, two threads running {@code get()} concurrently can potentially
|
||||
* create duplicate values for a given key.
|
||||
* create duplicate values for a given key.</p>
|
||||
*
|
||||
* <p>In other words, this class is great for caching but not atomicity.
|
||||
* <p>In other words, this class is great for caching but not atomicity.</p>
|
||||
*
|
||||
* @author crazybob@google.com (Bob Lee)
|
||||
*/
|
||||
|
||||
@@ -36,16 +36,17 @@ import java.util.Map;
|
||||
* <!-- START SNIPPET: description -->
|
||||
*
|
||||
* The aim of this Interceptor is to alias a named parameter to a different named parameter. By acting as the glue
|
||||
* between actions sharing similiar parameters (but with different names), it can help greatly with action chaining.
|
||||
* between actions sharing similar parameters (but with different names), it can help greatly with action chaining.
|
||||
*
|
||||
* <p/> Action's alias expressions should be in the form of <code>#{ "name1" : "alias1", "name2" : "alias2" }</code>.
|
||||
* <p>Action's alias expressions should be in the form of <code>#{ "name1" : "alias1", "name2" : "alias2" }</code>.
|
||||
* This means that assuming an action (or something else in the stack) has a value for the expression named <i>name1</i> and the
|
||||
* action this interceptor is applied to has a setter named <i>alias1</i>, <i>alias1</i> will be set with the value from
|
||||
* <i>name1</i>.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Interceptor parameters:</u>
|
||||
* <p><u>Interceptor parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
*
|
||||
@@ -58,9 +59,7 @@ import java.util.Map;
|
||||
*
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Extending the interceptor:</u>
|
||||
*
|
||||
* <p/>
|
||||
* <p><u>Extending the interceptor:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: extending -->
|
||||
*
|
||||
@@ -68,7 +67,7 @@ import java.util.Map;
|
||||
*
|
||||
* <!-- END SNIPPET: extending -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -106,9 +105,13 @@ public class AliasInterceptor extends AbstractInterceptor {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Sets the name of the action parameter to look for the alias map.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Default is <code>aliases</code>.
|
||||
* </p>
|
||||
*
|
||||
* @param aliasesKey the name of the action parameter
|
||||
*/
|
||||
|
||||
@@ -31,21 +31,24 @@ import java.util.*;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* An interceptor that copies all the properties of every object in the value stack to the currently executing object,
|
||||
* except for any object that implements {@link Unchainable}. A collection of optional <i>includes</i> and
|
||||
* <i>excludes</i> may be provided to control how and which parameters are copied. Only includes or excludes may be
|
||||
* specified. Specifying both results in undefined behavior. See the javadocs for {@link ReflectionProvider#copy(Object, Object,
|
||||
* java.util.Map, java.util.Collection, java.util.Collection)} for more information.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b> It is important to remember that this interceptor does nothing if there are no objects already on the stack.
|
||||
* <br/>This means two things:
|
||||
* <br/><b>One</b>, you can safely apply it to all your actions without any worry of adverse affects.
|
||||
* <br/><b/>Two</b>, it is up to you to ensure an object exists in the stack prior to invoking this action. The most typical way this is done
|
||||
* is through the use of the <b>chain</b> result type, which combines with this interceptor to make up the action
|
||||
* chaining feature.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b> By default Errors, Field errors and Message aren't copied during chaining, to change the behaviour you can specify
|
||||
* the below three constants in struts.properties or struts.xml:
|
||||
* <ul>
|
||||
@@ -53,13 +56,16 @@ import java.util.*;
|
||||
* <li>struts.xwork.chaining.copyFieldErrors - set to true to copy Field Errors</li>
|
||||
* <li>struts.xwork.chaining.copyMessages - set to true to copy Action Messages</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <u>Example:</u>
|
||||
* <pre>
|
||||
* <constant name="struts.xwork.chaining.copyErrors" value="true"/>
|
||||
* </pre>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b> By default actionErrors and actionMessages are excluded when copping object's properties.
|
||||
* </p>
|
||||
* <!-- END SNIPPET: description -->
|
||||
@@ -77,22 +83,24 @@ import java.util.*;
|
||||
* </p>
|
||||
* <!-- END SNIPPET: extending -->
|
||||
* <u>Example code:</u>
|
||||
* <pre>
|
||||
*
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <p/>
|
||||
* <pre>
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="basicStack"/>
|
||||
* <result name="success" type="chain">otherAction</result>
|
||||
* </action>
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* <action name="otherAction" class="com.examples.OtherAction">
|
||||
* <interceptor-ref name="chain"/>
|
||||
* <interceptor-ref name="basicStack"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* </action>
|
||||
* <p/>
|
||||
* <!-- END SNIPPET: example -->
|
||||
* </pre>
|
||||
* <!-- END SNIPPET: example -->
|
||||
*
|
||||
*
|
||||
* @author mrdon
|
||||
* @author tm_jee ( tm_jee(at)yahoo.co.uk )
|
||||
|
||||
+6
-10
@@ -29,32 +29,28 @@ import java.util.Map;
|
||||
* <!-- START SNIPPET: description -->
|
||||
* ConversionErrorInterceptor adds conversion errors from the ActionContext to the Action's field errors.
|
||||
*
|
||||
* <p/>
|
||||
* <p>
|
||||
* This interceptor adds any error found in the {@link ActionContext}'s conversionErrors map as a field error (provided
|
||||
* that the action implements {@link ValidationAware}). In addition, any field that contains a validation error has its
|
||||
* original value saved such that any subsequent requests for that value return the original value rather than the value
|
||||
* in the action. This is important because if the value "abc" is submitted and can't be converted to an int, we want to
|
||||
* display the original string ("abc") again rather than the int value (likely 0, which would make very little sense to
|
||||
* the user).
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Interceptor parameters:</u>
|
||||
* <p><u>Interceptor parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
*
|
||||
* <ul>
|
||||
*
|
||||
* <li>None</li>
|
||||
*
|
||||
* <li>None</li>
|
||||
* </ul>
|
||||
*
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Extending the interceptor:</u>
|
||||
*
|
||||
* <p/>
|
||||
* <p> <u>Extending the interceptor:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: extending -->
|
||||
*
|
||||
@@ -65,7 +61,7 @@ import java.util.Map;
|
||||
*
|
||||
* <!-- END SNIPPET: extending -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p> <u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
+6
-4
@@ -26,22 +26,24 @@ import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* An interceptor that makes sure there are not validation errors before allowing the interceptor chain to continue.
|
||||
* <b>This interceptor does not perform any validation</b>.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <p>
|
||||
* This interceptor does nothing if the name of the method being invoked is specified in the <b>excludeMethods</b>
|
||||
* parameter. <b>excludeMethods</b> accepts a comma-delimited list of method names. For example, requests to
|
||||
* <b>foo!input.action</b> and <b>foo!back.action</b> will be skipped by this interceptor if you set the
|
||||
* <b>excludeMethods</b> parameter to "input, back".
|
||||
* <p/>
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>Note:</b> As this method extends off MethodFilterInterceptor, it is capable of
|
||||
* deciding if it is applicable only to selective methods in the action class. This is done by adding param tags
|
||||
* for the interceptor element, naming either a list of excluded method names and/or a list of included method
|
||||
* names, whereby includeMethods overrides excludedMethods. A single * sign is interpreted as wildcard matching
|
||||
* all methods for both parameters.
|
||||
* See {@link MethodFilterInterceptor} for more info.
|
||||
* <p/>
|
||||
* </p>
|
||||
* This interceptor also supports the following interfaces which can implemented by actions:
|
||||
* <ul>
|
||||
* <li>ValidationAware - implemented by ActionSupport class</li>
|
||||
|
||||
+14
-10
@@ -26,20 +26,23 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
*
|
||||
* <p>
|
||||
* This interceptor forms the core functionality of the exception handling feature. Exception handling allows you to map
|
||||
* an exception to a result code, just as if the action returned a result code instead of throwing an unexpected
|
||||
* exception. When an exception is encountered, it is wrapped with an {@link ExceptionHolder} and pushed on the stack,
|
||||
* providing easy access to the exception from within your result.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>Note:</b> While you can configure exception mapping in your configuration file at any point, the configuration
|
||||
* will not have any effect if this interceptor is not in the interceptor stack for your actions. It is recommended that
|
||||
* you make this interceptor the first interceptor on the stack, ensuring that it has full access to catch any
|
||||
* exception, even those caused by other interceptors.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Interceptor parameters:</u>
|
||||
* <p><u>Interceptor parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
*
|
||||
@@ -54,24 +57,24 @@ import java.util.Map;
|
||||
*
|
||||
* </ul>
|
||||
*
|
||||
* <p>
|
||||
* The parameters above enables us to log all thrown exceptions with stacktace in our own logfile,
|
||||
* and present a friendly webpage (with no stacktrace) to the end user.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Extending the interceptor:</u>
|
||||
*
|
||||
* <p/>
|
||||
* <p><u>Extending the interceptor:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: extending -->
|
||||
*
|
||||
* <p>
|
||||
* If you want to add custom handling for publishing the Exception, you may override
|
||||
* {@link #publishException(com.opensymphony.xwork2.ActionInvocation, ExceptionHolder)}. The default implementation
|
||||
* pushes the given ExceptionHolder on value stack. A custom implementation could add additional logging etc.
|
||||
*
|
||||
* </p>
|
||||
* <!-- END SNIPPET: extending -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -97,10 +100,11 @@ import java.util.Map;
|
||||
* <!-- END SNIPPET: example -->
|
||||
* </pre>
|
||||
*
|
||||
* <p/>
|
||||
* <p>
|
||||
* This second example will also log the exceptions using our own category
|
||||
* <code>com.mycompany.app.unhandled<code> at WARN level.
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example2 -->
|
||||
* <xwork>
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* An interceptor that handles setting the locale specified in a session as the locale for the current action request.
|
||||
* In addition, this interceptor will look for a specific HTTP request parameter and set the locale to whatever value is
|
||||
* provided. This means that this interceptor can be used to allow for your application to dynamically change the locale
|
||||
@@ -35,45 +35,38 @@ import java.util.Map;
|
||||
* be able to set his or her language preference at any point. The locale parameter is removed during the execution of
|
||||
* this interceptor, ensuring that properties aren't set on an action (such as request_locale) that have no typical
|
||||
* corresponding setter in your action.
|
||||
* <p/>
|
||||
* <p/>For example, using the default parameter name, a request to <b>foo.action?request_locale=en_US</b>, then the
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For example, using the default parameter name, a request to <b>foo.action?request_locale=en_US</b>, then the
|
||||
* locale for US English is saved in the user's session and will be used for all future requests.
|
||||
* <p/>
|
||||
if there is no locale set (for example with the first visit), the interceptor uses the browser locale.
|
||||
* <p/>
|
||||
* If there is no locale set (for example with the first visit), the interceptor uses the browser locale.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
* <p/>
|
||||
* <p/> <u>Interceptor parameters:</u>
|
||||
* <p/>
|
||||
* <p><u>Interceptor parameters:</u></p>
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <p/>
|
||||
*
|
||||
* <ul>
|
||||
* <p/>
|
||||
* <li>parameterName (optional) - the name of the HTTP request parameter that dictates the locale to switch to and save
|
||||
* in the session. By default this is <b>request_locale</b></li>
|
||||
* <p/>
|
||||
* <li>requestOnlyParameterName (optional) - the name of the HTTP request parameter that dictates the locale to switch to
|
||||
* for the current request only, without saving it in the session. By default this is <b>request_only_locale</b></li>
|
||||
* <p/>
|
||||
* <li>attributeName (optional) - the name of the session key to store the selected locale. By default this is
|
||||
* <b>WW_TRANS_I18N_LOCALE</b></li>
|
||||
* <p/>
|
||||
* </ul>
|
||||
* <p/>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
* <p/>
|
||||
* <p/> <u>Extending the interceptor:</u>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
* <p><u>Extending the interceptor:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: extending -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* There are no known extensions points for this interceptor.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: extending -->
|
||||
* <p/>
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p/>
|
||||
*
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
|
||||
@@ -22,124 +22,128 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: introduction -->
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* An interceptor is a stateless class that follows the interceptor pattern, as
|
||||
* found in {@link javax.servlet.Filter} and in AOP languages.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Interceptors are objects that dynamically intercept Action invocations.
|
||||
* They provide the developer with the opportunity to define code that can be executed
|
||||
* before and/or after the execution of an action. They also have the ability
|
||||
* to prevent an action from executing. Interceptors provide developers a way to
|
||||
* encapulate common functionality in a re-usable form that can be applied to
|
||||
* encapsulate common functionality in a re-usable form that can be applied to
|
||||
* one or more Actions.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Interceptors <b>must</b> be stateless and not assume that a new instance will be created for each request or Action.
|
||||
* Interceptors may choose to either short-circuit the {@link ActionInvocation} execution and return a return code
|
||||
* (such as {@link com.opensymphony.xwork2.Action#SUCCESS}), or it may choose to do some processing before
|
||||
* and/or after delegating the rest of the procesing using {@link ActionInvocation#invoke()}.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: introduction -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: parameterOverriding -->
|
||||
* <p/>
|
||||
* Interceptor's parameter could be overriden through the following ways :-
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p>
|
||||
* Interceptor's parameter could be overridden through the following ways :-
|
||||
* </p>
|
||||
|
||||
* <b>Method 1:</b>
|
||||
* <pre>
|
||||
* <action name="myAction" class="myActionClass">
|
||||
* <interceptor-ref name="exception"/>
|
||||
* <interceptor-ref name="alias"/>
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="servletConfig"/>
|
||||
* <interceptor-ref name="prepare"/>
|
||||
* <interceptor-ref name="i18n"/>
|
||||
* <interceptor-ref name="chain"/>
|
||||
* <interceptor-ref name="modelDriven"/>
|
||||
* <interceptor-ref name="fileUpload"/>
|
||||
* <interceptor-ref name="staticParams"/>
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="conversionError"/>
|
||||
* <interceptor-ref name="validation">
|
||||
* <param name="excludeMethods">myValidationExcudeMethod</param>
|
||||
* <action name="myAction" class="myActionClass">
|
||||
* <interceptor-ref name="exception"/>
|
||||
* <interceptor-ref name="alias"/>
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="servletConfig"/>
|
||||
* <interceptor-ref name="prepare"/>
|
||||
* <interceptor-ref name="i18n"/>
|
||||
* <interceptor-ref name="chain"/>
|
||||
* <interceptor-ref name="modelDriven"/>
|
||||
* <interceptor-ref name="fileUpload"/>
|
||||
* <interceptor-ref name="staticParams"/>
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="conversionError"/>
|
||||
* <interceptor-ref name="validation">
|
||||
* <param name="excludeMethods">myValidationExcudeMethod</param>
|
||||
* </interceptor-ref>
|
||||
* <interceptor-ref name="workflow">
|
||||
* <param name="excludeMethods">myWorkflowExcludeMethod</param>
|
||||
* <interceptor-ref name="workflow">
|
||||
* <param name="excludeMethods">myWorkflowExcludeMethod</param>
|
||||
* </interceptor-ref>
|
||||
* </action>
|
||||
* </pre>
|
||||
* <p/>
|
||||
*
|
||||
* <b>Method 2:</b>
|
||||
* <pre>
|
||||
* <action name="myAction" class="myActionClass">
|
||||
* <interceptor-ref name="defaultStack">
|
||||
* <param name="validation.excludeMethods">myValidationExcludeMethod</param>
|
||||
* <param name="workflow.excludeMethods">myWorkflowExcludeMethod</param>
|
||||
* <action name="myAction" class="myActionClass">
|
||||
* <interceptor-ref name="defaultStack">
|
||||
* <param name="validation.excludeMethods">myValidationExcludeMethod</param>
|
||||
* <param name="workflow.excludeMethods">myWorkflowExcludeMethod</param>
|
||||
* </interceptor-ref>
|
||||
* </action>
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* In the first method, the whole default stack is copied and the parameter then
|
||||
* changed accordingly.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* In the second method, the 'interceptor-ref' refer to an existing
|
||||
* interceptor-stack, namely defaultStack in this example, and override the validator
|
||||
* and workflow interceptor excludeMethods typically in this case. Note that in the
|
||||
* 'param' tag, the name attribute contains a dot (.) the word before the dot(.)
|
||||
* specifies the interceptor name whose parameter is to be overridden and the word after
|
||||
* the dot (.) specifies the parameter itself. Essetially it is as follows :-
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* <interceptor-name>.<parameter-name>
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p>
|
||||
* <b>Note</b> also that in this case the 'interceptor-ref' name attribute
|
||||
* is used to indicate an interceptor stack which makes sense as if it is referring
|
||||
* to the interceptor itself it would be just using Method 1 describe above.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: parameterOverriding -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* <b>Nested Interceptor param overriding</b>
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <!-- START SNIPPET: nestedParameterOverriding -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* Interceptor stack parameter overriding could be nested into as many level as possible, though it would
|
||||
* be advisable not to nest it too deep as to avoid confusion, For example,
|
||||
* </p>
|
||||
* <pre>
|
||||
* <interceptor name="interceptor1" class="foo.bar.Interceptor1" />
|
||||
* <interceptor name="interceptor2" class="foo.bar.Interceptor2" />
|
||||
* <interceptor name="interceptor3" class="foo.bar.Interceptor3" />
|
||||
* <interceptor name="interceptor4" class="foo.bar.Interceptor4" />
|
||||
* <interceptor-stack name="stack1">
|
||||
* <interceptor-ref name="interceptor1" />
|
||||
* <interceptor name="interceptor1" class="foo.bar.Interceptor1" />
|
||||
* <interceptor name="interceptor2" class="foo.bar.Interceptor2" />
|
||||
* <interceptor name="interceptor3" class="foo.bar.Interceptor3" />
|
||||
* <interceptor name="interceptor4" class="foo.bar.Interceptor4" />
|
||||
* <interceptor-stack name="stack1">
|
||||
* <interceptor-ref name="interceptor1" />
|
||||
* </interceptor-stack>
|
||||
* <interceptor-stack name="stack2">
|
||||
* <interceptor-ref name="intercetor2" />
|
||||
* <interceptor-ref name="stack1" />
|
||||
* <interceptor-stack name="stack2">
|
||||
* <interceptor-ref name="intercetor2" />
|
||||
* <interceptor-ref name="stack1" />
|
||||
* </interceptor-stack>
|
||||
* <interceptor-stack name="stack3">
|
||||
* <interceptor-ref name="interceptor3" />
|
||||
* <interceptor-ref name="stack2" />
|
||||
* <interceptor-stack name="stack3">
|
||||
* <interceptor-ref name="interceptor3" />
|
||||
* <interceptor-ref name="stack2" />
|
||||
* </interceptor-stack>
|
||||
* <interceptor-stack name="stack4">
|
||||
* <interceptor-ref name="interceptor4" />
|
||||
* <interceptor-ref name="stack3" />
|
||||
* <interceptor-stack name="stack4">
|
||||
* <interceptor-ref name="interceptor4" />
|
||||
* <interceptor-ref name="stack3" />
|
||||
* </interceptor-stack>
|
||||
* </pre>
|
||||
*
|
||||
* <p>
|
||||
* Assuming the interceptor has the following properties
|
||||
* <table border="1" width="100%">
|
||||
* </p>
|
||||
*
|
||||
* <table border="1" width="100%">
|
||||
* <tr>
|
||||
* <td>Interceptor</td>
|
||||
* <td>property</td>
|
||||
@@ -161,30 +165,33 @@ import java.io.Serializable;
|
||||
* <td>param4</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* We could override them as follows :-
|
||||
*
|
||||
* <p>
|
||||
* We could override them as follows :
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* <action ... >
|
||||
* <!-- to override parameters of interceptor located directly in the stack -->
|
||||
* <interceptor-ref name="stack4">
|
||||
* <param name="interceptor4.param4"> ... </param>
|
||||
* <interceptor-ref name="stack4">
|
||||
* <param name="interceptor4.param4"> ... </param>
|
||||
* </interceptor-ref>
|
||||
* </action>
|
||||
* <p/>
|
||||
*
|
||||
* <action ... >
|
||||
* <!-- to override parameters of interceptor located under nested stack -->
|
||||
* <interceptor-ref name="stack4">
|
||||
* <param name="stack3.interceptor3.param3"> ... </param>
|
||||
* <param name="stack3.stack2.interceptor2.param2"> ... </param>
|
||||
* <param name="stack3.stack2.stack1.interceptor1.param1"> ... </param>
|
||||
* <interceptor-ref name="stack4">
|
||||
* <param name="stack3.interceptor3.param3"> ... </param>
|
||||
* <param name="stack3.stack2.interceptor2.param2"> ... </param>
|
||||
* <param name="stack3.stack2.stack1.interceptor1.param1"> ... </param>
|
||||
* </interceptor-ref>
|
||||
* </action>
|
||||
* </pre>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- END SNIPPET: nestedParameterOverriding -->
|
||||
*
|
||||
* @author Jason Carreira
|
||||
* @author tmjee
|
||||
* @version $Date$ $Id$
|
||||
*/
|
||||
public interface Interceptor extends Serializable {
|
||||
|
||||
|
||||
@@ -22,10 +22,11 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* <p>
|
||||
* This interceptor logs the start and end of the execution an action (in English-only, not internationalized).
|
||||
* <br/>
|
||||
* <b>Note:</b>: This interceptor will log at <tt>INFO</tt> level.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
@@ -39,17 +40,17 @@ import org.apache.logging.log4j.Logger;
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <!-- prints out a message before and after the immediate action execution -->
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="completeStack"/>
|
||||
* <interceptor-ref name="logger"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="completeStack"/>
|
||||
* <interceptor-ref name="logger"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* </action>
|
||||
*
|
||||
* <!-- prints out a message before any more interceptors continue and after they have finished -->
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="logger"/>
|
||||
* <interceptor-ref name="completeStack"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="logger"/>
|
||||
* <interceptor-ref name="completeStack"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* </action>
|
||||
* <!-- END SNIPPET: example -->
|
||||
* </pre>
|
||||
|
||||
@@ -27,12 +27,13 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* MethodFilterInterceptor is an abstract <code>Interceptor</code> used as
|
||||
* a base class for interceptors that will filter execution based on method
|
||||
* names according to specified included/excluded method lists.
|
||||
*
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* Settable parameters are as follows:
|
||||
*
|
||||
@@ -41,13 +42,13 @@ import java.util.Set;
|
||||
* <li>includeMethods - method names to be included in interceptor processing</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p/>
|
||||
* <p>
|
||||
*
|
||||
* <b>NOTE:</b> If method name are available in both includeMethods and
|
||||
* excludeMethods, it will be considered as an included method:
|
||||
* includeMethods takes precedence over excludeMethods.
|
||||
*
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* Interceptors that extends this capability include:
|
||||
*
|
||||
|
||||
+11
-12
@@ -26,15 +26,16 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
*
|
||||
* Watches for {@link ModelDriven} actions and adds the action's model on to the value stack.
|
||||
*
|
||||
* <p/> <b>Note:</b> The ModelDrivenInterceptor must come before the both {@link StaticParametersInterceptor} and
|
||||
* <p> <b>Note:</b> The ModelDrivenInterceptor must come before the both {@link StaticParametersInterceptor} and
|
||||
* {@link ParametersInterceptor} if you want the parameters to be applied to the model.
|
||||
*
|
||||
* <p/> <b>Note:</b> The ModelDrivenInterceptor will only push the model into the stack when the
|
||||
* </p>
|
||||
* <p> <b>Note:</b> The ModelDrivenInterceptor will only push the model into the stack when the
|
||||
* model is not null, else it will be ignored.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Interceptor parameters:</u>
|
||||
* <p><u>Interceptor parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
*
|
||||
@@ -49,9 +50,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
*
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Extending the interceptor:</u>
|
||||
*
|
||||
* <p/>
|
||||
* <p><u>Extending the interceptor:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: extending -->
|
||||
*
|
||||
@@ -59,14 +58,14 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
*
|
||||
* <!-- END SNIPPET: extending -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="modelDriven"/>
|
||||
* <interceptor-ref name="basicStack"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="modelDriven"/>
|
||||
* <interceptor-ref name="basicStack"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* </action>
|
||||
* <!-- END SNIPPET: example -->
|
||||
* </pre>
|
||||
|
||||
@@ -17,14 +17,16 @@ package com.opensymphony.xwork2.interceptor;
|
||||
|
||||
|
||||
/**
|
||||
* Marker interface to incidate no auto setting of parameters.
|
||||
* <p/>
|
||||
* Marker interface to indicate no auto setting of parameters.
|
||||
*
|
||||
* <p>
|
||||
* This marker interface should be implemented by actions that do not want any
|
||||
* request parameters set on them automatically (by the ParametersInterceptor).
|
||||
* This may be useful if one is using the action tag and want to supply
|
||||
* the parameters to the action manually using the param tag.
|
||||
* It may also be useful if one for security reasons wants to make sure that
|
||||
* parameters cannot be set by malicious users.
|
||||
* </p>
|
||||
*
|
||||
* @author Dick Zetterberg (dick@transitor.se)
|
||||
*/
|
||||
|
||||
@@ -241,9 +241,10 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
|
||||
*
|
||||
* @param ac The action context
|
||||
* @param newParams The parameter map to apply
|
||||
* <p/>
|
||||
* <p>
|
||||
* In this class this is a no-op, since the parameters were fetched from the same location.
|
||||
* In subclasses both retrieveParameters() and addParametersToContext() should be overridden.
|
||||
* </p>
|
||||
*/
|
||||
protected void addParametersToContext(ActionContext ac, Map<String, Object> newParams) {
|
||||
}
|
||||
@@ -468,9 +469,10 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
|
||||
/**
|
||||
* Sets a comma-delimited list of regular expressions to match
|
||||
* parameters that are allowed in the parameter map (aka whitelist).
|
||||
* <p/>
|
||||
* <p>
|
||||
* Don't change the default unless you know what you are doing in terms
|
||||
* of security implications.
|
||||
* </p>
|
||||
*
|
||||
* @param commaDelim A comma-delimited list of regular expressions
|
||||
*/
|
||||
|
||||
+23
-15
@@ -23,16 +23,16 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A utility class for invoking prefixed methods in action class.
|
||||
*
|
||||
* Interceptors that made use of this class are:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>DefaultWorkflowInterceptor</li>
|
||||
* <li>PrepareInterceptor</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* *
|
||||
* <!-- START SNIPPET: javadocDefaultWorkflowInterceptor -->
|
||||
*
|
||||
* <b>In DefaultWorkflowInterceptor</b>
|
||||
@@ -70,37 +70,45 @@ public class PrefixMethodInvocationUtil {
|
||||
private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This method will prefix <code>actionInvocation</code>'s <code>ActionProxy</code>'s
|
||||
* <code>method</code> with <code>prefixes</code> before invoking the prefixed method.
|
||||
* Order of the <code>prefixes</code> is important, as this method will return once
|
||||
* a prefixed method is found in the action class.
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* For example, with
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* invokePrefixMethod(actionInvocation, new String[] { "prepare", "prepareDo" });
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Assuming <code>actionInvocation.getProxy(),getMethod()</code> returns "submit",
|
||||
* the order of invocation would be as follows:-
|
||||
* </p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>prepareSubmit()</li>
|
||||
* <li>prepareDoSubmit()</li>
|
||||
* </ol>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* If <code>prepareSubmit()</code> exists, it will be invoked and this method
|
||||
* will return, <code>prepareDoSubmit()</code> will NOT be invoked.
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* On the other hand, if <code>prepareDoSubmit()</code> does not exists, and
|
||||
* <code>prepareDoSubmit()</code> exists, it will be invoked.
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If none of those two methods exists, nothing will be invoked.
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @param actionInvocation the action invocation
|
||||
* @param prefixes prefixes for method names
|
||||
* @throws InvocationTargetException is thrown if invocation of a method failed.
|
||||
|
||||
@@ -31,7 +31,8 @@ import java.lang.reflect.InvocationTargetException;
|
||||
* {@link Preparable}. This interceptor is very useful for any situation where
|
||||
* you need to ensure some logic runs before the actual execute method runs.
|
||||
*
|
||||
* <p/> A typical use of this is to run some logic to load an object from the
|
||||
* <p>
|
||||
* A typical use of this is to run some logic to load an object from the
|
||||
* database so that when parameters are set they can be set on this object. For
|
||||
* example, suppose you have a User object with two properties: <i>id</i> and
|
||||
* <i>name</i>. Provided that the params interceptor is called twice (once
|
||||
@@ -39,21 +40,24 @@ import java.lang.reflect.InvocationTargetException;
|
||||
* the id property, and then when the second params interceptor is called the
|
||||
* parameter <i>user.name</i> will be set, as desired, on the actual object
|
||||
* loaded from the database. See the example for more info.
|
||||
*
|
||||
* <p/>
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>Note:</b> Since XWork 2.0.2, this interceptor extends {@link MethodFilterInterceptor}, therefore being
|
||||
* able to deal with excludeMethods / includeMethods parameters. See [Workflow Interceptor]
|
||||
* (class {@link DefaultWorkflowInterceptor}) for documentation and examples on how to use this feature.
|
||||
* </p>
|
||||
*
|
||||
* <p/><b>Update</b>: Added logic to execute a prepare{MethodName} and conditionally
|
||||
* <p>
|
||||
* <b>Update</b>: Added logic to execute a prepare{MethodName} and conditionally
|
||||
* the a general prepare() Method, depending on the 'alwaysInvokePrepare' parameter/property
|
||||
* which is by default true. This allows us to run some logic based on the method
|
||||
* name we specify in the {@link com.opensymphony.xwork2.ActionProxy}. For example, you can specify a
|
||||
* prepareInput() method that will be run before the invocation of the input method.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Interceptor parameters:</u>
|
||||
* <p><u>Interceptor parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
*
|
||||
@@ -66,9 +70,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
*
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Extending the interceptor:</u>
|
||||
*
|
||||
* <p/>
|
||||
* <p><u>Extending the interceptor:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: extending -->
|
||||
*
|
||||
@@ -76,7 +78,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
*
|
||||
* <!-- END SNIPPET: extending -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p> <u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -107,9 +109,10 @@ public class PrepareInterceptor extends MethodFilterInterceptor {
|
||||
private boolean firstCallPrepareDo = false;
|
||||
|
||||
/**
|
||||
* Sets if the <code>preapare</code> method should always be executed.
|
||||
* <p/>
|
||||
* Sets if the <code>prepare</code> method should always be executed.
|
||||
* <p>
|
||||
* Default is <tt>true</tt>.
|
||||
* </p>
|
||||
*
|
||||
* @param alwaysInvokePrepare if <code>prepare</code> should always be executed or not.
|
||||
*/
|
||||
@@ -119,9 +122,9 @@ public class PrepareInterceptor extends MethodFilterInterceptor {
|
||||
|
||||
/**
|
||||
* Sets if the <code>prepareDoXXX</code> method should be called first
|
||||
* <p/>
|
||||
* <p>
|
||||
* Default is <tt>false</tt> for backward compatibility
|
||||
*
|
||||
* </p>
|
||||
* @param firstCallPrepareDo if <code>prepareDoXXX</code> should be called first
|
||||
*/
|
||||
public void setFirstCallPrepareDo(String firstCallPrepareDo) {
|
||||
|
||||
+5
-7
@@ -30,12 +30,12 @@ import java.util.Map;
|
||||
*
|
||||
* An interceptor that enables scoped model-driven actions.
|
||||
*
|
||||
* <p/>This interceptor only activates on actions that implement the {@link ScopedModelDriven} interface. If
|
||||
* detected, it will retrieve the model class from the configured scope, then provide it to the Action.
|
||||
* <p>This interceptor only activates on actions that implement the {@link ScopedModelDriven} interface. If
|
||||
* detected, it will retrieve the model class from the configured scope, then provide it to the Action.</p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Interceptor parameters:</u>
|
||||
* <p><u>Interceptor parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
*
|
||||
@@ -51,9 +51,7 @@ import java.util.Map;
|
||||
*
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Extending the interceptor:</u>
|
||||
*
|
||||
* <p/>
|
||||
* <p><u>Extending the interceptor:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: extending -->
|
||||
*
|
||||
@@ -61,7 +59,7 @@ import java.util.Map;
|
||||
*
|
||||
* <!-- END SNIPPET: extending -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
+5
-5
@@ -39,11 +39,11 @@ import java.util.TreeMap;
|
||||
* implements {@link Parameterizable}, a map of the static parameters will be also be passed directly to the action.
|
||||
* The static params will be added to the request params map, unless "merge" is set to false.
|
||||
*
|
||||
* <p/> Parameters are typically defined with <param> elements within xwork.xml.
|
||||
* <p> Parameters are typically defined with <param> elements within xwork.xml.</p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Interceptor parameters:</u>
|
||||
* <p><u>Interceptor parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
*
|
||||
@@ -55,15 +55,15 @@ import java.util.TreeMap;
|
||||
*
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Extending the interceptor:</u>
|
||||
* <p><u>Extending the interceptor:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: extending -->
|
||||
*
|
||||
* <p/>There are no extension points to this interceptor.
|
||||
* <p>There are no extension points to this interceptor.</p>
|
||||
*
|
||||
* <!-- END SNIPPET: extending -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p> <u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
@@ -113,8 +113,6 @@ public interface ValidationAware {
|
||||
|
||||
/**
|
||||
* Checks whether there are any action errors or field errors.
|
||||
* <p/>
|
||||
* <b>Note</b>: that this does not have the same meaning as in WW 1.x.
|
||||
*
|
||||
* @return <code>(hasActionErrors() || hasFieldErrors())</code>
|
||||
*/
|
||||
|
||||
@@ -26,14 +26,14 @@ import java.lang.annotation.Target;
|
||||
* executed. Return value is ignored.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* The After annotation can be applied at method level.
|
||||
*
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -52,7 +52,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
+5
-2
@@ -17,13 +17,16 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* Annotation based version of {@link ParameterFilterInterceptor}.
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* This {@link Interceptor} must be placed in the stack before the {@link ParametersInterceptor}
|
||||
* When a parameter matches a field that is marked {@link Blocked} then it is removed from
|
||||
* the parameter map.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <p>
|
||||
* If an {@link Action} class is marked with {@link BlockByDefault} then all parameters are
|
||||
* removed unless a field on the Action exists and is marked with {@link Allowed}
|
||||
* </p>
|
||||
*
|
||||
* @author martin.gilday
|
||||
*/
|
||||
|
||||
+11
-12
@@ -30,50 +30,49 @@ import java.util.List;
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* <p>Invokes any annotated methods on the action. Specifically, it supports the following
|
||||
* annotations:
|
||||
* annotations:</p>
|
||||
* <ul>
|
||||
* <li> @{@link Before} - will be invoked before the action method. If the returned value is not null, it is
|
||||
* returned as the action result code</li>
|
||||
* <li> @{@link BeforeResult} - will be invoked after the action method but before the result execution</li>
|
||||
* <li> @{@link After} - will be invoked after the action method and result execution</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
* <p/>
|
||||
*
|
||||
* <p>There can be multiple methods marked with the same annotations, but the order of their execution
|
||||
* is not guaranteed. However, the annotated methods on the superclass chain are guaranteed to be invoked before the
|
||||
* annotated method in the current class in the case of a {@link Before} annotations and after, if the annotations is
|
||||
* {@link After}.</p>
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: javacode -->
|
||||
* public class BaseAnnotatedAction {
|
||||
* protected String log = "";
|
||||
* <p/>
|
||||
*
|
||||
* @Before
|
||||
* public String baseBefore() {
|
||||
* log = log + "baseBefore-";
|
||||
* return null;
|
||||
* }
|
||||
* }
|
||||
* <p/>
|
||||
*
|
||||
* public class AnnotatedAction extends BaseAnnotatedAction {
|
||||
* @Before
|
||||
* public String before() {
|
||||
* log = log + "before";
|
||||
* return null;
|
||||
* }
|
||||
* <p/>
|
||||
*
|
||||
* public String execute() {
|
||||
* log = log + "-execute";
|
||||
* return Action.SUCCESS;
|
||||
* }
|
||||
* <p/>
|
||||
*
|
||||
* @BeforeResult
|
||||
* public void beforeResult() throws Exception {
|
||||
* log = log +"-beforeResult";
|
||||
* }
|
||||
* <p/>
|
||||
*
|
||||
* @After
|
||||
* public void after() {
|
||||
* log = log + "-after";
|
||||
@@ -81,13 +80,13 @@ import java.util.List;
|
||||
* }
|
||||
* <!-- END SNIPPET: javacode -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <p>With the interceptor applied and the action executed on <code>AnnotatedAction</code> the log
|
||||
* instance variable will contain <code>baseBefore-before-execute-beforeResult-after</code>.</p>
|
||||
* <!-- END SNIPPET: example -->
|
||||
* <p/>
|
||||
* <p/>Configure a stack in xwork.xml that replaces the PrepareInterceptor with the AnnotationWorkflowInterceptor:
|
||||
*
|
||||
* <p>Configure a stack in xwork.xml that replaces the PrepareInterceptor with the AnnotationWorkflowInterceptor:</p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: stack -->
|
||||
* <interceptor-stack name="annotatedStack">
|
||||
|
||||
@@ -25,14 +25,14 @@ import java.lang.annotation.Target;
|
||||
* Marks a action method that needs to be executed before the main action method.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* The Before annotation can be applied at method level.
|
||||
*
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -51,7 +51,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p<u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
+3
-3
@@ -25,14 +25,14 @@ import java.lang.annotation.Target;
|
||||
* Marks a action method that needs to be executed before the result. Return value is ignored.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* The BeforeResult annotation can be applied at method level.
|
||||
*
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -51,7 +51,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
@@ -27,14 +27,14 @@ import com.opensymphony.xwork2.Action;
|
||||
* Marks a action method that if it's not validated by ValidationInterceptor then execute input method or input result.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* The InputConfig annotation can be applied at method level.
|
||||
*
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -59,7 +59,7 @@ import com.opensymphony.xwork2.Action;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
@@ -32,10 +32,14 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Simple implementation of the ObjectFactory that makes use of Spring's application context if one has been configured,
|
||||
* before falling back on the default mechanism of instantiating a new class using the class name. <p/> In order to use
|
||||
* this class in your application, you will need to instantiate a copy of this class and set it as XWork's ObjectFactory
|
||||
* before falling back on the default mechanism of instantiating a new class using the class name.
|
||||
* </p>
|
||||
* <p>
|
||||
* In order to use this class in your application, you will need to instantiate a copy of this class and set it as XWork's ObjectFactory
|
||||
* before the xwork.xml file is parsed. In a servlet environment, this could be done using a ServletContextListener.
|
||||
* </p>
|
||||
*
|
||||
* @author Simon Stewart (sms@lateral.net)
|
||||
*/
|
||||
|
||||
+9
-5
@@ -77,16 +77,20 @@ public class ActionAutowiringInterceptor extends AbstractInterceptor implements
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Looks for the <code>ApplicationContext</code> under the attribute that the Spring listener sets in
|
||||
* the servlet context. The configuration is done the first time here instead of in init() since the
|
||||
* <code>ActionContext</code> is not available during <code>Interceptor</code> initialization.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Autowires the action to Spring beans and places the <code>ApplicationContext</code>
|
||||
* on the <code>ActionContext</code>
|
||||
* <p/>
|
||||
* TODO Should this check to see if the <code>SpringObjectFactory</code> has already been configured
|
||||
* instead of instantiating a new one? Or is there a good reason for the interceptor to have it's own
|
||||
* factory?
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* TODO: Should this check to see if the <code>SpringObjectFactory</code> has already been configured instead of instantiating a new one? Or is there a good reason for the interceptor to have it's own factory?
|
||||
* </p>
|
||||
*
|
||||
* @param invocation
|
||||
* @throws Exception
|
||||
|
||||
@@ -24,10 +24,10 @@ import java.util.*;
|
||||
/**
|
||||
* This class is extremely useful for loading resources and classes in a fault tolerant manner
|
||||
* that works across different applications servers.
|
||||
* <p/>
|
||||
* <p>
|
||||
* It has come out of many months of frustrating use of multiple application servers at Atlassian,
|
||||
* please don't change things unless you're sure they're not going to break in one server or another!
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public class ClassLoaderUtil {
|
||||
|
||||
@@ -73,8 +73,10 @@ public class ClassLoaderUtil {
|
||||
|
||||
/**
|
||||
* Load a given resource.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This method will try to load the resource using the following methods (in order):
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>From {@link Thread#getContextClassLoader() Thread.currentThread().getContextClassLoader()}
|
||||
* <li>From {@link Class#getClassLoader() ClassLoaderUtil.class.getClassLoader()}
|
||||
@@ -125,14 +127,19 @@ public class ClassLoaderUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Load a class with a given name.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* It will try to load the class in the following order:
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>From {@link Thread#getContextClassLoader() Thread.currentThread().getContextClassLoader()}
|
||||
* <li>Using the basic {@link Class#forName(java.lang.String) }
|
||||
* <li>From {@link Class#getClassLoader() ClassLoaderUtil.class.getClassLoader()}
|
||||
* <li>From the {@link Class#getClassLoader() callingClass.getClassLoader() }
|
||||
* <li>From {@link Thread#getContextClassLoader() Thread.currentThread().getContextClassLoader()}
|
||||
* <li>Using the basic {@link Class#forName(java.lang.String) }
|
||||
* <li>From {@link Class#getClassLoader() ClassLoaderUtil.class.getClassLoader()}
|
||||
* <li>From the {@link Class#getClassLoader() callingClass.getClassLoader() }
|
||||
* </ul>
|
||||
*
|
||||
* @param className The name of the class to load
|
||||
|
||||
@@ -23,15 +23,15 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* <p/>Sets the CreateIfNull for type conversion.
|
||||
* <p>Sets the CreateIfNull for type conversion.</p>
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The CreateIfNull annotation must be applied at field or method level.
|
||||
* <p>The CreateIfNull annotation must be applied at field or method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table>
|
||||
@@ -54,7 +54,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* @CreateIfNull( value = true )
|
||||
@@ -63,7 +63,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.METHOD})
|
||||
|
||||
@@ -23,15 +23,15 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* <p/>Sets the Element for type conversion.
|
||||
* <p>Sets the Element for type conversion.</p>
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The Element annotation must be applied at field or method level.
|
||||
* <p>The Element annotation must be applied at field or method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table>
|
||||
@@ -54,7 +54,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* // The key property for User objects within the users collection is the <code>userName</code> attribute.
|
||||
@@ -67,7 +67,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.METHOD})
|
||||
|
||||
@@ -23,15 +23,15 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* <p/>Sets the Key for type conversion.
|
||||
* <p>Sets the Key for type conversion.</p>
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The Key annotation must be applied at field or method level.
|
||||
* <p>The Key annotation must be applied at field or method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table>
|
||||
@@ -54,7 +54,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* // The key property for User objects within the users collection is the <code>userName</code> attribute.
|
||||
@@ -64,7 +64,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.METHOD})
|
||||
|
||||
@@ -23,16 +23,16 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* <p/>Sets the KeyProperty for type conversion.
|
||||
* <p>Sets the KeyProperty for type conversion.</p>
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The KeyProperty annotation must be applied at field or method level.
|
||||
* <p/>This annotation should be used with Generic types, if the key property of the key element needs to be specified.
|
||||
* <p>The KeyProperty annotation must be applied at field or method level.</p>
|
||||
* <p>This annotation should be used with Generic types, if the key property of the key element needs to be specified.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table>
|
||||
@@ -55,7 +55,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* // The key property for User objects within the users collection is the <code>userName</code> attribute.
|
||||
|
||||
@@ -42,10 +42,10 @@ import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
/**
|
||||
* Provides support for localization in XWork.
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: searchorder -->
|
||||
* Resource bundles are searched in the following order:<p/>
|
||||
* <p/>
|
||||
* <p>Resource bundles are searched in the following order:</p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>ActionClass.properties</li>
|
||||
* <li>Interface.properties (every interface and sub-interface)</li>
|
||||
@@ -55,11 +55,11 @@ import java.util.concurrent.ConcurrentMap;
|
||||
* <li>search up the i18n message key hierarchy itself</li>
|
||||
* <li>global resource properties</li>
|
||||
* </ol>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- END SNIPPET: searchorder -->
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: packagenote -->
|
||||
* To clarify #5, while traversing the package hierarchy, Struts 2 will look for a file package.properties:<p/>
|
||||
* <p>To clarify #5, while traversing the package hierarchy, Struts 2 will look for a file package.properties:</p>
|
||||
* com/<br/>
|
||||
* acme/<br/>
|
||||
* package.properties<br/>
|
||||
@@ -67,22 +67,22 @@ import java.util.concurrent.ConcurrentMap;
|
||||
* package.properties<br/>
|
||||
* FooAction.java<br/>
|
||||
* FooAction.properties<br/>
|
||||
* <p/>
|
||||
* <p>
|
||||
* If FooAction.properties does not exist, com/acme/action/package.properties will be searched for, if
|
||||
* not found com/acme/package.properties, if not found com/package.properties, etc.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: packagenote -->
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: globalresource -->
|
||||
* A global resource bundle could be specified programatically, as well as the locale.
|
||||
* <p/>
|
||||
* <p>
|
||||
* A global resource bundle could be specified programmatically, as well as the locale.
|
||||
* </p>
|
||||
* <!-- END SNIPPET: globalresource -->
|
||||
*
|
||||
* @author Jason Carreira
|
||||
* @author Mark Woon
|
||||
* @author Rainer Hermanns
|
||||
* @author tm_jee
|
||||
* @version $Date$ $Id$
|
||||
*/
|
||||
public class LocalizedTextUtil {
|
||||
|
||||
@@ -132,8 +132,9 @@ public class LocalizedTextUtil {
|
||||
|
||||
/**
|
||||
* Add's the bundle to the internal list of default bundles.
|
||||
* <p/>
|
||||
* <p>
|
||||
* If the bundle already exists in the list it will be readded.
|
||||
* </p>
|
||||
*
|
||||
* @param resourceBundleName the name of the bundle to add.
|
||||
*/
|
||||
@@ -250,9 +251,10 @@ public class LocalizedTextUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the given resorce bundle by it's name.
|
||||
* <p/>
|
||||
* Finds the given resource bundle by it's name.
|
||||
* <p>
|
||||
* Will use <code>Thread.currentThread().getContextClassLoader()</code> as the classloader.
|
||||
* </p>
|
||||
*
|
||||
* @param aBundleName the name of the bundle (usually it's FQN classname).
|
||||
* @param locale the locale.
|
||||
@@ -328,10 +330,12 @@ public class LocalizedTextUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds a localized text message for the given key, aTextName. Both the key and the message
|
||||
* itself is evaluated as required. The following algorithm is used to find the requested
|
||||
* message:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>Look for message in aClass' class hierarchy.
|
||||
* <ol>
|
||||
@@ -350,19 +354,25 @@ public class LocalizedTextUtil {
|
||||
* <li>If still not found, look for the message in the default resource bundles.</li>
|
||||
* <li>Return defaultMessage</li>
|
||||
* </ol>
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* When looking for the message, if the key indexes a collection (e.g. user.phone[0]) and a
|
||||
* message for that specific key cannot be found, the general form will also be looked up
|
||||
* (i.e. user.phone[*]).
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If a message is found, it will also be interpolated. Anything within <code>${...}</code>
|
||||
* will be treated as an OGNL expression and evaluated as such.
|
||||
* </p>
|
||||
*
|
||||
* @param aClass the class whose name to use as the start point for the search
|
||||
* @param aTextName the key to find the text message for
|
||||
* @param locale the locale the message should be for
|
||||
* @param defaultMessage the message to be returned if no text message can be found in any
|
||||
* resource bundle
|
||||
* @param args arguments
|
||||
* resource bundle
|
||||
* @return the localized text, or null if none can be found and no defaultMessage is provided
|
||||
*/
|
||||
public static String findText(Class aClass, String aTextName, Locale locale, String defaultMessage, Object[] args) {
|
||||
@@ -372,10 +382,12 @@ public class LocalizedTextUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds a localized text message for the given key, aTextName. Both the key and the message
|
||||
* itself is evaluated as required. The following algorithm is used to find the requested
|
||||
* message:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>Look for message in aClass' class hierarchy.
|
||||
* <ol>
|
||||
@@ -394,21 +406,28 @@ public class LocalizedTextUtil {
|
||||
* <li>If still not found, look for the message in the default resource bundles.</li>
|
||||
* <li>Return defaultMessage</li>
|
||||
* </ol>
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* When looking for the message, if the key indexes a collection (e.g. user.phone[0]) and a
|
||||
* message for that specific key cannot be found, the general form will also be looked up
|
||||
* (i.e. user.phone[*]).
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If a message is found, it will also be interpolated. Anything within <code>${...}</code>
|
||||
* will be treated as an OGNL expression and evaluated as such.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If a message is <b>not</b> found a WARN log will be logged.
|
||||
* </p>
|
||||
*
|
||||
* @param aClass the class whose name to use as the start point for the search
|
||||
* @param aTextName the key to find the text message for
|
||||
* @param locale the locale the message should be for
|
||||
* @param defaultMessage the message to be returned if no text message can be found in any
|
||||
* resource bundle
|
||||
* @param args arguments
|
||||
* @param valueStack the value stack to use to evaluate expressions instead of the
|
||||
* one in the ActionContext ThreadLocal
|
||||
* @return the localized text, or null if none can be found and no defaultMessage is provided
|
||||
@@ -581,11 +600,15 @@ public class LocalizedTextUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds a localized text message for the given key, aTextName, in the specified resource bundle
|
||||
* with aTextName as the default message.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If a message is found, it will also be interpolated. Anything within <code>${...}</code>
|
||||
* will be treated as an OGNL expression and evaluated as such.
|
||||
* </p>
|
||||
*
|
||||
* @see #findText(java.util.ResourceBundle, String, java.util.Locale, String, Object[])
|
||||
*/
|
||||
@@ -594,13 +617,19 @@ public class LocalizedTextUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds a localized text message for the given key, aTextName, in the specified resource
|
||||
* bundle.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If a message is found, it will also be interpolated. Anything within <code>${...}</code>
|
||||
* will be treated as an OGNL expression and evaluated as such.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If a message is <b>not</b> found a WARN log will be logged.
|
||||
* </p>
|
||||
*
|
||||
* @param bundle the bundle
|
||||
* @param aTextName the key
|
||||
@@ -614,13 +643,19 @@ public class LocalizedTextUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds a localized text message for the given key, aTextName, in the specified resource
|
||||
* bundle.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If a message is found, it will also be interpolated. Anything within <code>${...}</code>
|
||||
* will be treated as an OGNL expression and evaluated as such.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If a message is <b>not</b> found a WARN log will be logged.
|
||||
* </p>
|
||||
*
|
||||
* @param bundle the bundle
|
||||
* @param aTextName the key
|
||||
|
||||
@@ -21,13 +21,17 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This class is used to read properties lines. These lines do
|
||||
* not terminate with new-line chars but rather when there is no
|
||||
* backslash sign a the end of the line. This is used to
|
||||
* concatenate multiple lines for readability.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* This class was pulled out of Jakarta Commons Configuration and
|
||||
* Jakarta Commons Lang trunk revision 476093
|
||||
* </p>
|
||||
*/
|
||||
public class PropertiesReader extends LineNumberReader {
|
||||
/**
|
||||
@@ -403,7 +407,7 @@ public class PropertiesReader extends LineNumberReader {
|
||||
|
||||
/**
|
||||
* <p>Checks if the object is in the given array.</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p>
|
||||
*
|
||||
* @param array the array to search through
|
||||
@@ -449,11 +453,11 @@ public class PropertiesReader extends LineNumberReader {
|
||||
/**
|
||||
* <p>Unescapes any Java literals found in the <code>String</code> to a
|
||||
* <code>Writer</code>.</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p>For example, it will turn a sequence of <code>'\'</code> and
|
||||
* <code>'n'</code> into a newline character, unless the <code>'\'</code>
|
||||
* is preceded by another <code>'\'</code>.</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p>A <code>null</code> string input has no effect.</p>
|
||||
*
|
||||
* @param out the <code>Writer</code> used to output unescaped characters
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TextParseUtil {
|
||||
* could be null, if it is it will just be skipped as if it is just calling
|
||||
* {@link #translateVariables(char, String, ValueStack)}.
|
||||
*
|
||||
* <p/>
|
||||
* <br>
|
||||
*
|
||||
* A typical use-case would be when we need to URL Encode the parsed value. To do so
|
||||
* we could just supply a URLEncodingEvaluator for example.
|
||||
@@ -266,24 +266,24 @@ public class TextParseUtil {
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A parsed value evaluator for {@link TextParseUtil}. It could be supplied by
|
||||
* calling {@link TextParseUtil#translateVariables(char, String, ValueStack, Class, ParsedValueEvaluator)}.
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* By supplying this <code>ParsedValueEvaluator</code>, the parsed value
|
||||
* (parsed against the value stack) value will be
|
||||
* given to <code>ParsedValueEvaluator</code> to be evaluated before the
|
||||
* translateVariable process goes on.
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* A typical use-case would be to have a custom <code>ParseValueEvaluator</code>
|
||||
* to URL Encode the parsed value.
|
||||
* </p>
|
||||
*
|
||||
* @author tm_jee
|
||||
*
|
||||
* @version $Date$ $Id$
|
||||
*/
|
||||
public static interface ParsedValueEvaluator {
|
||||
|
||||
|
||||
@@ -52,13 +52,17 @@ public class XWorkList extends ArrayList {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Inserts the specified element at the specified position in this list. Shifts the element
|
||||
* currently at that position (if any) and any subsequent elements to the right (adds one to
|
||||
* their indices).
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* This method is guaranteed to work since it will create empty beans to fill the gap between
|
||||
* the current list size and the requested index to enable the element to be set. This method
|
||||
* also performs any necessary type conversion.
|
||||
* </p>
|
||||
*
|
||||
* @param index index at which the specified element is to be inserted.
|
||||
* @param element element to be inserted.
|
||||
@@ -75,9 +79,13 @@ public class XWorkList extends ArrayList {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Appends the specified element to the end of this list.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* This method performs any necessary type conversion.
|
||||
* </p>
|
||||
*
|
||||
* @param element element to be appended to this list.
|
||||
* @return <tt>true</tt> (as per the general contract of Collection.add).
|
||||
@@ -90,13 +98,17 @@ public class XWorkList extends ArrayList {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Appends all of the elements in the specified Collection to the end of this list, in the order
|
||||
* that they are returned by the specified Collection's Iterator. The behavior of this
|
||||
* operation is undefined if the specified Collection is modified while the operation is in
|
||||
* progress. (This implies that the behavior of this call is undefined if the specified
|
||||
* Collection is this list, and this list is nonempty.)
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* This method performs any necessary type conversion.
|
||||
* </p>
|
||||
*
|
||||
* @param collection the elements to be inserted into this list.
|
||||
* @return <tt>true</tt> if this list changed as a result of the call.
|
||||
@@ -116,14 +128,18 @@ public class XWorkList extends ArrayList {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Inserts all of the elements in the specified Collection into this list, starting at the
|
||||
* specified position. Shifts the element currently at that position (if any) and any
|
||||
* subsequent elements to the right (increases their indices). The new elements will appear in
|
||||
* the list in the order that they are returned by the specified Collection's iterator.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* This method is guaranteed to work since it will create empty beans to fill the gap between
|
||||
* the current list size and the requested index to enable the element to be set. This method
|
||||
* also performs any necessary type conversion.
|
||||
* </p>
|
||||
*
|
||||
* @param index index at which to insert first element from the specified collection.
|
||||
* @param collection elements to be inserted into this list.
|
||||
@@ -153,10 +169,14 @@ public class XWorkList extends ArrayList {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Returns the element at the specified position in this list.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* An object is guaranteed to be returned since it will create empty beans to fill the gap
|
||||
* between the current list size and the requested index.
|
||||
* </p>
|
||||
*
|
||||
* @param index index of element to return.
|
||||
* @return the element at the specified position in this list.
|
||||
@@ -179,11 +199,15 @@ public class XWorkList extends ArrayList {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Replaces the element at the specified position in this list with the specified element.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* This method is guaranteed to work since it will create empty beans to fill the gap between
|
||||
* the current list size and the requested index to enable the element to be set. This method
|
||||
* also performs any necessary type conversion.
|
||||
* </p>
|
||||
*
|
||||
* @param index index of element to replace.
|
||||
* @param element element to be stored at the specified position.
|
||||
|
||||
+5
-1
@@ -33,12 +33,16 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The ReloadingClassLoader uses a delegation mechanism to allow
|
||||
* classes to be reloaded. That means that loadClass calls may
|
||||
* return different results if the class was changed in the underlying
|
||||
* ResourceStore.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* class taken from Apache JCI
|
||||
* </p>
|
||||
*/
|
||||
public class ReloadingClassLoader extends ClassLoader {
|
||||
private static final Logger LOG = LogManager.getLogger(ReloadingClassLoader.class);
|
||||
|
||||
@@ -25,15 +25,24 @@ public interface ClassFinder {
|
||||
boolean isAnnotationPresent(Class<? extends Annotation> annotation);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Returns a list of classes that could not be loaded in last invoked findAnnotated* method.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The list will only contain entries of classes whose byte code matched the requirements
|
||||
* of last invoked find* method, but were unable to be loaded and included in the results.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The list returned is unmodifiable. Once obtained, the returned list will be a live view of the
|
||||
* results from the last findAnnotated* method call.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* This method is not thread safe.
|
||||
* </p>
|
||||
*
|
||||
* @return an unmodifiable live view of classes that could not be loaded in previous findAnnotated* call.
|
||||
*/
|
||||
List<String> getClassesNotLoaded();
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.util.jar.JarFile;
|
||||
|
||||
/**
|
||||
* @author David Blevins
|
||||
* @version $Rev$ $Date$
|
||||
*/
|
||||
public class ResourceFinder {
|
||||
private static final Logger LOG = LogManager.getLogger(ResourceFinder.class);
|
||||
@@ -84,16 +83,22 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Returns a list of resources that could not be loaded in the last invoked findAvailable* or
|
||||
* mapAvailable* methods.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The list will only contain entries of resources that match the requirements
|
||||
* of the last invoked findAvailable* or mapAvailable* methods, but were unable to be
|
||||
* loaded and included in their results.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The list returned is unmodifiable and the results of this method will change
|
||||
* after each invocation of a findAvailable* or mapAvailable* methods.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* This method is not thread safe.
|
||||
*/
|
||||
public List<String> getResourcesNotLoaded() {
|
||||
@@ -200,24 +205,34 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Reads the contents of all non-directory URLs immediately under the specified
|
||||
* location and returns them in a map keyed by the file name.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any URLs that cannot be read will cause an exception to be thrown.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/serializables/one
|
||||
* META-INF/serializables/two
|
||||
* META-INF/serializables/three
|
||||
* META-INF/serializables/four/foo.txt
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* Map map = finder.mapAvailableStrings("serializables");
|
||||
* map.contains("one"); // true
|
||||
* map.contains("two"); // true
|
||||
* map.contains("three"); // true
|
||||
* map.contains("four"); // false
|
||||
* </pre>
|
||||
*
|
||||
* @param uri
|
||||
* @return a list of the content of each resource URL found
|
||||
@@ -236,25 +251,35 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Reads the contents of all non-directory URLs immediately under the specified
|
||||
* location and returns them in a map keyed by the file name.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Individual URLs that cannot be read are skipped and added to the
|
||||
* list of 'resourcesNotLoaded'
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/serializables/one
|
||||
* META-INF/serializables/two # not readable
|
||||
* META-INF/serializables/three
|
||||
* META-INF/serializables/four/foo.txt
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* Map map = finder.mapAvailableStrings("serializables");
|
||||
* map.contains("one"); // true
|
||||
* map.contains("two"); // false
|
||||
* map.contains("three"); // true
|
||||
* map.contains("four"); // false
|
||||
* </pre>
|
||||
*
|
||||
* @param uri
|
||||
* @return a list of the content of each resource URL found
|
||||
@@ -298,10 +323,14 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Executes findAllStrings assuming the strings are
|
||||
* the names of a classes that should be loaded and returned.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any URL or class that cannot be loaded will cause an exception to be thrown.
|
||||
* </p>
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
@@ -319,11 +348,15 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Executes findAvailableStrings assuming the strings are
|
||||
* the names of a classes that should be loaded and returned.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any class that cannot be loaded will be skipped and placed in the
|
||||
* 'resourcesNotLoaded' collection.
|
||||
* </p>
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
@@ -345,22 +378,30 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Executes mapAllStrings assuming the value of each entry in the
|
||||
* map is the name of a class that should be loaded.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any class that cannot be loaded will be cause an exception to be thrown.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
* <pre>
|
||||
* META-INF/xmlparsers/xerces
|
||||
* META-INF/xmlparsers/crimson
|
||||
* <p/>
|
||||
* </pre>
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* Map map = finder.mapAvailableStrings("xmlparsers");
|
||||
* map.contains("xerces"); // true
|
||||
* map.contains("crimson"); // true
|
||||
* Class xercesClass = map.get("xerces");
|
||||
* Class crimsonClass = map.get("crimson");
|
||||
* </pre>
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
@@ -380,23 +421,31 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Executes mapAvailableStrings assuming the value of each entry in the
|
||||
* map is the name of a class that should be loaded.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any class that cannot be loaded will be skipped and placed in the
|
||||
* 'resourcesNotLoaded' collection.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
* <pre>
|
||||
* META-INF/xmlparsers/xerces
|
||||
* META-INF/xmlparsers/crimson
|
||||
* <p/>
|
||||
* </pre>
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* Map map = finder.mapAvailableStrings("xmlparsers");
|
||||
* map.contains("xerces"); // true
|
||||
* map.contains("crimson"); // true
|
||||
* Class xercesClass = map.get("xerces");
|
||||
* Class crimsonClass = map.get("crimson");
|
||||
* </p>
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
@@ -426,20 +475,28 @@ public class ResourceFinder {
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Assumes the class specified points to a file in the classpath that contains
|
||||
* the name of a class that implements or is a subclass of the specfied class.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any class that cannot be loaded will be cause an exception to be thrown.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/java.io.InputStream # contains the classname org.acme.AcmeInputStream
|
||||
* META-INF/java.io.OutputStream
|
||||
* <p/>
|
||||
* </pre>
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* Class clazz = finder.findImplementation(java.io.InputStream.class);
|
||||
* clazz.getName(); // returns "org.acme.AcmeInputStream"
|
||||
*
|
||||
* </pre>
|
||||
* @param interfase a superclass or interface
|
||||
* @return
|
||||
* @throws IOException if the URL cannot be read
|
||||
@@ -456,23 +513,33 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Assumes the class specified points to a file in the classpath that contains
|
||||
* the name of a class that implements or is a subclass of the specfied class.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any class that cannot be loaded or assigned to the specified interface will be cause
|
||||
* an exception to be thrown.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/java.io.InputStream # contains the classname org.acme.AcmeInputStream
|
||||
* META-INF/java.io.InputStream # contains the classname org.widget.NeatoInputStream
|
||||
* META-INF/java.io.InputStream # contains the classname com.foo.BarInputStream
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* List classes = finder.findAllImplementations(java.io.InputStream.class);
|
||||
* classes.contains("org.acme.AcmeInputStream"); // true
|
||||
* classes.contains("org.widget.NeatoInputStream"); // true
|
||||
* classes.contains("com.foo.BarInputStream"); // true
|
||||
* </pre>
|
||||
*
|
||||
* @param interfase a superclass or interface
|
||||
* @return
|
||||
@@ -494,24 +561,33 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Assumes the class specified points to a file in the classpath that contains
|
||||
* the name of a class that implements or is a subclass of the specfied class.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any class that cannot be loaded or are not assignable to the specified class will be
|
||||
* skipped and placed in the 'resourcesNotLoaded' collection.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/java.io.InputStream # contains the classname org.acme.AcmeInputStream
|
||||
* META-INF/java.io.InputStream # contains the classname org.widget.NeatoInputStream
|
||||
* META-INF/java.io.InputStream # contains the classname com.foo.BarInputStream
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* List classes = finder.findAllImplementations(java.io.InputStream.class);
|
||||
* classes.contains("org.acme.AcmeInputStream"); // true
|
||||
* classes.contains("org.widget.NeatoInputStream"); // true
|
||||
* classes.contains("com.foo.BarInputStream"); // true
|
||||
*
|
||||
* </pre>
|
||||
* @param interfase a superclass or interface
|
||||
* @return
|
||||
* @throws IOException if classLoader.getResources throws an exception
|
||||
@@ -536,23 +612,33 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Assumes the class specified points to a directory in the classpath that holds files
|
||||
* containing the name of a class that implements or is a subclass of the specfied class.
|
||||
* <p/>
|
||||
* containing the name of a class that implements or is a subclass of the specified class.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any class that cannot be loaded or assigned to the specified interface will be cause
|
||||
* an exception to be thrown.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/java.net.URLStreamHandler/jar
|
||||
* META-INF/java.net.URLStreamHandler/file
|
||||
* META-INF/java.net.URLStreamHandler/http
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* Map map = finder.mapAllImplementations(java.net.URLStreamHandler.class);
|
||||
* Class jarUrlHandler = map.get("jar");
|
||||
* Class fileUrlHandler = map.get("file");
|
||||
* Class httpUrlHandler = map.get("http");
|
||||
* </pre>
|
||||
*
|
||||
* @param interfase a superclass or interface
|
||||
* @return
|
||||
@@ -576,23 +662,33 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Assumes the class specified points to a directory in the classpath that holds files
|
||||
* containing the name of a class that implements or is a subclass of the specfied class.
|
||||
* <p/>
|
||||
* containing the name of a class that implements or is a subclass of the specified class.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any class that cannot be loaded or are not assignable to the specified class will be
|
||||
* skipped and placed in the 'resourcesNotLoaded' collection.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/java.net.URLStreamHandler/jar
|
||||
* META-INF/java.net.URLStreamHandler/file
|
||||
* META-INF/java.net.URLStreamHandler/http
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* Map map = finder.mapAllImplementations(java.net.URLStreamHandler.class);
|
||||
* Class jarUrlHandler = map.get("jar");
|
||||
* Class fileUrlHandler = map.get("file");
|
||||
* Class httpUrlHandler = map.get("http");
|
||||
* </pre>
|
||||
*
|
||||
* @param interfase a superclass or interface
|
||||
* @return
|
||||
@@ -626,14 +722,22 @@ public class ResourceFinder {
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds the corresponding resource and reads it in as a properties file
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>>
|
||||
* META-INF/widget.properties
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* Properties widgetProps = finder.findProperties("widget.properties");
|
||||
* </pre>
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
@@ -651,18 +755,28 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds the corresponding resources and reads them in as a properties files
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any URL that cannot be read in as a properties file will cause an exception to be thrown.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/app.properties
|
||||
* META-INF/app.properties
|
||||
* META-INF/app.properties
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* List<Properties> appProps = finder.findAllProperties("app.properties");
|
||||
* </pre>
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
@@ -683,19 +797,29 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds the corresponding resources and reads them in as a properties files
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any URL that cannot be read in as a properties file will be added to the
|
||||
* 'resourcesNotLoaded' collection.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/app.properties
|
||||
* META-INF/app.properties
|
||||
* META-INF/app.properties
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* List<Properties> appProps = finder.findAvailableProperties("app.properties");
|
||||
* </pre>
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
@@ -721,21 +845,31 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds the corresponding resources and reads them in as a properties files
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any URL that cannot be read in as a properties file will cause an exception to be thrown.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/jdbcDrivers/oracle.properties
|
||||
* META-INF/jdbcDrivers/mysql.props
|
||||
* META-INF/jdbcDrivers/derby
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* List<Properties> driversList = finder.findAvailableProperties("jdbcDrivers");
|
||||
* Properties oracleProps = driversList.get("oracle.properties");
|
||||
* Properties mysqlProps = driversList.get("mysql.props");
|
||||
* Properties derbyProps = driversList.get("derby");
|
||||
* </pre>
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
@@ -754,22 +888,32 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Finds the corresponding resources and reads them in as a properties files
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Any URL that cannot be read in as a properties file will be added to the
|
||||
* 'resourcesNotLoaded' collection.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example classpath:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* META-INF/jdbcDrivers/oracle.properties
|
||||
* META-INF/jdbcDrivers/mysql.props
|
||||
* META-INF/jdbcDrivers/derby
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre>
|
||||
* ResourceFinder finder = new ResourceFinder("META-INF/");
|
||||
* List<Properties> driversList = finder.findAvailableProperties("jdbcDrivers");
|
||||
* Properties oracleProps = driversList.get("oracle.properties");
|
||||
* Properties mysqlProps = driversList.get("mysql.props");
|
||||
* Properties derbyProps = driversList.get("derby");
|
||||
* </p>
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
@@ -825,7 +969,7 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of subpckages from jars or dirs
|
||||
* Gets a list of subpackages from jars or dirs
|
||||
*/
|
||||
public Set<String> findPackages(String uri) throws IOException {
|
||||
String basePath = path + uri;
|
||||
@@ -854,7 +998,7 @@ public class ResourceFinder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of subpckages from jars or dirs
|
||||
* Gets a list of subpackages from jars or dirs
|
||||
*/
|
||||
public Map<URL, Set<String>> findPackagesMap(String uri) throws IOException {
|
||||
String basePath = path + uri;
|
||||
|
||||
@@ -37,10 +37,15 @@ import java.lang.reflect.Proxy;
|
||||
public class ObjectProfiler {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Given a class, and an interface that it implements, return a proxied version of the class that implements
|
||||
* the interface.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The usual use of this is to profile methods from Factory objects:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* public PersistenceManager getPersistenceManager()
|
||||
* {
|
||||
@@ -53,8 +58,10 @@ public class ObjectProfiler {
|
||||
* return ObjectProfiler.getProfiledObject(PersistenceManager.class, new DefaultPersistenceManager());
|
||||
* }
|
||||
* </pre>
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* A side effect of this is that you will no longer be able to downcast to DefaultPersistenceManager. This is probably a *good* thing.
|
||||
* </p>
|
||||
*
|
||||
* @param interfaceClazz The interface to implement.
|
||||
* @param o The object to proxy
|
||||
|
||||
@@ -31,81 +31,86 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* A timer stack.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p>A timer stack.</p>
|
||||
* <!-- START SNIPPET: profilingAspect_struts2 -->
|
||||
* <p/>
|
||||
* Struts2 profiling aspects involves the following :-
|
||||
* <p>
|
||||
* Struts2 profiling aspects involves the following:
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>ActionContextCleanUp</li>
|
||||
* <li>FreemarkerPageFilter</li>
|
||||
* <li>DispatcherFilter</li>
|
||||
* <ul>
|
||||
* <li>Dispatcher</li>
|
||||
* <ul>
|
||||
* <li>creation of DefaultActionProxy</li>
|
||||
* <ul>
|
||||
* <li>creation of DefaultActionInvocation</li>
|
||||
* <ul>
|
||||
* <li>creation of Action</li>
|
||||
* <li>ActionContextCleanUp</li>
|
||||
* <li>FreemarkerPageFilter</li>
|
||||
* <li>DispatcherFilter
|
||||
* <ul>
|
||||
* <li>Dispatcher
|
||||
* <ul>
|
||||
* <li>creation of DefaultActionProxy
|
||||
* <ul>
|
||||
* <li>creation of DefaultActionInvocation
|
||||
* <ul>
|
||||
* <li>creation of Action</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>execution of DefaultActionProxy
|
||||
* <ul>
|
||||
* <li>invocation of DefaultActionInvocation
|
||||
* <ul>
|
||||
* <li>invocation of Interceptors</li>
|
||||
* <li>invocation of Action</li>
|
||||
* <li>invocation of PreResultListener</li>
|
||||
* <li>invocation of Result</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* <li>execution of DefaultActionProxy</li>
|
||||
* <ul>
|
||||
* <li>invocation of DefaultActionInvocation</li>
|
||||
* <ul>
|
||||
* <li>invocation of Interceptors</li>
|
||||
* <li>invocation of Action</li>
|
||||
* <li>invocation of PreResultListener</li>
|
||||
* <li>invocation of Result</li>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- END SNIPPET: profilingAspect_struts2 -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: profilingAspect_xwork -->
|
||||
* <p/>
|
||||
* XWork2 profiling aspects involves the following :-
|
||||
* <p>
|
||||
* XWork2 profiling aspects involves the following:
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <ul>
|
||||
* <li>creation of DefaultActionProxy</li>
|
||||
* <ul>
|
||||
* <li>creation of DefaultActionInvocation</li>
|
||||
* <ul>
|
||||
* <li>creation of Action</li>
|
||||
* <li>creation of DefaultActionProxy
|
||||
* <ul>
|
||||
* <li>creation of DefaultActionInvocation</li>
|
||||
* <ul>
|
||||
* </li>
|
||||
* <li>creation of Action</li>
|
||||
* <li>execution of DefaultActionProxy</li>
|
||||
* <ul>
|
||||
* <li>invocation of DefaultActionInvocation
|
||||
* <ul>
|
||||
* <li>invocation of Interceptors</li>
|
||||
* <li>invocation of Action</li>
|
||||
* <li>invocation of PreResultListener</li>
|
||||
* <li>invocation of Result</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* <li>execution of DefaultActionProxy</li>
|
||||
* <ul>
|
||||
* <li>invocation of DefaultActionInvocation</li>
|
||||
* <ul>
|
||||
* <li>invocation of Interceptors</li>
|
||||
* <li>invocation of Action</li>
|
||||
* <li>invocation of PreResultListener</li>
|
||||
* <li>invocation of Result</li>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- END SNIPPET: profilingAspect_xwork -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: activationDescription -->
|
||||
* <p/>
|
||||
* Activating / Deactivating of the profiling feature could be done through:-
|
||||
* <p/>
|
||||
* <p>
|
||||
* Activating / Deactivating of the profiling feature could be done through:
|
||||
* </p>
|
||||
* <!-- END SNIPPET: activationDescription -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* System properties:- <p/>
|
||||
*
|
||||
*
|
||||
*
|
||||
* <p>System properties:</p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: activationThroughSystemProperty -->
|
||||
*
|
||||
@@ -113,16 +118,16 @@ import org.apache.logging.log4j.Logger;
|
||||
*
|
||||
* <!-- END SNIPPET: activationThroughSystemProperty -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: activationThroughSystemPropertyDescription -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* This could be done in the container startup script eg. CATALINA_OPTS in catalina.sh
|
||||
* (tomcat) or using "java -Dxwork.profile.activate=true -jar start.jar" (jetty)
|
||||
* <p/>
|
||||
* (tomcat) or using 'java -Dxwork.profile.activate=true -jar start.jar' (jetty)
|
||||
* </p>
|
||||
* <!-- END SNIPPET: activationThroughSystemPropertyDescription -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Code :- <p/>
|
||||
*
|
||||
*
|
||||
* <p>Code :</p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: activationThroughCode -->
|
||||
*
|
||||
@@ -130,27 +135,25 @@ import org.apache.logging.log4j.Logger;
|
||||
*
|
||||
* <!-- END SNIPPET: activationThroughCode -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <!-- START SNIPPET: activationThroughCodeDescription -->
|
||||
* <p/>
|
||||
* This could be done in a static block, in a Spring bean with lazy-init="false",
|
||||
* <p>
|
||||
* This could be done in a static block, in a Spring bean with lazy-init='false',
|
||||
* in a Servlet with init-on-startup as some numeric value, in a Filter or
|
||||
* Listener's init method etc.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: activationThroughCodeDescription -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Parameter:-
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* Parameter:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: activationThroughParameter -->
|
||||
*
|
||||
* <action ... >
|
||||
* ...
|
||||
* <interceptor-ref name="profiling">
|
||||
* <param name="profilingKey">profiling</param>
|
||||
* <interceptor-ref name="profiling">
|
||||
* <param name="profilingKey">profiling</param>
|
||||
* </interceptor-ref>
|
||||
* ...
|
||||
* </action>
|
||||
@@ -159,7 +162,7 @@ import org.apache.logging.log4j.Logger;
|
||||
*
|
||||
* <action .... >
|
||||
* ...
|
||||
* <interceptor-ref name="profiling" />
|
||||
* <interceptor-ref name="profiling" />
|
||||
* ...
|
||||
* </action>
|
||||
*
|
||||
@@ -169,44 +172,44 @@ import org.apache.logging.log4j.Logger;
|
||||
*
|
||||
* through code
|
||||
*
|
||||
* ActionContext.getContext().getParameters().put("profiling", "true);
|
||||
* ActionContext.getContext().getParameters().put("profiling", "true);
|
||||
*
|
||||
* <!-- END SNIPPET: activationThroughParameter -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: activationThroughParameterDescription -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* To use profiling activation through parameter, one will need to pass in through
|
||||
* the 'profiling' parameter (which is the default) and could be changed through
|
||||
* the param tag in the interceptor-ref.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: activationThroughParameterDescription -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
* Warning:<p/>
|
||||
*
|
||||
* <p>Warning:</p>
|
||||
*
|
||||
* <!-- START SNIPPET: activationThroughParameterWarning -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* Profiling activation through a parameter requires the following:
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>Profiling interceptor in interceptor stack</li>
|
||||
* <li>dev mode on (struts.devMode=true in struts.properties)
|
||||
* </ul>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- END SNIPPET: activationThroughParameterWarning -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: filteringDescription -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* One could filter out the profile logging by having a System property as follows. With this
|
||||
* 'xwork.profile.mintime' property, one could only log profile information when its execution time
|
||||
* exceed those specified in 'xwork.profile.mintime' system property. If no such property is specified,
|
||||
* it will be assumed to be 0, hence all profile information will be logged.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: filteringDescription -->
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: filteringCode -->
|
||||
*
|
||||
@@ -214,17 +217,17 @@ import org.apache.logging.log4j.Logger;
|
||||
*
|
||||
* <!-- END SNIPPET: filteringCode -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: methodDescription -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* One could extend the profiling feature provided by Struts2 in their web application as well.
|
||||
* <p/>
|
||||
* </p>
|
||||
* <!-- END SNIPPET: methodDescription -->
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: method1 -->
|
||||
*
|
||||
* String logMessage = "Log message";
|
||||
* String logMessage = "Log message";
|
||||
* UtilTimerStack.push(logMessage);
|
||||
* try {
|
||||
* // do some code
|
||||
@@ -235,34 +238,33 @@ import org.apache.logging.log4j.Logger;
|
||||
*
|
||||
* <!-- END SNIPPET: method1 -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p>
|
||||
* or
|
||||
* <p/>
|
||||
* </p>
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: method2 -->
|
||||
*
|
||||
* String result = UtilTimerStack.profile("purchaseItem: ",
|
||||
* String result = UtilTimerStack.profile("purchaseItem: ",
|
||||
* new UtilTimerStack.ProfilingBlock<String>() {
|
||||
* public String doProfiling() {
|
||||
* // do some code
|
||||
* return "Ok";
|
||||
* return "Ok";
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* <!-- END SNIPPET: method2 -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: profileLogFile -->
|
||||
* <p/>
|
||||
* <p>
|
||||
* Profiled result is logged using commons-logging under the logger named
|
||||
* 'com.opensymphony.xwork2.util.profiling.UtilTimerStack'. Depending on the underlying logging implementation
|
||||
* say if it is Log4j, one could direct the log to appear in a different file, being emailed to someone or have
|
||||
* it stored in the db.
|
||||
* <p/>
|
||||
* <!-- END SNIPPET: profileLogFile -->
|
||||
* </p>
|
||||
*
|
||||
* @version $Date$ $Id$
|
||||
* <!-- END SNIPPET: profileLogFile -->
|
||||
*/
|
||||
public class UtilTimerStack {
|
||||
|
||||
@@ -270,8 +272,8 @@ public class UtilTimerStack {
|
||||
protected static ThreadLocal<ProfilingTimerBean> current = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* System property that controls whether this timer should be used or not. Set to "true" activates
|
||||
* the timer. Set to "false" to disactivate.
|
||||
* System property that controls whether this timer should be used or not. Set to "true" activates
|
||||
* the timer. Set to "false" to deactivate.
|
||||
*/
|
||||
public static final String ACTIVATE_PROPERTY = "xwork.profile.activate";
|
||||
|
||||
@@ -400,13 +402,16 @@ public class UtilTimerStack {
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A convenience method that allows <code>block</code> of code subjected to profiling to be executed
|
||||
* and avoid the need of coding boiler code that does pushing (UtilTimeBean.push(...)) and
|
||||
* poping (UtilTimerBean.pop(...)) in a try ... finally ... block.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Example of usage:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* // we need a returning result
|
||||
* String result = UtilTimerStack.profile("purchaseItem: ",
|
||||
@@ -417,7 +422,9 @@ public class UtilTimerStack {
|
||||
* }
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* or
|
||||
*
|
||||
* <pre>
|
||||
* // we don't need a returning result
|
||||
* UtilTimerStack.profile("purchaseItem: ",
|
||||
|
||||
+6
-3
@@ -87,15 +87,18 @@ public class ReflectionContextState {
|
||||
context.put(XWorkConverter.LAST_BEAN_CLASS_ACCESSED, clazz);
|
||||
}
|
||||
/**
|
||||
* <p>
|
||||
* Gets the current property path but not completely.
|
||||
* It does not use the [ and ] used in some representations
|
||||
* of Maps and Lists. The reason for this is that the current
|
||||
* property path is only currently used for caching purposes
|
||||
* so there is no real reason to have an exact replica.
|
||||
*
|
||||
* <p/>So if the real path is myProp.myMap['myKey'] this would
|
||||
* </p>
|
||||
*
|
||||
* <p>So if the real path is myProp.myMap['myKey'] this would
|
||||
* return myProp.myMap.myKey.
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static String getCurrentPropertyPath(Map<String, Object> context) {
|
||||
|
||||
+8
-8
@@ -268,12 +268,12 @@ public class AnnotationActionValidatorManager implements ActionValidatorManager
|
||||
/**
|
||||
* <p>This method 'collects' all the validator configurations for a given
|
||||
* action invocation.</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p>It will traverse up the class hierarchy looking for validators for every super class
|
||||
* and directly implemented interface of the current action, as well as adding validators for
|
||||
* any alias of this invocation. Nifty!</p>
|
||||
* <p/>
|
||||
* <p>Given the following class structure:
|
||||
*
|
||||
* <p>Given the following class structure:</p>
|
||||
* <pre>
|
||||
* interface Thing;
|
||||
* interface Animal extends Thing;
|
||||
@@ -281,9 +281,9 @@ public class AnnotationActionValidatorManager implements ActionValidatorManager
|
||||
* class AnimalImpl implements Animal;
|
||||
* class QuadrapedImpl extends AnimalImpl implements Quadraped;
|
||||
* class Dog extends QuadrapedImpl;
|
||||
* </pre></p>
|
||||
* <p/>
|
||||
* <p>This method will look for the following config files for Dog:
|
||||
* </pre>
|
||||
*
|
||||
* <p>This method will look for the following config files for Dog:</p>
|
||||
* <pre>
|
||||
* Animal
|
||||
* Animal-context
|
||||
@@ -295,8 +295,8 @@ public class AnnotationActionValidatorManager implements ActionValidatorManager
|
||||
* QuadrapedImpl-context
|
||||
* Dog
|
||||
* Dog-context
|
||||
* </pre></p>
|
||||
* <p/>
|
||||
* </pre>
|
||||
*
|
||||
* <p>Note that the validation rules for Thing is never looked for because no class in the
|
||||
* hierarchy directly implements Thing.</p>
|
||||
*
|
||||
|
||||
+11
-7
@@ -32,12 +32,16 @@ import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This is the entry point into XWork's rule-based validation framework.
|
||||
* <p/>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Validation rules are specified in XML configuration files named <code>className-contextName-validation.xml</code> where
|
||||
* className is the name of the class the configuration is for and -contextName is optional
|
||||
* (contextName is an arbitrary key that is used to look up additional validation rules for a
|
||||
* specific context).
|
||||
* </p>
|
||||
*
|
||||
* @author Jason Carreira
|
||||
* @author Mark Woon
|
||||
@@ -127,10 +131,10 @@ public class DefaultActionValidatorManager implements ActionValidatorManager {
|
||||
Set<String> shortcircuitedFields = null;
|
||||
|
||||
for (final Validator validator : validators) {
|
||||
try {
|
||||
try {
|
||||
validator.setValidatorContext(validatorContext);
|
||||
|
||||
LOG.debug("Running validator: {} for object {} and method {}", validator, object, method);
|
||||
LOG.debug("Running validator: {} for object {} and method {}", validator, object, method);
|
||||
|
||||
FieldValidator fValidator = null;
|
||||
String fullFieldName = null;
|
||||
@@ -234,7 +238,7 @@ public class DefaultActionValidatorManager implements ActionValidatorManager {
|
||||
* and directly implemented interface of the current action, as well as adding validators for
|
||||
* any alias of this invocation. Nifty!</p>
|
||||
*
|
||||
* <p>Given the following class structure:
|
||||
* <p>Given the following class structure:</p>
|
||||
* <pre>
|
||||
* interface Thing;
|
||||
* interface Animal extends Thing;
|
||||
@@ -242,9 +246,9 @@ public class DefaultActionValidatorManager implements ActionValidatorManager {
|
||||
* class AnimalImpl implements Animal;
|
||||
* class QuadrapedImpl extends AnimalImpl implements Quadraped;
|
||||
* class Dog extends QuadrapedImpl;
|
||||
* </pre></p>
|
||||
* </pre>
|
||||
*
|
||||
* <p>This method will look for the following config files for Dog:
|
||||
* <p>This method will look for the following config files for Dog:</p>
|
||||
* <pre>
|
||||
* Animal
|
||||
* Animal-context
|
||||
@@ -256,7 +260,7 @@ public class DefaultActionValidatorManager implements ActionValidatorManager {
|
||||
* QuadrapedImpl-context
|
||||
* Dog
|
||||
* Dog-context
|
||||
* </pre></p>
|
||||
* </pre>
|
||||
*
|
||||
* <p>Note that the validation rules for Thing is never looked for because no class in the
|
||||
* hierarchy directly implements Thing.</p>
|
||||
|
||||
@@ -28,31 +28,35 @@ import org.apache.logging.log4j.Logger;
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
*
|
||||
* <p>
|
||||
* This interceptor runs the action through the standard validation framework, which in turn checks the action against
|
||||
* any validation rules (found in files such as <i>ActionClass-validation.xml</i>) and adds field-level and action-level
|
||||
* error messages (provided that the action implements {@link ValidationAware}). This interceptor
|
||||
* is often one of the last (or second to last) interceptors applied in a stack, as it assumes that all values have
|
||||
* already been set on the action.
|
||||
* </p>
|
||||
*
|
||||
* <p/>This interceptor does nothing if the name of the method being invoked is specified in the <b>excludeMethods</b>
|
||||
* <p>
|
||||
* This interceptor does nothing if the name of the method being invoked is specified in the <b>excludeMethods</b>
|
||||
* parameter. <b>excludeMethods</b> accepts a comma-delimited list of method names. For example, requests to
|
||||
* <b>foo!input.action</b> and <b>foo!back.action</b> will be skipped by this interceptor if you set the
|
||||
* <b>excludeMethods</b> parameter to "input, back".
|
||||
*
|
||||
* </ol>
|
||||
*
|
||||
* <p/> The workflow of the action request does not change due to this interceptor. Rather,
|
||||
* this interceptor is often used in conjuction with the <b>workflow</b> interceptor.
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* The workflow of the action request does not change due to this interceptor. Rather,
|
||||
* this interceptor is often used in conjunction with the <b>workflow</b> interceptor.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <b>NOTE:</b> As this method extends off MethodFilterInterceptor, it is capable of
|
||||
* deciding if it is applicable only to selective methods in the action class. See
|
||||
* <code>MethodFilterInterceptor</code> for more info.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Interceptor parameters:</u>
|
||||
* <p><u>Interceptor parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
*
|
||||
@@ -71,9 +75,7 @@ import org.apache.logging.log4j.Logger;
|
||||
*
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Extending the interceptor:</u>
|
||||
*
|
||||
* <p/>
|
||||
* <p><u>Extending the interceptor:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: extending -->
|
||||
*
|
||||
@@ -81,38 +83,38 @@ import org.apache.logging.log4j.Logger;
|
||||
*
|
||||
* <!-- END SNIPPET: extending -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
*
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="validation"/>
|
||||
* <interceptor-ref name="workflow"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="validation"/>
|
||||
* <interceptor-ref name="workflow"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* </action>
|
||||
*
|
||||
* <-- in the following case myMethod of the action class will not
|
||||
* get validated -->
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="validation">
|
||||
* <param name="excludeMethods">myMethod</param>
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="validation">
|
||||
* <param name="excludeMethods">myMethod</param>
|
||||
* </interceptor-ref>
|
||||
* <interceptor-ref name="workflow"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* <interceptor-ref name="workflow"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* </action>
|
||||
*
|
||||
* <-- in the following case only annotated methods of the action class will
|
||||
* be validated -->
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="validation">
|
||||
* <param name="validateAnnotatedMethodOnly">true</param>
|
||||
* <action name="someAction" class="com.examples.SomeAction">
|
||||
* <interceptor-ref name="params"/>
|
||||
* <interceptor-ref name="validation">
|
||||
* <param name="validateAnnotatedMethodOnly">true</param>
|
||||
* </interceptor-ref>
|
||||
* <interceptor-ref name="workflow"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* <interceptor-ref name="workflow"/>
|
||||
* <result name="success">good_result.ftl</result>
|
||||
* </action>
|
||||
*
|
||||
*
|
||||
|
||||
@@ -22,43 +22,41 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <!-- START SNIPPET: validatorFlavours -->
|
||||
* <p>The validators supplied by the XWork distribution (and any validators you
|
||||
* might write yourself) come in two different flavors:</p>
|
||||
* <p/>
|
||||
*
|
||||
* <ol>
|
||||
* <li> Plain Validators / Non-Field validators </li>
|
||||
* <li> FieldValidators </li>
|
||||
* </ol>
|
||||
* <p/>
|
||||
*
|
||||
* <p>Plain Validators (such as the ExpressionValidator) perform validation checks
|
||||
* that are not inherently tied to a single specified field. When you declare a
|
||||
* plain Validator in your -validation.xml file you do not associate a fieldname
|
||||
* attribute with it. (You should avoid using plain Validators within the
|
||||
* <field-validator> syntax described below.)</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p>FieldValidators (such as the EmailValidator) are designed to perform
|
||||
* validation checks on a single field. They require that you specify a fieldname
|
||||
* attribute in your -validation.xml file. There are two different (but equivalent)
|
||||
* XML syntaxes you can use to declare FieldValidators (see "<validator> vs.
|
||||
* <field-Validator> syntax" below).</p>
|
||||
* <p/>
|
||||
* <field-Validator> syntax" below).</p>
|
||||
*
|
||||
* <p>There are two places where the differences between the two validator flavors
|
||||
* are important to keep in mind:</p>
|
||||
* <p/>
|
||||
*
|
||||
* <ol>
|
||||
* <li> when choosing the xml syntax used for declaring a validator
|
||||
* (either <validator> or <field-validator>)</li>
|
||||
* <li> when using the short-circuit capability</li>
|
||||
* </ol>
|
||||
* <p/>
|
||||
* <p><b>NOTE:</b>Note that you do not declare what "flavor" of validator you are
|
||||
*
|
||||
* <p><b>NOTE:</b>Note that you do not declare what "flavor" of validator you are
|
||||
* using in your -validation.xml file, you just declare the name of the validator
|
||||
* to use and Struts will know whether it's a "plain Validator" or a "FieldValidator"
|
||||
* to use and Struts will know whether it's a "plain Validator" or a "FieldValidator"
|
||||
* by looking at the validation class that the validator's programmer chose
|
||||
* to implement.</p>
|
||||
* <!-- END SNIPPET: validatorFlavours -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: validationRules -->
|
||||
* <p>To define validation rules for an Action, create a file named ActionName-validation.xml
|
||||
* in the same package as the Action. You may also create alias-specific validation rules which
|
||||
@@ -66,12 +64,12 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* another file in the same directory named ActionName-aliasName-validation.xml. In both
|
||||
* cases, ActionName is the name of the Action class, and aliasName is the name of the
|
||||
* Action alias defined in the xwork.xml configuration for the Action.</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p>The framework will also search up the inheritance tree of the Action to
|
||||
* find validation rules for directly implemented interfaces and parent classes of the Action.
|
||||
* This is particularly powerful when combined with ModelDriven Actions and the VisitorFieldValidator.
|
||||
* Here's an example of how validation rules are discovered. Given the following class structure:</p>
|
||||
* <p/>
|
||||
*
|
||||
* <ul>
|
||||
* <li>interface Animal;</li>
|
||||
* <li>interface Quadraped extends Animal;</li>
|
||||
@@ -79,9 +77,9 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <li>class QuadrapedImpl extends AnimalImpl implements Quadraped;</li>
|
||||
* <li>class Dog extends QuadrapedImpl;</li>
|
||||
* </ul>
|
||||
* <p/>
|
||||
*
|
||||
* <p>The framework method will look for the following config files if Dog is to be validated:</p>
|
||||
* <p/>
|
||||
*
|
||||
* <ul>
|
||||
* <li>Animal</li>
|
||||
* <li>Animal-aliasname</li>
|
||||
@@ -94,20 +92,20 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <li>Dog</li>
|
||||
* <li>Dog-aliasname</li>
|
||||
* </ul>
|
||||
* <p/>
|
||||
*
|
||||
* <p>While this process is similar to what the XW:Localization framework does
|
||||
* when finding messages, there are some subtle differences. The most important
|
||||
* difference is that validation rules are discovered from the parent downwards.
|
||||
* </p>
|
||||
* <p/>
|
||||
*
|
||||
* <p><b>NOTE:</b>Child's *-validation.xml will add on to parent's *-validation.xml
|
||||
* according to the class hierarchy defined above. With this feature, one could have
|
||||
* more generic validation rule at the parent and more specific validation rule at
|
||||
* the child.</p>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- END SNIPPET: validationRules -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: validatorVsFieldValidators1 -->
|
||||
* <p>There are two ways you can define validators in your -validation.xml file:</p>
|
||||
* <ol>
|
||||
@@ -115,35 +113,34 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <li> <field-validator> </li>
|
||||
* </ol>
|
||||
* <p>Keep the following in mind when using either syntax:</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p><b>Non-Field-Validator</b>
|
||||
* The <validator> element allows you to declare both types of validators
|
||||
* (either a plain Validator a field-specific FieldValidator).</p>
|
||||
* <!-- END SNIPPET: validatorVsFieldValidators1 -->
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: nonFieldValidatorUsingValidatorSyntax -->
|
||||
* <!-- Declaring a plain Validator using the <validator> syntax: -->
|
||||
* <p/>
|
||||
* <validator type="expression>
|
||||
* <param name="expression">foo gt bar</param>
|
||||
*
|
||||
* <validator type="expression>
|
||||
* <param name="expression">foo gt bar</param>
|
||||
* <message>foo must be great than bar.</message>
|
||||
* </validator>
|
||||
* <!-- END SNIPPET: nonFieldValidatorUsingValidatorSyntax -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: fieldValidatorUsingValidatorSyntax -->
|
||||
* <!-- Declaring a field validator using the <validator> syntax; -->
|
||||
* <p/>
|
||||
* <validator type="required">
|
||||
* <param name="fieldName">bar</param>
|
||||
*
|
||||
* <validator type="required">
|
||||
* <param name="fieldName">bar</param>
|
||||
* <message>You must enter a value for bar.</message>
|
||||
* </validator>
|
||||
* <!-- END SNIPPET: fieldValidatorUsingValidatorSyntax -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: validatorVsFieldValidators2 -->
|
||||
* <p><b>field-validator</b>
|
||||
* The <field-validator> elements are basically the same as the <validator> elements
|
||||
@@ -153,110 +150,110 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* attribute. The reason for this structure is to conveniently group the validators
|
||||
* for a particular field under one element, otherwise the fieldName attribute
|
||||
* would have to be repeated, over and over, for each individual <validator>.</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p><b>HINT:</b>
|
||||
* It is always better to defined field-validator inside a <field> tag instead of
|
||||
* using a <validator> tag and supplying fieldName as its param as the xml code itself
|
||||
* is clearer (grouping of field is clearer)</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p><b>NOTE:</b>
|
||||
* Note that you should only use FieldValidators (not plain Validators) within a
|
||||
* <field-validator> block. A plain Validator inside a <field> will not be
|
||||
* allowed and would generate error when parsing the xml, as it is not allowed in
|
||||
* the defined dtd (xwork-validator-1.0.2.dtd)</p>
|
||||
* <!-- END SNIPPET: validatorVsFieldValidators2 -->
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: fieldValidatorUsingFieldValidatorSyntax -->
|
||||
* Declaring a FieldValidator using the <field-validator> syntax:
|
||||
* <p/>
|
||||
* <field name="email_address">
|
||||
* <field-validator type="required">
|
||||
*
|
||||
* <field name="email_address">
|
||||
* <field-validator type="required">
|
||||
* <message>You cannot leave the email address field empty.</message>
|
||||
* </field-validator>
|
||||
* <field-validator type="email">
|
||||
* <field-validator type="email">
|
||||
* <message>The email address you entered is not valid.</message>
|
||||
* </field-validator>
|
||||
* </field>
|
||||
* <!-- END SNIPPET: fieldValidatorUsingFieldValidatorSyntax -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: validatorVsFieldValidators3 -->
|
||||
* <p>The choice is yours. It's perfectly legal to only use <validator> elements
|
||||
* without the <field> elements and set the fieldName attribute for each of them.
|
||||
* The following are effectively equal:</P>
|
||||
* The following are effectively equal:</p>
|
||||
* <!-- END SNIPPET: validatorVsFieldValidators3 -->
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: similarVaidatorDeclaredInDiffSyntax -->
|
||||
* <field name="email_address">
|
||||
* <field-validator type="required">
|
||||
* <field name="email_address">
|
||||
* <field-validator type="required">
|
||||
* <message>You cannot leave the email address field empty.</message>
|
||||
* </field-validator>
|
||||
* <field-validator type="email">
|
||||
* <field-validator type="email">
|
||||
* <message>The email address you entered is not valid.</message>
|
||||
* </field-validator>
|
||||
* </field>
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <validator type="required">
|
||||
* <param name="fieldName">email_address</param>
|
||||
*
|
||||
*
|
||||
* <validator type="required">
|
||||
* <param name="fieldName">email_address</param>
|
||||
* <message>You cannot leave the email address field empty.</message>
|
||||
* </validator>
|
||||
* <validator type="email">
|
||||
* <param name="fieldName">email_address</param>
|
||||
* <validator type="email">
|
||||
* <param name="fieldName">email_address</param>
|
||||
* <message>The email address you entered is not valid.</message>
|
||||
* </validator>
|
||||
* <!-- END SNIPPET: similarVaidatorDeclaredInDiffSyntax -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: shortCircuitingValidators1 -->
|
||||
* <p>It is possible to short-circuit a stack of validators.
|
||||
* Here is another sample config file containing validation rules from the
|
||||
* Xwork test cases: Notice that some of the <field-validator> and
|
||||
* <validator> elements have the short-circuit attribute set to true.</p>
|
||||
* <!-- END SNIPPET : shortCircuitingValidators1 -->
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: exShortCircuitingValidators -->
|
||||
* <!DOCTYPE validators PUBLIC
|
||||
* "-//Apache Struts//XWork Validator 1.0.3//EN"
|
||||
* "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
|
||||
* "-//Apache Struts//XWork Validator 1.0.3//EN"
|
||||
* "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
|
||||
* <validators>
|
||||
* <!-- Field Validators for email field -->
|
||||
* <field name="email">
|
||||
* <field-validator type="required" short-circuit="true">
|
||||
* <field name="email">
|
||||
* <field-validator type="required" short-circuit="true">
|
||||
* <message>You must enter a value for email.</message>
|
||||
* </field-validator>
|
||||
* <field-validator type="email" short-circuit="true">
|
||||
* <field-validator type="email" short-circuit="true">
|
||||
* <message>Not a valid e-mail.</message>
|
||||
* </field-validator>
|
||||
* </field>
|
||||
* <!-- Field Validators for email2 field -->
|
||||
* <field name="email2">
|
||||
* <field-validator type="required">
|
||||
* <field name="email2">
|
||||
* <field-validator type="required">
|
||||
* <message>You must enter a value for email2.</message>
|
||||
* </field-validator>
|
||||
* <field-validator type="email">
|
||||
* <field-validator type="email">
|
||||
* <message>Not a valid e-mail2.</message>
|
||||
* </field-validator>
|
||||
* </field>
|
||||
* <!-- Plain Validator 1 -->
|
||||
* <validator type="expression">
|
||||
* <param name="expression">email.equals(email2)</param>
|
||||
* <validator type="expression">
|
||||
* <param name="expression">email.equals(email2)</param>
|
||||
* <message>Email not the same as email2</message>
|
||||
* </validator>
|
||||
* <!-- Plain Validator 2 -->
|
||||
* <validator type="expression" short-circuit="true">
|
||||
* <param name="expression">email.startsWith('mark')</param>
|
||||
* <validator type="expression" short-circuit="true">
|
||||
* <param name="expression">email.startsWith('mark')</param>
|
||||
* <message>Email does not start with mark</message>
|
||||
* </validator>
|
||||
* </validators>
|
||||
* <!-- END SNIPPET: exShortCircuitingValidators -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET:shortCircuitingValidators2 -->
|
||||
* <p><b>short-circuiting and Validator flavors</b></p>
|
||||
* <p>Plain validator takes precedence over field-validator. They get validated
|
||||
@@ -265,25 +262,25 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* will prevent the evaluation of subsequent validators and an error (action
|
||||
* error or field error depending on the type of validator) will be added to
|
||||
* the ValidationContext of the object being validated.</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p>In the example above, the actual execution of validator would be as follows:</p>
|
||||
* <p/>
|
||||
*
|
||||
* <ol>
|
||||
* <li> Plain Validator 1</li>
|
||||
* <li> Plain Validator 2</li>
|
||||
* <li> Field Validators for email field</li>
|
||||
* <li> Field Validators for email2 field</li>
|
||||
* </ol>
|
||||
* <p/>
|
||||
*
|
||||
* <p>Since Plain Validator 2 is short-circuited, if its validation failed,
|
||||
* it will causes Field validators for email field and Field validators for email2
|
||||
* field to not be validated as well.</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p><b>Usefull Information:</b>
|
||||
* More complicated validation should probably be done in the validate()
|
||||
* method on the action itself (assuming the action implements Validatable
|
||||
* interface which ActionSupport already does).</p>
|
||||
* <p/>
|
||||
*
|
||||
* <p>
|
||||
* A plain Validator (non FieldValidator) that gets short-circuited will
|
||||
* completely break out of the validation stack. No other validators will be
|
||||
@@ -292,40 +289,39 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* get a chance to be evaluated.
|
||||
* </p>
|
||||
* <!-- END SNIPPET: shortCircuitingValidators2 -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: scAndValidatorFlavours1 -->
|
||||
* <p><b>Short cuircuiting and validator flavours</b></p>
|
||||
* <p>A FieldValidator that gets short-circuited will only prevent other
|
||||
* FieldValidators for the same field from being evaluated. Note that this
|
||||
* "same field" behavior applies regardless of whether the <validator> or
|
||||
* "same field" behavior applies regardless of whether the <validator> or
|
||||
* <field-validator> syntax was used to declare the validation rule.
|
||||
* By way of example, given this -validation.xml file:</p>
|
||||
* <!-- END SNIPPET: scAndValidatorFlavours1 -->
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: exScAndValidatorFlavours -->
|
||||
* <validator type="required" short-circuit="true">
|
||||
* <param name="fieldName">bar</param>
|
||||
* <validator type="required" short-circuit="true">
|
||||
* <param name="fieldName">bar</param>
|
||||
* <message>You must enter a value for bar.</message>
|
||||
* </validator>
|
||||
* <p/>
|
||||
* <validator type="expression">
|
||||
* <param name="expression">foo gt bar</param>
|
||||
*
|
||||
* <validator type="expression">
|
||||
* <param name="expression">foo gt bar</param>
|
||||
* <message>foo must be great than bar.</message>
|
||||
* </validator>
|
||||
* <!-- END SNIPPET: exScAndValidatorFlavours -->
|
||||
* </pre>
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: scAndValidatorFlavours2 -->
|
||||
* <p>both validators will be run, even if the "required" validator short-circuits.
|
||||
* "required" validators are FieldValidator's and will not short-circuit the plain
|
||||
* <p>both validators will be run, even if the "required" validator short-circuits.
|
||||
* "required" validators are FieldValidator's and will not short-circuit the plain
|
||||
* ExpressionValidator because FieldValidators only short-circuit other checks on
|
||||
* that same field. Since the plain Validator is not field specific, it is
|
||||
* not short-circuited.</p>
|
||||
* <!-- END SNIPPET: scAndValidatorFlavours2 -->
|
||||
* <p/>
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: howXworkFindsValidatorForAction -->
|
||||
* <p>As mentioned above, the framework will also search up the inheritance tree
|
||||
* of the action to find default validations for interfaces and parent classes of
|
||||
@@ -353,36 +349,36 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* </p>
|
||||
* <!-- END SNIPPET: howXworkFindsValidatorForAction -->
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: i18n -->
|
||||
* Validator's validation messages could be internatinalized. For example,
|
||||
* <pre>
|
||||
* <field-validator type="required">
|
||||
* <message key="required.field" />
|
||||
* <field-validator type="required">
|
||||
* <message key="required.field" />
|
||||
* </field-validator>
|
||||
* </pre>
|
||||
* or
|
||||
* <pre>
|
||||
* <validator type="expression">
|
||||
* <param name="expression">email.startsWith('Mark')</param>
|
||||
* <message key="email.invalid" />
|
||||
* <validator type="expression">
|
||||
* <param name="expression">email.startsWith('Mark')</param>
|
||||
* <message key="email.invalid" />
|
||||
* </validator>
|
||||
* </pre>
|
||||
* In the first case, WebWork would look for i18n with key 'required.field' as the validation error message if
|
||||
* validation fails, and 'email.invalid' in the second case.
|
||||
* <p/>
|
||||
*
|
||||
* We could also provide a default message such that if validation failed and the i18n key for the message
|
||||
* cannot be found, WebWork would fall back and use the default message. An example would be as follows :-
|
||||
* <pre>
|
||||
* <field-validator type="required">
|
||||
* <message key="required.field">This field is required.</message>
|
||||
* <field-validator type="required">
|
||||
* <message key="required.field">This field is required.</message>
|
||||
* </field-validator>
|
||||
* </pre>
|
||||
* or
|
||||
* <pre>
|
||||
* <validator type="expression">
|
||||
* <param name="expression">email.startsWith('Mark')</param>
|
||||
* <message key="email.invalid">Email needs with starts with Mark</message>
|
||||
* <validator type="expression">
|
||||
* <param name="expression">email.startsWith('Mark')</param>
|
||||
* <message key="email.invalid">Email needs with starts with Mark</message>
|
||||
* </validator>
|
||||
* </pre>
|
||||
*
|
||||
@@ -429,16 +425,16 @@ public interface Validator<T> {
|
||||
String getMessageKey();
|
||||
|
||||
/**
|
||||
* Sets the messsage parameters to be used when parsing i18n messages
|
||||
* Sets the message parameters to be used when parsing i18n messages
|
||||
*
|
||||
* @param messageParameters the messsage parameters
|
||||
* @param messageParameters the message parameters
|
||||
*/
|
||||
void setMessageParameters(String[] messageParameters);
|
||||
|
||||
/**
|
||||
* Gets the messsage parameters to be used when parsing i18n messages
|
||||
* Gets the message parameters to be used when parsing i18n messages
|
||||
*
|
||||
* @return the messsage parameters
|
||||
* @return the message parameters
|
||||
*/
|
||||
String[] getMessageParameters();
|
||||
|
||||
@@ -473,7 +469,7 @@ public interface Validator<T> {
|
||||
void setValidatorType(String type);
|
||||
|
||||
/**
|
||||
* Gets the vaildator type used (see class javadoc).
|
||||
* Gets the validator type used (see class javadoc).
|
||||
*
|
||||
* @return the type used
|
||||
*/
|
||||
|
||||
+14
-9
@@ -7,23 +7,28 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* <p>
|
||||
* The validator allows you to forward validator to object properties of your action
|
||||
* using the objects own validator files. This allows you to use the ModelDriven development
|
||||
* pattern and manage your validations for your models in one place, where they belong, next to
|
||||
* your model classes.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The ConditionalVisitorFieldValidator can handle either simple Object properties, Collections of Objects, or Arrays.
|
||||
* The error message for the ConditionalVisitorFieldValidator will be appended in front of validator messages added
|
||||
* by the validations for the Object message.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -84,7 +89,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -100,7 +105,7 @@ public @interface ConditionalVisitorFieldValidator {
|
||||
|
||||
/**
|
||||
* Determines the context to use for validating the Object property.
|
||||
* If not defined, the context of the Action validator is propogated to the Object property validator.
|
||||
* If not defined, the context of the Action validator is propagated to the Object property validator.
|
||||
* In the case of Action validator, this context is the Action alias.
|
||||
*/
|
||||
String context() default "";
|
||||
@@ -108,10 +113,10 @@ public @interface ConditionalVisitorFieldValidator {
|
||||
/**
|
||||
* Determines whether the field name of this field validator should be prepended to the field name of
|
||||
* the visited field to determine the full field name when an error occurs. For example, suppose that
|
||||
* the bean being validated has a "name" property.
|
||||
* the bean being validated has a 'name' property.
|
||||
*
|
||||
* If appendPrefix is true, then the field error will be stored under the field "bean.name".
|
||||
* If appendPrefix is false, then the field error will be stored under the field "name".
|
||||
* If appendPrefix is true, then the field error will be stored under the field 'bean.name'.
|
||||
* If appendPrefix is false, then the field error will be stored under the field 'name'.
|
||||
*
|
||||
* If you are using the ConditionalVisitorFieldValidator to validate the model from a ModelDriven Action,
|
||||
* you should set appendPrefix to false unless you are using "model.name" to reference the properties
|
||||
@@ -148,7 +153,7 @@ public @interface ConditionalVisitorFieldValidator {
|
||||
/**
|
||||
* If this is activated, the validator will be used as short-circuit.
|
||||
*
|
||||
* Adds the short-circuit="true" attribute value if <tt>true</tt>.
|
||||
* Adds the short-circuit='true' attribute value if <tt>true</tt>.
|
||||
*
|
||||
*/
|
||||
boolean shortCircuit() default false;
|
||||
|
||||
+5
-6
@@ -24,16 +24,16 @@ import java.lang.annotation.Target;
|
||||
/**
|
||||
* <!-- START SNIPPET: description -->
|
||||
* This validator checks if there are any conversion errors for a field and applies them if they exist.
|
||||
* See <a href="http://wiki.opensymphony.com/display/XW/Type+Conversion+Error+Handling">Type Conversion Error Handling</a> for details.
|
||||
* See <a href="https://struts.apache.org/docs/type-conversion.html#TypeConversion-TypeConversionErrorHandling">Type Conversion Error Handling</a> for details.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The ConversionErrorFieldValidator annotation must be applied at method level.
|
||||
* <p>The ConversionErrorFieldValidator annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -82,7 +82,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -91,7 +91,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
+4
-5
@@ -26,13 +26,13 @@ import java.lang.annotation.Target;
|
||||
* This annotation can be used for custom validators. Use the ValidationParameter annotation to supply additional params.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method or type level.
|
||||
* <p>The annotation must be applied at method or type level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -81,7 +81,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -91,7 +91,6 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* @author jepjep
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
+4
-5
@@ -26,13 +26,13 @@ import java.lang.annotation.Target;
|
||||
* This validator checks that a date field has a value within a specified range.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -119,7 +119,7 @@ import java.lang.annotation.Target;
|
||||
* <p>If neither <em>min</em> nor <em>max</em> is set, nothing will be done.</p>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -128,7 +128,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
+4
-5
@@ -27,13 +27,13 @@ import java.lang.annotation.Target;
|
||||
* If neither min nor max is set, nothing will be done.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -134,7 +134,7 @@ import java.lang.annotation.Target;
|
||||
* <p>The values for min and max must be inserted as String values so that "0" can be handled as a possible value.</p>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -143,7 +143,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
+5
-6
@@ -26,13 +26,13 @@ import java.lang.annotation.Target;
|
||||
* This validator checks that a field is a valid e-mail address if it contains a non-empty String.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -81,7 +81,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -90,7 +90,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@@ -120,7 +119,7 @@ public @interface EmailValidator {
|
||||
/**
|
||||
* If this is activated, the validator will be used as short-circuit.
|
||||
*
|
||||
* Adds the short-circuit="true" attribute value if <tt>true</tt>.
|
||||
* Adds the short-circuit='true' attribute value if <tt>true</tt>.
|
||||
*
|
||||
*/
|
||||
boolean shortCircuit() default false;
|
||||
|
||||
+4
-5
@@ -26,13 +26,13 @@ import java.lang.annotation.Target;
|
||||
* This non-field level validator validates a supplied regular expression.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -75,7 +75,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -84,7 +84,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD})
|
||||
|
||||
+5
-6
@@ -28,13 +28,13 @@ import java.lang.annotation.Target;
|
||||
* false when it is evaluated against the value stack.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -83,7 +83,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -92,7 +92,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@@ -127,7 +126,7 @@ public @interface FieldExpressionValidator {
|
||||
/**
|
||||
* If this is activated, the validator will be used as short-circuit.
|
||||
*
|
||||
* Adds the short-circuit="true" attribute value if <tt>true</tt>.
|
||||
* Adds the short-circuit='true' attribute value if <tt>true</tt>.
|
||||
*
|
||||
*/
|
||||
boolean shortCircuit() default false;
|
||||
|
||||
+5
-6
@@ -27,13 +27,13 @@ import java.lang.annotation.Target;
|
||||
* If neither min nor max is set, nothing will be done.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -116,7 +116,7 @@ import java.lang.annotation.Target;
|
||||
* <p>The values for min and max must be inserted as String values so that "0" can be handled as a possible value.</p>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -128,7 +128,6 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@@ -178,7 +177,7 @@ public @interface IntRangeFieldValidator {
|
||||
/**
|
||||
* If this is activated, the validator will be used as short-circuit.
|
||||
*
|
||||
* Adds the short-circuit="true" attribute value if <tt>true</tt>.
|
||||
* Adds the short-circuit='true' attribute value if <tt>true</tt>.
|
||||
*
|
||||
*/
|
||||
boolean shortCircuit() default false;
|
||||
|
||||
+5
-6
@@ -26,13 +26,13 @@ import java.lang.annotation.Target;
|
||||
* Validates a string field using a regular expression.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -87,7 +87,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -96,7 +96,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="mailto:hermanns@aixcept.de">Rainer Hermanns</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@@ -169,7 +168,7 @@ public @interface RegexFieldValidator {
|
||||
/**
|
||||
* If this is activated, the validator will be used as short-circuit.
|
||||
*
|
||||
* Adds the short-circuit="true" attribute value if <tt>true</tt>.
|
||||
* Adds the short-circuit='true' attribute value if <tt>true</tt>.
|
||||
*
|
||||
*/
|
||||
boolean shortCircuit() default false;
|
||||
|
||||
+4
-5
@@ -26,13 +26,13 @@ import java.lang.annotation.Target;
|
||||
* This validator checks that a field is non-null.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -81,7 +81,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -91,7 +91,6 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
+4
-4
@@ -26,13 +26,13 @@ import java.lang.annotation.Target;
|
||||
* This validator checks that a String field is not empty (i.e. non-null with a length > 0).
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -87,7 +87,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
+4
-4
@@ -27,13 +27,13 @@ import java.lang.annotation.Target;
|
||||
* If neither min nor max is set, nothing will be done.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -116,7 +116,7 @@ import java.lang.annotation.Target;
|
||||
* <p>The values for min and max must be inserted as String values so that "0" can be handled as a possible value.</p>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
+4
-5
@@ -27,13 +27,13 @@ import java.lang.annotation.Target;
|
||||
* If neither minLength nor maxLength is set, nothing will be done.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -115,7 +115,7 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -124,7 +124,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@@ -27,13 +27,13 @@ import java.lang.annotation.Target;
|
||||
* is no longer necessary.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The Validation annotation must be applied at Type level.
|
||||
* <p>The Validation annotation must be applied at Type level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -52,7 +52,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <u>An Annotated Interface</u>
|
||||
* <pre>
|
||||
@@ -73,7 +73,7 @@ import java.lang.annotation.Target;
|
||||
* <!-- END SNIPPET: example -->
|
||||
* </pre>
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <u>An Annotated Class</u>
|
||||
* <pre>
|
||||
@@ -124,7 +124,6 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @deprecated Since Struts 2.1 because it isn't necessary anymore
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
+4
-4
@@ -26,13 +26,13 @@ import java.lang.annotation.Target;
|
||||
* The ValidationParameter annotation is used as a parameter for CustomValidators.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must embedded into CustomValidator annotations as a parameter.
|
||||
* <p>The annotation must embedded into CustomValidator annotations as a parameter.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -57,7 +57,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
|
||||
@@ -26,13 +26,13 @@ import java.lang.annotation.Target;
|
||||
* <p>If you want to use several annotations of the same type, these annotations must be nested within the @Validations() annotation.</p>
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>Used at METHOD level.
|
||||
* <p>Used at METHOD level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -112,7 +112,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -149,7 +149,6 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* @author jepjep
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target( { ElementType.METHOD, ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
+5
-6
@@ -33,13 +33,13 @@ import java.lang.annotation.Target;
|
||||
* by the validations for the Object message.
|
||||
* <!-- END SNIPPET: description -->
|
||||
*
|
||||
* <p/> <u>Annotation usage:</u>
|
||||
* <p><u>Annotation usage:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: usage -->
|
||||
* <p/>The annotation must be applied at method level.
|
||||
* <p>The annotation must be applied at method level.</p>
|
||||
* <!-- END SNIPPET: usage -->
|
||||
*
|
||||
* <p/> <u>Annotation parameters:</u>
|
||||
* <p><u>Annotation parameters:</u></p>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <table class='confluenceTable'>
|
||||
@@ -94,7 +94,7 @@ import java.lang.annotation.Target;
|
||||
* </table>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
* <p/> <u>Example code:</u>
|
||||
* <p><u>Example code:</u></p>
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
@@ -103,7 +103,6 @@ import java.lang.annotation.Target;
|
||||
* </pre>
|
||||
*
|
||||
* @author Rainer Hermanns
|
||||
* @version $Id$
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@@ -111,7 +110,7 @@ public @interface VisitorFieldValidator {
|
||||
|
||||
/**
|
||||
* Determines the context to use for validating the Object property.
|
||||
* If not defined, the context of the Action validator is propogated to the Object property validator.
|
||||
* If not defined, the context of the Action validator is propagated to the Object property validator.
|
||||
* In the case of Action validator, this context is the Action alias.
|
||||
*/
|
||||
String context() default "";
|
||||
|
||||
+1
-3
@@ -27,7 +27,7 @@ import java.util.Map;
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* Field Validator that checks if a conversion error occurred for this field.
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <ul>
|
||||
* <li>fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required</li>
|
||||
@@ -53,8 +53,6 @@ import java.util.Map;
|
||||
*
|
||||
* @author Jason Carreira
|
||||
* @author tm_jee
|
||||
*
|
||||
* @version $Date $Id$
|
||||
*/
|
||||
public class ConversionErrorFieldValidator extends RepopulateConversionErrorFieldValidatorSupport {
|
||||
|
||||
|
||||
-3
@@ -30,8 +30,6 @@ import java.util.Date;
|
||||
*
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <ul>
|
||||
* <li>fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required</li>
|
||||
@@ -84,7 +82,6 @@ import java.util.Date;
|
||||
*
|
||||
*
|
||||
* @author Jason Carreira
|
||||
* @version $Date$ $Id$
|
||||
*/
|
||||
public final class DateRangeFieldValidator extends RangeValidatorSupport<Date> {
|
||||
|
||||
|
||||
+1
-2
@@ -21,8 +21,7 @@ import com.opensymphony.xwork2.validator.ValidationException;
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* A Non-Field Level validator that validates based on regular expression supplied.
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <ul>
|
||||
* <li>expression - the Ognl expression to be evaluated against the stack (Must evaluate to a Boolean)</li>
|
||||
|
||||
+1
-6
@@ -22,8 +22,7 @@ import com.opensymphony.xwork2.validator.ValidationException;
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* Validates a field using an OGNL expression.
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <ul>
|
||||
* <li>fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required</li>
|
||||
@@ -53,10 +52,6 @@ import com.opensymphony.xwork2.validator.ValidationException;
|
||||
* </vaidators>
|
||||
* <!-- END SNIPPET: example -->
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author $Author$
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class FieldExpressionValidator extends FieldValidatorSupport {
|
||||
|
||||
|
||||
+9
-13
@@ -28,33 +28,30 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* An abstract base class that adds in the capability to populate the stack with
|
||||
* a fake parameter map when a conversion error has occurred and the 'repopulateField'
|
||||
* property is set to "true".
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
*
|
||||
* <p>
|
||||
* The capability of auto-repopulating the stack with a fake parameter map when
|
||||
* a conversion error has occurred can be done with 'repopulateField' property
|
||||
* set to "true".
|
||||
* </p>
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* This is typically usefull when one wants to repopulate the field with the original value
|
||||
* <p>
|
||||
* This is typically useful when one wants to repopulate the field with the original value
|
||||
* when a conversion error occurred. Eg. with a textfield that only allows an Integer
|
||||
* (the action class have an Integer field declared), upon conversion error, the incorrectly
|
||||
* entered integer (maybe a text 'one') will not appear when dispatched back. With 'repopulateField'
|
||||
* porperty set to true, it will, meaning the textfield will have 'one' as its value
|
||||
* property set to true, it will, meaning the textfield will have 'one' as its value
|
||||
* upon conversion error.
|
||||
* </p>
|
||||
*
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
*
|
||||
* <p/>
|
||||
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: exampleJspPage -->
|
||||
@@ -130,7 +127,6 @@ import java.util.Map;
|
||||
* </pre>
|
||||
*
|
||||
* @author tm_jee
|
||||
* @version $Date$ $Id$
|
||||
*/
|
||||
public abstract class RepopulateConversionErrorFieldValidatorSupport extends FieldValidatorSupport {
|
||||
|
||||
|
||||
+2
-6
@@ -22,16 +22,13 @@ import com.opensymphony.xwork2.validator.ValidationException;
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
* RequiredFieldValidator checks if the specified field is not null.
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
* <p/>
|
||||
*
|
||||
*
|
||||
*
|
||||
* <!-- START SNIPPET: parameters -->
|
||||
* <ul>
|
||||
* <li>fieldName - field name if plain-validator syntax is used, not needed if field-validator syntax is used</li>
|
||||
* </ul>
|
||||
* <!-- END SNIPPET: parameters -->
|
||||
*
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example -->
|
||||
* <validators>
|
||||
@@ -57,7 +54,6 @@ import com.opensymphony.xwork2.validator.ValidationException;
|
||||
*
|
||||
*
|
||||
* @author rainerh
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class RequiredFieldValidator extends FieldValidatorSupport {
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user