diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java index 3eb4e0888..5cf6b4925 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java @@ -28,18 +28,20 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** + *
* This is an example of a custom FreemarkerManager, mean to be * instantiated through Spring. - *
- * + * + * + ** It will add into Freemarker's model * an utility class called {@link CustomFreemarkerManagerUtil} as a simple * example demonstrating how to extends FreemarkerManager. - *
- * + * + ** The {@link CustomFreemarkerManagerUtil} will be created by Spring and * injected through constructor injection. - *
+ * */ public class CustomFreemarkerManager extends FreemarkerManager { diff --git a/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/view/index.jsp b/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/view/index.jsp index 5cd1fef93..10f2e8734 100644 --- a/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/view/index.jsp +++ b/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/view/index.jsp @@ -1,7 +1,8 @@ <%@ taglib prefix="s" uri="/struts-tags" %> -This a simple table showing the database data: +
| Name | diff --git a/core/src/main/java/com/opensymphony/xwork2/Action.java b/core/src/main/java/com/opensymphony/xwork2/Action.java index f10a431b6..c9274c578 100644 --- a/core/src/main/java/com/opensymphony/xwork2/Action.java +++ b/core/src/main/java/com/opensymphony/xwork2/Action.java @@ -17,9 +17,10 @@ package com.opensymphony.xwork2; /** * All actions may implement this interface, which exposes the
|---|
| Interceptor | *property | @@ -161,30 +165,33 @@ import java.io.Serializable; *param4 | *
+ * We could override them as follows : + *
+ * ** <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> - * + * * <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> *- * + * * * * @author Jason Carreira * @author tmjee - * @version $Date$ $Id$ */ public interface Interceptor extends Serializable { diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java index c82532faf..e48d3ea5f 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/LoggingInterceptor.java @@ -22,10 +22,11 @@ import org.apache.logging.log4j.Logger; /** * + *
* This interceptor logs the start and end of the execution an action (in English-only, not internationalized).
*
* Note:: This interceptor will log at INFO level.
- *
* * <!-- 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> * *diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.java index a46cf3410..34b692069 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/MethodFilterInterceptor.java @@ -27,12 +27,13 @@ import java.util.Set; /** * - * + * + *
* MethodFilterInterceptor is an abstract Interceptor used as
* a base class for interceptors that will filter execution based on method
* names according to specified included/excluded method lists.
*
- *
* * NOTE: If method name are available in both includeMethods and * excludeMethods, it will be considered as an included method: * includeMethods takes precedence over excludeMethods. * - *
+ * * * Interceptors that extends this capability include: * diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java index 06a91b5c8..afc6edcb7 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ModelDrivenInterceptor.java @@ -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. * - * Note: The ModelDrivenInterceptor must come before the both {@link StaticParametersInterceptor} and + *Note: The ModelDrivenInterceptor must come before the both {@link StaticParametersInterceptor} and * {@link ParametersInterceptor} if you want the parameters to be applied to the model. - * - *
Note: The ModelDrivenInterceptor will only push the model into the stack when the + * + *Note: The ModelDrivenInterceptor will only push the model into the stack when the * model is not null, else it will be ignored. + *
* * * - * Interceptor parameters: + *Interceptor parameters:
* * * @@ -49,9 +50,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * * - * Extending the interceptor: - * - * + *Extending the interceptor:
* * * @@ -59,14 +58,14 @@ import com.opensymphony.xwork2.util.ValueStack; * * * - * Example code: + *Example code:
* ** - * <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> * *diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/NoParameters.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/NoParameters.java index 8db8fbce7..2de46b190 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/NoParameters.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/NoParameters.java @@ -17,14 +17,16 @@ package com.opensymphony.xwork2.interceptor; /** - * Marker interface to incidate no auto setting of parameters. - * + * Marker interface to indicate no auto setting of parameters. + * + *
* 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. + *
* * @author Dick Zetterberg (dick@transitor.se) */ diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java index 865eeb81d..eac4d8b9a 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java @@ -241,9 +241,10 @@ public class ParametersInterceptor extends MethodFilterInterceptor { * * @param ac The action context * @param newParams The parameter map to apply - * + ** 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. + *
*/ protected void addParametersToContext(ActionContext ac, Map* Don't change the default unless you know what you are doing in terms * of security implications. + *
* * @param commaDelim A comma-delimited list of regular expressions */ diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrefixMethodInvocationUtil.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/PrefixMethodInvocationUtil.java index 5a6e5a106..bbf82777e 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrefixMethodInvocationUtil.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/PrefixMethodInvocationUtil.java @@ -23,16 +23,16 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** + ** A utility class for invoking prefixed methods in action class. * * Interceptors that made use of this class are: + *
*
* This method will prefix actionInvocation's ActionProxy's
* method with prefixes before invoking the prefixed method.
* Order of the prefixes is important, as this method will return once
* a prefixed method is found in the action class.
- *
- *
* For example, with + *
+ * *
* invokePrefixMethod(actionInvocation, new String[] { "prepare", "prepareDo" });
*
- *
+ *
+ *
* Assuming actionInvocation.getProxy(),getMethod() returns "submit",
* the order of invocation would be as follows:-
+ *
* If prepareSubmit() exists, it will be invoked and this method
* will return, prepareDoSubmit() will NOT be invoked.
- *
- *
* On the other hand, if prepareDoSubmit() does not exists, and
* prepareDoSubmit() exists, it will be invoked.
- *
- *
* If none of those two methods exists, nothing will be invoked. - * + *
+ * * @param actionInvocation the action invocation * @param prefixes prefixes for method names * @throws InvocationTargetException is thrown if invocation of a method failed. diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java index 6a327c394..e1d0b5277 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/PrepareInterceptor.java @@ -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. * - * A typical use of this is to run some logic to load an object from the + *+ * 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: id and * name. 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 user.name will be set, as desired, on the actual object * loaded from the database. See the example for more info. - * - *
+ * + ** Note: 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. + *
* - * Update: Added logic to execute a prepare{MethodName} and conditionally + *+ * Update: 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. + *
* * * - * Interceptor parameters: + *Interceptor parameters:
* * * @@ -66,9 +70,7 @@ import java.lang.reflect.InvocationTargetException; * * * - * Extending the interceptor: - * - * + *Extending the interceptor:
* * * @@ -76,7 +78,7 @@ import java.lang.reflect.InvocationTargetException; * * * - * Example code: + *Example code:
* *
*
@@ -107,9 +109,10 @@ public class PrepareInterceptor extends MethodFilterInterceptor {
private boolean firstCallPrepareDo = false;
/**
- * Sets if the preapare method should always be executed.
- *
+ * Sets if the prepare method should always be executed.
+ *
* Default is true.
+ *
*
* @param alwaysInvokePrepare if prepare should always be executed or not.
*/
@@ -119,9 +122,9 @@ public class PrepareInterceptor extends MethodFilterInterceptor {
/**
* Sets if the prepareDoXXX method should be called first
- *
+ *
* Default is false for backward compatibility
- *
+ *
* @param firstCallPrepareDo if prepareDoXXX should be called first
*/
public void setFirstCallPrepareDo(String firstCallPrepareDo) {
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java
index 9d32fbe97..858a33e89 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java
@@ -30,12 +30,12 @@ import java.util.Map;
*
* An interceptor that enables scoped model-driven actions.
*
- * 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.
+ * 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.
*
*
*
- * Interceptor parameters:
+ * Interceptor parameters:
*
*
*
@@ -51,9 +51,7 @@ import java.util.Map;
*
*
*
- * Extending the interceptor:
- *
- *
+ * Extending the interceptor:
*
*
*
@@ -61,7 +59,7 @@ import java.util.Map;
*
*
*
- * Example code:
+ * Example code:
*
*
*
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
index e47af30c2..934dd5432 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/StaticParametersInterceptor.java
@@ -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.
*
- * Parameters are typically defined with <param> elements within xwork.xml.
+ * Parameters are typically defined with <param> elements within xwork.xml.
*
*
*
- * Interceptor parameters:
+ * Interceptor parameters:
*
*
*
@@ -55,15 +55,15 @@ import java.util.TreeMap;
*
*
*
- * Extending the interceptor:
+ * Extending the interceptor:
*
*
*
- * There are no extension points to this interceptor.
+ * There are no extension points to this interceptor.
*
*
*
- * Example code:
+ * Example code:
*
*
*
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ValidationAware.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ValidationAware.java
index 5aa19b60d..53c72f1c9 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ValidationAware.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ValidationAware.java
@@ -113,8 +113,6 @@ public interface ValidationAware {
/**
* Checks whether there are any action errors or field errors.
- *
- * Note: that this does not have the same meaning as in WW 1.x.
*
* @return (hasActionErrors() || hasFieldErrors())
*/
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/After.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/After.java
index 3fc2fcd8e..978a49a2a 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/After.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/After.java
@@ -26,14 +26,14 @@ import java.lang.annotation.Target;
* executed. Return value is ignored.
*
*
- * Annotation usage:
+ * Annotation usage:
*
*
* The After annotation can be applied at method level.
*
*
*
- * Annotation parameters:
+ * Annotation parameters:
*
*
* Example code:
* *
*
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterIntereptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterIntereptor.java
index f978e46ba..327d2c6db 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterIntereptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationParameterFilterIntereptor.java
@@ -17,13 +17,16 @@ import java.util.Map;
/**
* Annotation based version of {@link ParameterFilterInterceptor}.
- *
+ *
+ *
* 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.
- *
+ *
+ *
* 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}
+ *
*
* @author martin.gilday
*/
diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java
index 665ed1c35..dbe4315ae 100644
--- a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java
+++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/AnnotationWorkflowInterceptor.java
@@ -30,50 +30,49 @@ import java.util.List;
/**
*
* Invokes any annotated methods on the action. Specifically, it supports the following
- * annotations:
+ * annotations:
* 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}.
* - * + * *
*
* public class BaseAnnotatedAction {
* protected String log = "";
- *
+ *
* @Before
* public String baseBefore() {
* log = log + "baseBefore-";
* return null;
* }
* }
- *
+ *
* public class AnnotatedAction extends BaseAnnotatedAction {
* @Before
* public String before() {
* log = log + "before";
* return null;
* }
- *
+ *
* public String execute() {
* log = log + "-execute";
* return Action.SUCCESS;
* }
- *
+ *
* @BeforeResult
* public void beforeResult() throws Exception {
* log = log +"-beforeResult";
* }
- *
+ *
* @After
* public void after() {
* log = log + "-after";
@@ -81,13 +80,13 @@ import java.util.List;
* }
*
*
- *
+ *
*
* With the interceptor applied and the action executed on AnnotatedAction the log
* instance variable will contain baseBefore-before-execute-beforeResult-after.
Configure a stack in xwork.xml that replaces the PrepareInterceptor with the AnnotationWorkflowInterceptor:
** * <interceptor-stack name="annotatedStack"> diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/Before.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/Before.java index cb0e55563..fb546dec9 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/Before.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/Before.java @@ -25,14 +25,14 @@ import java.lang.annotation.Target; * Marks a action method that needs to be executed before the main action method. * * - * Annotation usage: + *Annotation usage:
* * * The Before annotation can be applied at method level. * * * - * Annotation parameters: + *Annotation parameters:
* * *
Example code:
* ** diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/BeforeResult.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/BeforeResult.java index faeb4003c..44825bdf1 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/BeforeResult.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/BeforeResult.java @@ -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. * * - * Annotation usage: + *Annotation usage:
* * * The BeforeResult annotation can be applied at method level. * * * - * Annotation parameters: + *Annotation parameters:
* * *
Example code:
* ** diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/InputConfig.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/InputConfig.java index 5d70744d4..33f7ab110 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/InputConfig.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/annotations/InputConfig.java @@ -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. * * - * Annotation usage: + *Annotation usage:
* * * The InputConfig annotation can be applied at method level. * * * - * Annotation parameters: + *Annotation parameters:
* * *
Example code:
* ** diff --git a/core/src/main/java/com/opensymphony/xwork2/spring/SpringObjectFactory.java b/core/src/main/java/com/opensymphony/xwork2/spring/SpringObjectFactory.java index 6475957c9..bc30d576f 100644 --- a/core/src/main/java/com/opensymphony/xwork2/spring/SpringObjectFactory.java +++ b/core/src/main/java/com/opensymphony/xwork2/spring/SpringObjectFactory.java @@ -32,10 +32,14 @@ import java.util.HashMap; import java.util.Map; /** + ** 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.
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. + * + *+ * 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. + *
* * @author Simon Stewart (sms@lateral.net) */ diff --git a/core/src/main/java/com/opensymphony/xwork2/spring/interceptor/ActionAutowiringInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/spring/interceptor/ActionAutowiringInterceptor.java index fe02ca5ca..7c11b8575 100644 --- a/core/src/main/java/com/opensymphony/xwork2/spring/interceptor/ActionAutowiringInterceptor.java +++ b/core/src/main/java/com/opensymphony/xwork2/spring/interceptor/ActionAutowiringInterceptor.java @@ -77,16 +77,20 @@ public class ActionAutowiringInterceptor extends AbstractInterceptor implements } /** + ** Looks for the
+ * + * + *ApplicationContextunder 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 *ActionContextis not available duringInterceptorinitialization. - ** Autowires the action to Spring beans and places the
- * TODO Should this check to see if theApplicationContext* on theActionContext- *SpringObjectFactoryhas already been configured - * instead of instantiating a new one? Or is there a good reason for the interceptor to have it's own - * factory? + * + * + *+ * TODO: Should this check to see if the
* * @param invocation * @throws Exception diff --git a/core/src/main/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java index 919f5af7d..46cfe9f1e 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java @@ -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. - * + *SpringObjectFactoryhas already been configured instead of instantiating a new one? Or is there a good reason for the interceptor to have it's own factory? + ** 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! - * + *
*/ public class ClassLoaderUtil { @@ -73,8 +73,10 @@ public class ClassLoaderUtil { /** * Load a given resource. - * + ** This method will try to load the resource using the following methods (in order): + *
+ * *
* Load a class with a given name. - *
+ * + * + ** It will try to load the class in the following order: + *
+ * *Sets the CreateIfNull for type conversion.
* * - * Annotation usage: + *Annotation usage:
* * - * The CreateIfNull annotation must be applied at field or method level. + *The CreateIfNull annotation must be applied at field or method level.
* - * Annotation parameters: + *Annotation parameters:
* * *Example code:
** * @CreateIfNull( value = true ) @@ -63,7 +63,6 @@ import java.lang.annotation.Target; ** * @author Rainer Hermanns - * @version $Id$ */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) diff --git a/core/src/main/java/com/opensymphony/xwork2/util/Element.java b/core/src/main/java/com/opensymphony/xwork2/util/Element.java index 30903d2d7..de66d1f3a 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/Element.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/Element.java @@ -23,15 +23,15 @@ import java.lang.annotation.Target; /** * - * Sets the Element for type conversion. + *
Sets the Element for type conversion.
* * - * Annotation usage: + *Annotation usage:
* * - * The Element annotation must be applied at field or method level. + *The Element annotation must be applied at field or method level.
* - * Annotation parameters: + *Annotation parameters:
* * *Example code:
*
*
* // The key property for User objects within the users collection is the userName attribute.
@@ -67,7 +67,6 @@ import java.lang.annotation.Target;
*
*
* @author Rainer Hermanns
- * @version $Id$
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/Key.java b/core/src/main/java/com/opensymphony/xwork2/util/Key.java
index c1b0fc8bf..5d2fb6de0 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/Key.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/Key.java
@@ -23,15 +23,15 @@ import java.lang.annotation.Target;
/**
*
- * Sets the Key for type conversion.
+ * Sets the Key for type conversion.
* * - * Annotation usage: + *Annotation usage:
* * - * The Key annotation must be applied at field or method level. + *The Key annotation must be applied at field or method level.
* - * Annotation parameters: + *Annotation parameters:
* * *Example code:
*
*
* // The key property for User objects within the users collection is the userName attribute.
@@ -64,7 +64,6 @@ import java.lang.annotation.Target;
*
*
* @author Rainer Hermanns
- * @version $Id$
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
diff --git a/core/src/main/java/com/opensymphony/xwork2/util/KeyProperty.java b/core/src/main/java/com/opensymphony/xwork2/util/KeyProperty.java
index 8832beebf..396af4724 100644
--- a/core/src/main/java/com/opensymphony/xwork2/util/KeyProperty.java
+++ b/core/src/main/java/com/opensymphony/xwork2/util/KeyProperty.java
@@ -23,16 +23,16 @@ import java.lang.annotation.Target;
/**
*
- * Sets the KeyProperty for type conversion.
+ * Sets the KeyProperty for type conversion.
* * - * Annotation usage: + *Annotation usage:
* * - * The KeyProperty annotation must be applied at field or method level. - * This annotation should be used with Generic types, if the key property of the key element needs to be specified. + *The KeyProperty annotation must be applied at field or method level.
+ *This annotation should be used with Generic types, if the key property of the key element needs to be specified.
* - * Annotation parameters: + *Annotation parameters:
* * *Example code:
** * // The key property for User objects within the users collection is the* *userNameattribute. diff --git a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java index 2d9afa268..2372499a1 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/LocalizedTextUtil.java @@ -42,10 +42,10 @@ import java.util.concurrent.ConcurrentMap; /** * Provides support for localization in XWork. - * + * * - * Resource bundles are searched in the following order: - * + *Resource bundles are searched in the following order:
+ * **
- * + * * - * + * * - * To clarify #5, while traversing the package hierarchy, Struts 2 will look for a file package.properties: + *- ActionClass.properties
*- Interface.properties (every interface and sub-interface)
@@ -55,11 +55,11 @@ import java.util.concurrent.ConcurrentMap; *- search up the i18n message key hierarchy itself
*- global resource properties
*To clarify #5, while traversing the package hierarchy, Struts 2 will look for a file package.properties:
* com/
* acme/
* package.properties
@@ -67,22 +67,22 @@ import java.util.concurrent.ConcurrentMap; * package.properties
* FooAction.java
* FooAction.properties
- * + ** 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. - *
+ * * - * + * * - * A global resource bundle could be specified programatically, as well as the locale. - * + *+ * A global resource bundle could be specified programmatically, as well as the locale. + *
* * * @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. - * + ** If the bundle already exists in the list it will be readded. + *
* * @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. - * + * Finds the given resource bundle by it's name. + ** Will use
* * @param aBundleName the name of the bundle (usually it's FQN classname). * @param locale the locale. @@ -328,10 +330,12 @@ public class LocalizedTextUtil { } /** + *Thread.currentThread().getContextClassLoader()as the classloader. + ** 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: - *
+ * + * **
- Look for message in aClass' class hierarchy. *
@@ -350,19 +354,25 @@ public class LocalizedTextUtil { *
- * + * + *- If still not found, look for the message in the default resource bundles.
*- Return defaultMessage
** 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[*]). - *
+ * + * + ** If a message is found, it will also be interpolated. Anything within
* * @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 { } /** + *${...}* will be treated as an OGNL expression and evaluated as such. + ** 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: - *
+ * + * **
- Look for message in aClass' class hierarchy. *
@@ -394,21 +406,28 @@ public class LocalizedTextUtil { *
- * + * + *- If still not found, look for the message in the default resource bundles.
*- Return defaultMessage
** 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[*]). - *
+ * + * + ** If a message is found, it will also be interpolated. Anything within
+ * + * + *${...}* will be treated as an OGNL expression and evaluated as such. - ** If a message is not found a WARN log will be logged. + *
* * @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 { } /** + ** Finds a localized text message for the given key, aTextName, in the specified resource bundle * with aTextName as the default message. - *
+ * + * + ** If a message is found, it will also be interpolated. Anything within
* * @see #findText(java.util.ResourceBundle, String, java.util.Locale, String, Object[]) */ @@ -594,13 +617,19 @@ public class LocalizedTextUtil { } /** + *${...}* will be treated as an OGNL expression and evaluated as such. + ** Finds a localized text message for the given key, aTextName, in the specified resource * bundle. - *
+ * + * + ** If a message is found, it will also be interpolated. Anything within
+ * + * + *${...}* will be treated as an OGNL expression and evaluated as such. - ** If a message is not found a WARN log will be logged. + *
* * @param bundle the bundle * @param aTextName the key @@ -614,13 +643,19 @@ public class LocalizedTextUtil { } /** + ** Finds a localized text message for the given key, aTextName, in the specified resource * bundle. - *
+ * + * + ** If a message is found, it will also be interpolated. Anything within
+ * + * + *${...}* will be treated as an OGNL expression and evaluated as such. - ** If a message is not found a WARN log will be logged. + *
* * @param bundle the bundle * @param aTextName the key diff --git a/core/src/main/java/com/opensymphony/xwork2/util/PropertiesReader.java b/core/src/main/java/com/opensymphony/xwork2/util/PropertiesReader.java index a25a679c4..04cb3e715 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/PropertiesReader.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/PropertiesReader.java @@ -21,13 +21,17 @@ import java.util.ArrayList; import java.util.List; /** + ** 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. - *
+ * + * + ** This class was pulled out of Jakarta Commons Configuration and * Jakarta Commons Lang trunk revision 476093 + *
*/ public class PropertiesReader extends LineNumberReader { /** @@ -403,7 +407,7 @@ public class PropertiesReader extends LineNumberReader { /** *Checks if the object is in the given array.
- * + * *The method returns
* * @param array the array to search through @@ -449,11 +453,11 @@ public class PropertiesReader extends LineNumberReader { /** *falseif anullarray is passed in.Unescapes any Java literals found in the
- * + * *Stringto a *Writer.For example, it will turn a sequence of
- * + * *'\'and *'n'into a newline character, unless the'\'* is preceded by another'\'.A
* * @param out thenullstring input has no effect.Writerused to output unescaped characters diff --git a/core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java b/core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java index db1af6d81..fe6f76eee 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/TextParseUtil.java @@ -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)}. * - * + *
* * 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 { /** + ** A parsed value evaluator for {@link TextParseUtil}. It could be supplied by * calling {@link TextParseUtil#translateVariables(char, String, ValueStack, Class, ParsedValueEvaluator)}. + *
* - * - * + ** By supplying this
* - * - * + *ParsedValueEvaluator, the parsed value * (parsed against the value stack) value will be * given toParsedValueEvaluatorto be evaluated before the * translateVariable process goes on. + ** A typical use-case would be to have a custom
* * @author tm_jee - * - * @version $Date$ $Id$ */ public static interface ParsedValueEvaluator { diff --git a/core/src/main/java/com/opensymphony/xwork2/util/XWorkList.java b/core/src/main/java/com/opensymphony/xwork2/util/XWorkList.java index 2a50197a0..fa1f05b16 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/XWorkList.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/XWorkList.java @@ -52,13 +52,17 @@ public class XWorkList extends ArrayList { } /** + *ParseValueEvaluator* to URL Encode the parsed value. + ** 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). - *
+ * + * + ** 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. + *
* * @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 { } /** + ** Appends the specified element to the end of this list. - *
+ * + * + ** This method performs any necessary type conversion. + *
* * @param element element to be appended to this list. * @return true (as per the general contract of Collection.add). @@ -90,13 +98,17 @@ public class XWorkList extends ArrayList { } /** + ** 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.) - *
+ * + * + ** This method performs any necessary type conversion. + *
* * @param collection the elements to be inserted into this list. * @return true if this list changed as a result of the call. @@ -116,14 +128,18 @@ public class XWorkList extends ArrayList { } /** + ** 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. - *
+ * + * + ** 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. + *
* * @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 { } /** + ** Returns the element at the specified position in this list. - *
+ * + * + ** 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. + *
* * @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 { } /** + ** Replaces the element at the specified position in this list with the specified element. - *
+ * + * + ** 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. + *
* * @param index index of element to replace. * @param element element to be stored at the specified position. diff --git a/core/src/main/java/com/opensymphony/xwork2/util/classloader/ReloadingClassLoader.java b/core/src/main/java/com/opensymphony/xwork2/util/classloader/ReloadingClassLoader.java index 55fe34f26..e44e261c9 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/classloader/ReloadingClassLoader.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/classloader/ReloadingClassLoader.java @@ -33,12 +33,16 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** + ** 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. - *
+ * + * + ** class taken from Apache JCI + *
*/ public class ReloadingClassLoader extends ClassLoader { private static final Logger LOG = LogManager.getLogger(ReloadingClassLoader.class); diff --git a/core/src/main/java/com/opensymphony/xwork2/util/finder/ClassFinder.java b/core/src/main/java/com/opensymphony/xwork2/util/finder/ClassFinder.java index 50fde4ae2..a0962648e 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/finder/ClassFinder.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/finder/ClassFinder.java @@ -25,15 +25,24 @@ public interface ClassFinder { boolean isAnnotationPresent(Class extends Annotation> annotation); /** + ** Returns a list of classes that could not be loaded in last invoked findAnnotated* method. - *
+ * + * + ** 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. - *
+ * + * + ** The list returned is unmodifiable. Once obtained, the returned list will be a live view of the * results from the last findAnnotated* method call. - *
+ * + * + ** This method is not thread safe. + *
+ * * @return an unmodifiable live view of classes that could not be loaded in previous findAnnotated* call. */ ListgetClassesNotLoaded(); diff --git a/core/src/main/java/com/opensymphony/xwork2/util/finder/ResourceFinder.java b/core/src/main/java/com/opensymphony/xwork2/util/finder/ResourceFinder.java index c7f9fd170..75368e210 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/finder/ResourceFinder.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/finder/ResourceFinder.java @@ -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 { } /** + * * Returns a list of resources that could not be loaded in the last invoked findAvailable* or * mapAvailable* methods. - *
+ * + * + ** 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. - *
+ * + * + ** The list returned is unmodifiable and the results of this method will change * after each invocation of a findAvailable* or mapAvailable* methods. - *
+ * + * * This method is not thread safe. */ public ListgetResourcesNotLoaded() { @@ -200,24 +205,34 @@ public class ResourceFinder { } /** + * * Reads the contents of all non-directory URLs immediately under the specified * location and returns them in a map keyed by the file name. - *
+ * + * + ** Any URLs that cannot be read will cause an exception to be thrown. - *
+ * + * + ** Example classpath: - *
+ * + * + ** META-INF/serializables/one * META-INF/serializables/two * META-INF/serializables/three * META-INF/serializables/four/foo.txt - * + *+ * + ** 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 + ** * @param uri * @return a list of the content of each resource URL found @@ -236,25 +251,35 @@ public class ResourceFinder { } /** + ** Reads the contents of all non-directory URLs immediately under the specified * location and returns them in a map keyed by the file name. - *
+ * + * + ** Individual URLs that cannot be read are skipped and added to the * list of 'resourcesNotLoaded' - *
+ * + * + ** Example classpath: - *
+ * + * + ** META-INF/serializables/one * META-INF/serializables/two # not readable * META-INF/serializables/three * META-INF/serializables/four/foo.txt - * + *+ * + ** 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 + ** * @param uri * @return a list of the content of each resource URL found @@ -298,10 +323,14 @@ public class ResourceFinder { } /** + ** Executes findAllStrings assuming the strings are * the names of a classes that should be loaded and returned. - *
+ * + * + ** Any URL or class that cannot be loaded will cause an exception to be thrown. + *
* * @param uri * @return @@ -319,11 +348,15 @@ public class ResourceFinder { } /** + ** Executes findAvailableStrings assuming the strings are * the names of a classes that should be loaded and returned. - *
+ * + * + ** Any class that cannot be loaded will be skipped and placed in the * 'resourcesNotLoaded' collection. + *
* * @param uri * @return @@ -345,22 +378,30 @@ public class ResourceFinder { } /** + ** Executes mapAllStrings assuming the value of each entry in the * map is the name of a class that should be loaded. - *
+ * + * + ** Any class that cannot be loaded will be cause an exception to be thrown. - *
+ * + * + ** Example classpath: - *
+ * + ** META-INF/xmlparsers/xerces * META-INF/xmlparsers/crimson - * + *+ ** 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"); + ** * @param uri * @return @@ -380,23 +421,31 @@ public class ResourceFinder { } /** + ** Executes mapAvailableStrings assuming the value of each entry in the * map is the name of a class that should be loaded. - *
+ * + * + ** Any class that cannot be loaded will be skipped and placed in the * 'resourcesNotLoaded' collection. - *
+ * + * + ** Example classpath: - *
+ * + ** META-INF/xmlparsers/xerces * META-INF/xmlparsers/crimson - * + *+ ** 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"); + * * * @param uri * @return @@ -426,20 +475,28 @@ public class ResourceFinder { // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /** + ** - ** 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. - *
+ * + * + ** Any class that cannot be loaded will be cause an exception to be thrown. - *
+ * + * + ** Example classpath: - *
+ * + * + ** META-INF/java.io.InputStream # contains the classname org.acme.AcmeInputStream * META-INF/java.io.OutputStream - * + *+ ** ResourceFinder finder = new ResourceFinder("META-INF/"); * Class clazz = finder.findImplementation(java.io.InputStream.class); * clazz.getName(); // returns "org.acme.AcmeInputStream" - * + ** @param interfase a superclass or interface * @return * @throws IOException if the URL cannot be read @@ -456,23 +513,33 @@ public class ResourceFinder { } /** + ** 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. - *
+ * + * + ** Any class that cannot be loaded or assigned to the specified interface will be cause * an exception to be thrown. - *
+ * + * + ** Example classpath: - *
+ * + * + ** 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 - * + *+ * + ** 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 + ** * @param interfase a superclass or interface * @return @@ -494,24 +561,33 @@ public class ResourceFinder { } /** + ** 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. - *
+ * + * + ** Any class that cannot be loaded or are not assignable to the specified class will be * skipped and placed in the 'resourcesNotLoaded' collection. - *
+ * + * + ** Example classpath: - *
+ * + * + ** 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 - * + *+ * + ** 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 - * + ** @param interfase a superclass or interface * @return * @throws IOException if classLoader.getResources throws an exception @@ -536,23 +612,33 @@ public class ResourceFinder { } /** + ** 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. - *
+ * containing the name of a class that implements or is a subclass of the specified class. + * + * + ** Any class that cannot be loaded or assigned to the specified interface will be cause * an exception to be thrown. - *
+ * + * + ** Example classpath: - *
+ * + * + ** META-INF/java.net.URLStreamHandler/jar * META-INF/java.net.URLStreamHandler/file * META-INF/java.net.URLStreamHandler/http - * + *+ * + ** 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"); + ** * @param interfase a superclass or interface * @return @@ -576,23 +662,33 @@ public class ResourceFinder { } /** + ** 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. - *
+ * containing the name of a class that implements or is a subclass of the specified class. + * + * + ** Any class that cannot be loaded or are not assignable to the specified class will be * skipped and placed in the 'resourcesNotLoaded' collection. - *
+ * + * + ** Example classpath: - *
+ * + * + ** META-INF/java.net.URLStreamHandler/jar * META-INF/java.net.URLStreamHandler/file * META-INF/java.net.URLStreamHandler/http - * + *+ * + ** 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"); + ** * @param interfase a superclass or interface * @return @@ -626,14 +722,22 @@ public class ResourceFinder { // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /** + ** Finds the corresponding resource and reads it in as a properties file - *
+ * + * + ** Example classpath: - *
+ * + * + *> * META-INF/widget.properties - * + *+ * + ** ResourceFinder finder = new ResourceFinder("META-INF/"); * Properties widgetProps = finder.findProperties("widget.properties"); + ** * @param uri * @return @@ -651,18 +755,28 @@ public class ResourceFinder { } /** + ** Finds the corresponding resources and reads them in as a properties files - *
+ * + * + ** Any URL that cannot be read in as a properties file will cause an exception to be thrown. - *
+ * + * + ** Example classpath: - *
+ * + * + ** META-INF/app.properties * META-INF/app.properties * META-INF/app.properties - * + *+ * + ** ResourceFinder finder = new ResourceFinder("META-INF/"); * List* * @param uri * @return @@ -683,19 +797,29 @@ public class ResourceFinder { } /** + *appProps = finder.findAllProperties("app.properties"); + * * Finds the corresponding resources and reads them in as a properties files - *
+ * + * + ** Any URL that cannot be read in as a properties file will be added to the * 'resourcesNotLoaded' collection. - *
+ * + * + ** Example classpath: - *
+ * + * + ** META-INF/app.properties * META-INF/app.properties * META-INF/app.properties - * + *+ * + ** ResourceFinder finder = new ResourceFinder("META-INF/"); * List* * @param uri * @return @@ -721,21 +845,31 @@ public class ResourceFinder { } /** + *appProps = finder.findAvailableProperties("app.properties"); + * * Finds the corresponding resources and reads them in as a properties files - *
+ * + * + ** Any URL that cannot be read in as a properties file will cause an exception to be thrown. - *
+ * + * + ** Example classpath: - *
+ * + * + ** META-INF/jdbcDrivers/oracle.properties * META-INF/jdbcDrivers/mysql.props * META-INF/jdbcDrivers/derby - * + *+ * + ** ResourceFinder finder = new ResourceFinder("META-INF/"); * List* * @param uri * @return @@ -754,22 +888,32 @@ public class ResourceFinder { } /** + *driversList = finder.findAvailableProperties("jdbcDrivers"); * Properties oracleProps = driversList.get("oracle.properties"); * Properties mysqlProps = driversList.get("mysql.props"); * Properties derbyProps = driversList.get("derby"); + * * Finds the corresponding resources and reads them in as a properties files - *
+ * + * + ** Any URL that cannot be read in as a properties file will be added to the * 'resourcesNotLoaded' collection. - *
+ * + * + ** Example classpath: - *
+ * + * + ** META-INF/jdbcDrivers/oracle.properties * META-INF/jdbcDrivers/mysql.props * META-INF/jdbcDrivers/derby - * + *+ * + ** ResourceFinder finder = new ResourceFinder("META-INF/"); * List+ * *driversList = finder.findAvailableProperties("jdbcDrivers"); * Properties oracleProps = driversList.get("oracle.properties"); * Properties mysqlProps = driversList.get("mysql.props"); * Properties derbyProps = driversList.get("derby"); + * * * @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 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 > findPackagesMap(String uri) throws IOException { String basePath = path + uri; diff --git a/core/src/main/java/com/opensymphony/xwork2/util/profiling/ObjectProfiler.java b/core/src/main/java/com/opensymphony/xwork2/util/profiling/ObjectProfiler.java index 743811383..66cc00551 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/profiling/ObjectProfiler.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/profiling/ObjectProfiler.java @@ -37,10 +37,15 @@ import java.lang.reflect.Proxy; public class ObjectProfiler { /** + * * Given a class, and an interface that it implements, return a proxied version of the class that implements * the interface. - *
+ * + * + ** The usual use of this is to profile methods from Factory objects: + *
+ * ** public PersistenceManager getPersistenceManager() * { @@ -53,8 +58,10 @@ public class ObjectProfiler { * return ObjectProfiler.getProfiledObject(PersistenceManager.class, new DefaultPersistenceManager()); * } *- * + * + ** A side effect of this is that you will no longer be able to downcast to DefaultPersistenceManager. This is probably a *good* thing. + *
* * @param interfaceClazz The interface to implement. * @param o The object to proxy diff --git a/core/src/main/java/com/opensymphony/xwork2/util/profiling/UtilTimerStack.java b/core/src/main/java/com/opensymphony/xwork2/util/profiling/UtilTimerStack.java index 7fb7ae2fa..deeaa1c44 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/profiling/UtilTimerStack.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/profiling/UtilTimerStack.java @@ -31,81 +31,86 @@ import org.apache.logging.log4j.Logger; /** - * A timer stack. - * - * - * + *A timer stack.
* - * - * Struts2 profiling aspects involves the following :- + *+ * Struts2 profiling aspects involves the following: + *
+ * *- *
- * + * * - * - * + * + * * - * - * XWork2 profiling aspects involves the following :- + *- ActionContextCleanUp
- *- FreemarkerPageFilter
- *- DispatcherFilter
- *- *
- *- Dispatcher
- *- *
- *- creation of DefaultActionProxy
- *- *
- *- creation of DefaultActionInvocation
- *- *
- *- creation of Action
+ *- ActionContextCleanUp
+ *- FreemarkerPageFilter
+ *- DispatcherFilter + *
*+ *
+ *- Dispatcher + *
+ *+ *
+ *- creation of DefaultActionProxy + *
+ *+ *
+ *- creation of DefaultActionInvocation + *
+ *+ *
+ *- creation of Action
+ *- execution of DefaultActionProxy + *
+ *+ *
+ *- invocation of DefaultActionInvocation + *
+ *+ *
+ *- invocation of Interceptors
+ *- invocation of Action
+ *- invocation of PreResultListener
+ *- invocation of Result
+ *- execution of DefaultActionProxy
- *- *
- *- invocation of DefaultActionInvocation
- *- *
- *- invocation of Interceptors
- *- invocation of Action
- *- invocation of PreResultListener
- *- invocation of Result
- *+ * XWork2 profiling aspects involves the following: + *
+ * *- *
- * + * * - * - * + * + * * - * - * Activating / Deactivating of the profiling feature could be done through:- - * + *- *
- *- creation of DefaultActionProxy
- *- *
- *- creation of DefaultActionInvocation
- *- *
- *- creation of Action
+ *- creation of DefaultActionProxy + *
+ *+ *
- creation of DefaultActionInvocation
+ *+ *
- creation of Action
+ *- execution of DefaultActionProxy
+ *+ *
*- invocation of DefaultActionInvocation + *
+ *+ *
+ *- invocation of Interceptors
+ *- invocation of Action
+ *- invocation of PreResultListener
+ *- invocation of Result
+ *- execution of DefaultActionProxy
- *- *
- *- invocation of DefaultActionInvocation
- *- *
- *- invocation of Interceptors
- *- invocation of Action
- *- invocation of PreResultListener
- *- invocation of Result
- *+ * Activating / Deactivating of the profiling feature could be done through: + *
* - * - * - * - * System properties:- + * + * + * + *System properties:
** * @@ -113,16 +118,16 @@ import org.apache.logging.log4j.Logger; * * *- * + * * - * + ** 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) - *
+ * (tomcat) or using 'java -Dxwork.profile.activate=true -jar start.jar' (jetty) + * * - * - * - * Code :- + * + * + *Code :
** * @@ -130,27 +135,25 @@ import org.apache.logging.log4j.Logger; * * *- * - * - * * - * - * This could be done in a static block, in a Spring bean with lazy-init="false", + *+ * 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. - *
+ * * - * - * - * Parameter:- - * + * + *+ * Parameter: + *
+ * ** * * <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); * * *- * - * + * + * * - * + ** 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. - *
+ * * - * - * - * Warning: + * + *Warning:
+ * * - * + ** Profiling activation through a parameter requires the following: - *
+ * + * **
- * + * * - * - * - * + * * - * + *- Profiling interceptor in interceptor stack
*- dev mode on (struts.devMode=true in struts.properties) *
* 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. - *
+ * + * * - * + * ** * @@ -214,17 +217,17 @@ import org.apache.logging.log4j.Logger; * * *- * + * * - * + ** One could extend the profiling feature provided by Struts2 in their web application as well. - *
+ * * - * + * ** * - * 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; * * *- * + ** or - *
+ * ** * - * String result = UtilTimerStack.profile("purchaseItem: ", + * String result = UtilTimerStack.profile("purchaseItem: ", * new UtilTimerStack.ProfilingBlock- * - * + * + * * - * + *() { * public String doProfiling() { * // do some code - * return "Ok"; + * return "Ok"; * } * }); * * * * 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. - *
- * + * * - * @version $Date$ $Id$ + * */ public class UtilTimerStack { @@ -270,8 +272,8 @@ public class UtilTimerStack { protected static ThreadLocalcurrent = 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 { /** + * * A convenience method that allows
- * - * + * + * + *blockof 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. - ** Example of usage: + *
+ * ** // we need a returning result * String result = UtilTimerStack.profile("purchaseItem: ", @@ -417,7 +422,9 @@ public class UtilTimerStack { * } * }); *+ * * or + * ** // we don't need a returning result * UtilTimerStack.profile("purchaseItem: ", diff --git a/core/src/main/java/com/opensymphony/xwork2/util/reflection/ReflectionContextState.java b/core/src/main/java/com/opensymphony/xwork2/util/reflection/ReflectionContextState.java index 9de464b26..8caa03927 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/reflection/ReflectionContextState.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/reflection/ReflectionContextState.java @@ -87,15 +87,18 @@ public class ReflectionContextState { context.put(XWorkConverter.LAST_BEAN_CLASS_ACCESSED, clazz); } /** + *+ * + ** 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. - * - *
So if the real path is myProp.myMap['myKey'] this would + * + * + *So if the real path is myProp.myMap['myKey'] this would * return myProp.myMap.myKey. - * + *
+ * * @param context */ public static String getCurrentPropertyPath(Mapcontext) { diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java b/core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java index e98f8ee66..2bfac35de 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java @@ -268,12 +268,12 @@ public class AnnotationActionValidatorManager implements ActionValidatorManager /** * This method 'collects' all the validator configurations for a given * action invocation.
- * + * *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!
- * - *Given the following class structure: + * + *
Given the following class structure:
** 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; - *- * - *This method will look for the following config files for Dog: + *
This method will look for the following config files for Dog:
** Animal * Animal-context @@ -295,8 +295,8 @@ public class AnnotationActionValidatorManager implements ActionValidatorManager * QuadrapedImpl-context * Dog * Dog-context - *- * + *Note that the validation rules for Thing is never looked for because no class in the * hierarchy directly implements Thing.
* diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManager.java b/core/src/main/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManager.java index d9d740141..d16afcd02 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManager.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManager.java @@ -32,12 +32,16 @@ import java.util.*; /** + ** This is the entry point into XWork's rule-based validation framework. - *
+ * + * + ** Validation rules are specified in XML configuration files named
* * @author Jason Carreira * @author Mark Woon @@ -127,10 +131,10 @@ public class DefaultActionValidatorManager implements ActionValidatorManager { SetclassName-contextName-validation.xmlwhere * 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). + *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! * - * Given the following class structure: + *
Given the following class structure:
** 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; - *+ *This method will look for the following config files for Dog: + *
This method will look for the following config files for Dog:
** Animal * Animal-context @@ -256,7 +260,7 @@ public class DefaultActionValidatorManager implements ActionValidatorManager { * QuadrapedImpl-context * Dog * Dog-context - *+ *
Note that the validation rules for Thing is never looked for because no class in the * hierarchy directly implements Thing.
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java index 5b2a65c73..a7811e019 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java @@ -28,31 +28,35 @@ import org.apache.logging.log4j.Logger; /** * * + ** 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 ActionClass-validation.xml) 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. + *
* - * This interceptor does nothing if the name of the method being invoked is specified in the excludeMethods + *+ * This interceptor does nothing if the name of the method being invoked is specified in the excludeMethods * parameter. excludeMethods accepts a comma-delimited list of method names. For example, requests to * foo!input.action and foo!back.action will be skipped by this interceptor if you set the * excludeMethods parameter to "input, back". - * - * - * - *
The workflow of the action request does not change due to this interceptor. Rather, - * this interceptor is often used in conjuction with the workflow interceptor. + * * - * - * + *+ * The workflow of the action request does not change due to this interceptor. Rather, + * this interceptor is often used in conjunction with the workflow interceptor. + *
+ * + *
* NOTE: As this method extends off MethodFilterInterceptor, it is capable of
* deciding if it is applicable only to selective methods in the action class. See
* MethodFilterInterceptor for more info.
+ *
Interceptor parameters:
* * * @@ -71,9 +75,7 @@ import org.apache.logging.log4j.Logger; * * * - * Extending the interceptor: - * - * + *Extending the interceptor:
* * * @@ -81,38 +83,38 @@ import org.apache.logging.log4j.Logger; * * * - * Example code: + *Example code:
* ** * - * <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> * * diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/Validator.java b/core/src/main/java/com/opensymphony/xwork2/validator/Validator.java index 1fcab4418..5cff3f8a6 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/Validator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/Validator.java @@ -22,43 +22,41 @@ import com.opensymphony.xwork2.util.ValueStack; * *The validators supplied by the XWork distribution (and any validators you * might write yourself) come in two different flavors:
- * + * **
- * + * *- Plain Validators / Non-Field validators
*- FieldValidators
*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 *
- * + * *syntax described below.) 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 "
- * + *vs. - * syntax" below). syntax" below). + * * There are two places where the differences between the two validator flavors * are important to keep in mind:
- * + * **
- * - *- when choosing the xml syntax used for declaring a validator * (either
*or ) - when using the short-circuit capability
*NOTE:Note that you do not declare what "flavor" of validator you are + * + *
NOTE: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.
* - * - * - * - * + * + * * *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.
- * + * *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:
- * + * **
- * + * *- interface Animal;
*- interface Quadraped extends Animal;
@@ -79,9 +77,9 @@ import com.opensymphony.xwork2.util.ValueStack; *- class QuadrapedImpl extends AnimalImpl implements Quadraped;
*- class Dog extends QuadrapedImpl;
*The framework method will look for the following config files if Dog is to be validated:
- * + * **
- * + * *- Animal
*- Animal-aliasname
@@ -94,20 +92,20 @@ import com.opensymphony.xwork2.util.ValueStack; *- Dog
*- Dog-aliasname
*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. *
- * + * *NOTE: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.
- * + * * - * - * + * + * * *There are two ways you can define validators in your -validation.xml file:
*@@ -115,35 +113,34 @@ import com.opensymphony.xwork2.util.ValueStack; *
*- <field-validator>
*Keep the following in mind when using either syntax:
- * + * *Non-Field-Validator * The <validator> element allows you to declare both types of validators * (either a plain Validator a field-specific FieldValidator).
* - * + * ** * <!-- Declaring a plain Validator using the <validator> syntax: --> - * - * <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> * *- * + * ** * <!-- Declaring a field validator using the <validator> syntax; --> - * - * <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> * *- * - * + * * *field-validator * 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>.
- * + * *HINT: * 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)
- * + * *NOTE: * Note that you should only use FieldValidators (not plain Validators) within a *
* - * + * *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) * * Declaring a FieldValidator using the <field-validator> syntax: - * - * <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> * *- * - * + * + * * *The choice is yours. It's perfectly legal to only use
+ * The following are effectively equal: * - * + * *elements * without the elements and set the fieldName attribute for each of them. - * The following are effectively equal: * - * <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> - * - * - * <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> * *- * - * + * + * * *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.
* - * + * ** <!-- 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 --> *- * + * * *short-circuiting and Validator flavors
*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.
- * + * *In the example above, the actual execution of validator would be as follows:
- * + * **
- * + * *- Plain Validator 1
*- Plain Validator 2
*- Field Validators for email field
*- Field Validators for email2 field
*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.
- * + * *Usefull Information: * 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).
- * + * ** 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. *
* - * - * + * * *Short cuircuiting and validator flavours
*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
* - * + * *or + * "same field" behavior applies regardless of whether the or * syntax was used to declare the validation rule. * By way of example, given this -validation.xml file: * - * <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> - * - * <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> * *- * + * * - *both validators will be run, even if the "required" validator short-circuits. - * "required" validators are FieldValidator's and will not short-circuit the plain + *
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.
* - * - * + * + * * *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; *
* * - * + * * * Validator's validation messages could be internatinalized. For example, *- * <field-validator type="required"> - * <message key="required.field" /> + * <field-validator type="required"> + * <message key="required.field" /> * </field-validator> ** or *- * <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> ** 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. - * + * * 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 :- *- * <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> ** or *- * <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> ** @@ -429,16 +425,16 @@ public interface Validator{ 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 { void setValidatorType(String type); /** - * Gets the vaildator type used (see class javadoc). + * Gets the validator type used (see class javadoc). * * @return the type used */ diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ConditionalVisitorFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ConditionalVisitorFieldValidator.java index 29607ce6e..e60925037 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ConditionalVisitorFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ConditionalVisitorFieldValidator.java @@ -7,23 +7,28 @@ import java.lang.annotation.Target; /** * + * * 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. + *
* + ** 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. + *
+ * * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -84,7 +89,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -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 true. + * Adds the short-circuit='true' attribute value if true. * */ boolean shortCircuit() default false; diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ConversionErrorFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ConversionErrorFieldValidator.java index 9a6fc0a64..2777f7ac6 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ConversionErrorFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ConversionErrorFieldValidator.java @@ -24,16 +24,16 @@ import java.lang.annotation.Target; /** * * This validator checks if there are any conversion errors for a field and applies them if they exist. - * See Type Conversion Error Handling for details. + * See Type Conversion Error Handling for details. * * - * Annotation usage: + *Annotation usage:
* * - * The ConversionErrorFieldValidator annotation must be applied at method level. + *The ConversionErrorFieldValidator annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -82,7 +82,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -91,7 +91,6 @@ import java.lang.annotation.Target; ** * @author Rainer Hermanns - * @version $Id$ */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/CustomValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/CustomValidator.java index 27d63b241..e0305fdde 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/CustomValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/CustomValidator.java @@ -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. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method or type level. + *The annotation must be applied at method or type level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -81,7 +81,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -91,7 +91,6 @@ import java.lang.annotation.Target; * * @author jepjep * @author Rainer Hermanns - * @version $Id$ */ @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/DateRangeFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/DateRangeFieldValidator.java index d6457d547..47900c93f 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/DateRangeFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/DateRangeFieldValidator.java @@ -26,13 +26,13 @@ import java.lang.annotation.Target; * This validator checks that a date field has a value within a specified range. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -119,7 +119,7 @@ import java.lang.annotation.Target; *
If neither min nor max is set, nothing will be done.
* * - * Example code: + *Example code:
* ** @@ -128,7 +128,6 @@ import java.lang.annotation.Target; ** * @author Rainer Hermanns - * @version $Id$ */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/DoubleRangeFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/DoubleRangeFieldValidator.java index 5eb304945..1a5fb3bc9 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/DoubleRangeFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/DoubleRangeFieldValidator.java @@ -27,13 +27,13 @@ import java.lang.annotation.Target; * If neither min nor max is set, nothing will be done. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -134,7 +134,7 @@ import java.lang.annotation.Target; *
The values for min and max must be inserted as String values so that "0" can be handled as a possible value.
* * - * Example code: + *Example code:
* ** @@ -143,7 +143,6 @@ import java.lang.annotation.Target; ** * @author Rainer Hermanns - * @version $Id$ */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/EmailValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/EmailValidator.java index 7b40811c5..ec54c0591 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/EmailValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/EmailValidator.java @@ -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. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -81,7 +81,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -90,7 +90,6 @@ import java.lang.annotation.Target; ** * @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 true. + * Adds the short-circuit='true' attribute value if true. * */ boolean shortCircuit() default false; diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ExpressionValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ExpressionValidator.java index 804938817..7943750d5 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ExpressionValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ExpressionValidator.java @@ -26,13 +26,13 @@ import java.lang.annotation.Target; * This non-field level validator validates a supplied regular expression. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -75,7 +75,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -84,7 +84,6 @@ import java.lang.annotation.Target; ** * @author Rainer Hermanns - * @version $Id$ */ @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.METHOD}) diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java index 5941b0480..83859d4a4 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/FieldExpressionValidator.java @@ -28,13 +28,13 @@ import java.lang.annotation.Target; * false when it is evaluated against the value stack. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -83,7 +83,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -92,7 +92,6 @@ import java.lang.annotation.Target; ** * @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 true. + * Adds the short-circuit='true' attribute value if true. * */ boolean shortCircuit() default false; diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java index cba539eda..daa29c56f 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/IntRangeFieldValidator.java @@ -27,13 +27,13 @@ import java.lang.annotation.Target; * If neither min nor max is set, nothing will be done. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -116,7 +116,7 @@ import java.lang.annotation.Target; *
The values for min and max must be inserted as String values so that "0" can be handled as a possible value.
* * - * Example code: + *Example code:
* ** @@ -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 true. + * Adds the short-circuit='true' attribute value if true. * */ boolean shortCircuit() default false; diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java index 3997916eb..0ef3b184a 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RegexFieldValidator.java @@ -26,13 +26,13 @@ import java.lang.annotation.Target; * Validates a string field using a regular expression. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -87,7 +87,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -96,7 +96,6 @@ import java.lang.annotation.Target; ** * @author Rainer Hermanns - * @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 true. + * Adds the short-circuit='true' attribute value if true. * */ boolean shortCircuit() default false; diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java index 3039d3cbc..c2456e7f8 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredFieldValidator.java @@ -26,13 +26,13 @@ import java.lang.annotation.Target; * This validator checks that a field is non-null. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -81,7 +81,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -91,7 +91,6 @@ import java.lang.annotation.Target; * * * @author Rainer Hermanns - * @version $Id$ */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java index 7fe64ada1..0620ba9cc 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/RequiredStringValidator.java @@ -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). * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -87,7 +87,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ShortRangeFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ShortRangeFieldValidator.java index dfe57ae94..8f9319628 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ShortRangeFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ShortRangeFieldValidator.java @@ -27,13 +27,13 @@ import java.lang.annotation.Target; * If neither min nor max is set, nothing will be done. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -116,7 +116,7 @@ import java.lang.annotation.Target; *
The values for min and max must be inserted as String values so that "0" can be handled as a possible value.
* * - * Example code: + *Example code:
* ** diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java index 6db61751f..87d4b3141 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/StringLengthFieldValidator.java @@ -27,13 +27,13 @@ import java.lang.annotation.Target; * If neither minLength nor maxLength is set, nothing will be done. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -115,7 +115,7 @@ import java.lang.annotation.Target; * * * - * Example code: + *
Example code:
* ** @@ -124,7 +124,6 @@ import java.lang.annotation.Target; ** * @author Rainer Hermanns - * @version $Id$ */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java index 2769b12c5..5688e1fd1 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validation.java @@ -27,13 +27,13 @@ import java.lang.annotation.Target; * is no longer necessary. * * - * Annotation usage: + *Annotation usage:
* * - * The Validation annotation must be applied at Type level. + *The Validation annotation must be applied at Type level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -52,7 +52,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* * An Annotated Interface *@@ -73,7 +73,7 @@ import java.lang.annotation.Target; * ** - * Example code: + *Example code:
* * An Annotated Class *@@ -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) diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java index 1482aed55..81390ccfe 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/ValidationParameter.java @@ -26,13 +26,13 @@ import java.lang.annotation.Target; * The ValidationParameter annotation is used as a parameter for CustomValidators. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must embedded into CustomValidator annotations as a parameter. + *The annotation must embedded into CustomValidator annotations as a parameter.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -57,7 +57,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java index 5d1eceb4b..ee587ad7f 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/Validations.java @@ -26,13 +26,13 @@ import java.lang.annotation.Target; *If you want to use several annotations of the same type, these annotations must be nested within the @Validations() annotation.
* * - * Annotation usage: + *Annotation usage:
* * - * Used at METHOD level. + *Used at METHOD level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -112,7 +112,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -149,7 +149,6 @@ import java.lang.annotation.Target; * * @author jepjep * @author Rainer Hermanns - * @version $Id$ */ @Target( { ElementType.METHOD, ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java index 7d42339e5..6501748e6 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/annotations/VisitorFieldValidator.java @@ -33,13 +33,13 @@ import java.lang.annotation.Target; * by the validations for the Object message. * * - * Annotation usage: + *Annotation usage:
* * - * The annotation must be applied at method level. + *The annotation must be applied at method level.
* * - * Annotation parameters: + *Annotation parameters:
* * *@@ -94,7 +94,7 @@ import java.lang.annotation.Target; *
* * - * Example code: + *Example code:
* ** @@ -103,7 +103,6 @@ import java.lang.annotation.Target; ** * @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 ""; diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/ConversionErrorFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/ConversionErrorFieldValidator.java index 4fe0ea3de..4bfb171fd 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/ConversionErrorFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/ConversionErrorFieldValidator.java @@ -27,7 +27,7 @@ import java.util.Map; * * Field Validator that checks if a conversion error occurred for this field. * - * + * * **
- fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required
@@ -53,8 +53,6 @@ import java.util.Map; * * @author Jason Carreira * @author tm_jee - * - * @version $Date $Id$ */ public class ConversionErrorFieldValidator extends RepopulateConversionErrorFieldValidatorSupport { diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidator.java index 572d30754..cae4a6cf9 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/DateRangeFieldValidator.java @@ -30,8 +30,6 @@ import java.util.Date; * * * - * - * * **
* - * + *- fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required
@@ -84,7 +82,6 @@ import java.util.Date; * * * @author Jason Carreira - * @version $Date$ $Id$ */ public final class DateRangeFieldValidator extends RangeValidatorSupport{ diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/ExpressionValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/ExpressionValidator.java index d7f129b42..6e59af200 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/ExpressionValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/ExpressionValidator.java @@ -21,8 +21,7 @@ import com.opensymphony.xwork2.validator.ValidationException; * * A Non-Field Level validator that validates based on regular expression supplied. * - * - * + * * * *
- expression - the Ognl expression to be evaluated against the stack (Must evaluate to a Boolean)
diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/FieldExpressionValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/FieldExpressionValidator.java index 197314bde..12dd7c575 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/FieldExpressionValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/FieldExpressionValidator.java @@ -22,8 +22,7 @@ import com.opensymphony.xwork2.validator.ValidationException; * * Validates a field using an OGNL expression. * - * - * + * * **
- fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required
@@ -53,10 +52,6 @@ import com.opensymphony.xwork2.validator.ValidationException; * </vaidators> * * - * - * - * @author $Author$ - * @version $Revision$ */ public class FieldExpressionValidator extends FieldValidatorSupport { diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/RepopulateConversionErrorFieldValidatorSupport.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/RepopulateConversionErrorFieldValidatorSupport.java index 6dcb60f7b..af0edf3d4 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/RepopulateConversionErrorFieldValidatorSupport.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/RepopulateConversionErrorFieldValidatorSupport.java @@ -28,33 +28,30 @@ import java.util.LinkedHashMap; import java.util.Map; /** - * - * + ** 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". - * - *
- * + * * * - * + ** 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". + *
* - * - * - * This is typically usefull when one wants to repopulate the field with the original value + *+ * 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. + *
* * - * - * + * ** @@ -130,7 +127,6 @@ import java.util.Map; ** * @author tm_jee - * @version $Date$ $Id$ */ public abstract class RepopulateConversionErrorFieldValidatorSupport extends FieldValidatorSupport { diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/RequiredFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/RequiredFieldValidator.java index 6b103f275..dffd37ac6 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/RequiredFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/RequiredFieldValidator.java @@ -22,16 +22,13 @@ import com.opensymphony.xwork2.validator.ValidationException; * * RequiredFieldValidator checks if the specified field is not null. * - * - * - * + * * **
* - * - * + * *- fieldName - field name if plain-validator syntax is used, not needed if field-validator syntax is used
** * <validators> @@ -57,7 +54,6 @@ import com.opensymphony.xwork2.validator.ValidationException; * * * @author rainerh - * @version $Revision$ */ public class RequiredFieldValidator extends FieldValidatorSupport { diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/RequiredStringValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/RequiredStringValidator.java index 7b2cbfd29..1044aedc1 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/RequiredStringValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/RequiredStringValidator.java @@ -24,7 +24,6 @@ import com.opensymphony.xwork2.validator.ValidationException; * (i.e. it isn't ""). The "trim" parameter determines whether it will {@link String#trim() trim} * the String before performing the length check. If unspecified, the String will be trimmed. * - * * * *@@ -68,7 +67,6 @@ import com.opensymphony.xwork2.validator.ValidationException; * * * @author rainerh - * @version $Date$ $Id$ */ public class RequiredStringValidator extends FieldValidatorSupport { diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/StringLengthFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/StringLengthFieldValidator.java index 47916d025..9d28a55ab 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/StringLengthFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/StringLengthFieldValidator.java @@ -26,9 +26,7 @@ import org.apache.commons.lang3.StringUtils; * characters. The "trim" parameter determines whether it will {@link String#trim() trim} the * String before performing the length check. If unspecified, the String will be trimmed. * - * - * - * + * * *
*
* - * + * * * Do not use ${minLengthExpression}, ${maxLengthExpression} and ${trimExpression} as an expression as this will turn into infinitive loop! * - * + * *- fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required
@@ -40,11 +38,11 @@ import org.apache.commons.lang3.StringUtils; *- trimExpression - (Optional) String. Defines th trim param as an OGNL expression
** * <validators> @@ -83,7 +81,6 @@ import org.apache.commons.lang3.StringUtils; * @author Jason Carreira * @author Mark Woon * @author tmjee - * @version $Date$ $Id$ */ public class StringLengthFieldValidator extends FieldValidatorSupport { diff --git a/core/src/main/java/com/opensymphony/xwork2/validator/validators/VisitorFieldValidator.java b/core/src/main/java/com/opensymphony/xwork2/validator/validators/VisitorFieldValidator.java index e0be5f0de..1a99e4f0c 100644 --- a/core/src/main/java/com/opensymphony/xwork2/validator/validators/VisitorFieldValidator.java +++ b/core/src/main/java/com/opensymphony/xwork2/validator/validators/VisitorFieldValidator.java @@ -28,14 +28,17 @@ import java.util.Collection; /** * + * + ** The VisitorFieldValidator allows you to forward validation to object * properties of your action using the object's own validation 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. The VisitorFieldValidator can handle either simple Object * properties, Collections of Objects, or Arrays. + *
+ * * - * * * *@@ -75,7 +78,6 @@ import java.util.Collection; * * @author Jason Carreira * @author Rainer Hermanns - * @version $Date$ $Id$ */ public class VisitorFieldValidator extends FieldValidatorSupport { diff --git a/core/src/main/java/org/apache/struts2/StrutsStatics.java b/core/src/main/java/org/apache/struts2/StrutsStatics.java index af5796efe..d204f5273 100644 --- a/core/src/main/java/org/apache/struts2/StrutsStatics.java +++ b/core/src/main/java/org/apache/struts2/StrutsStatics.java @@ -23,19 +23,22 @@ package org.apache.struts2; /** + *
* Constants used by Struts. The constants can be used to get or set objects * out of the action context or other collections. + *
* - * - * + ** Example: - *
- * + * + *
ActionContext.getContext().put(HTTP_REQUEST, request);ActionContext.getContext().put(HTTP_REQUEST, request);+ * * or - * - *+ * HttpServletRequest request = (HttpServletRequest)context.get(HTTP_REQUEST); + * */ public interface StrutsStatics { diff --git a/core/src/main/java/org/apache/struts2/components/ActionError.java b/core/src/main/java/org/apache/struts2/components/ActionError.java index d00533322..4ce34a3af 100644 --- a/core/src/main/java/org/apache/struts2/components/ActionError.java +++ b/core/src/main/java/org/apache/struts2/components/ActionError.java @@ -40,7 +40,7 @@ import java.util.List; * * * - * Examples + *
+ * + ** ActionContext context = ActionContext.getContext();
- * HttpServletRequest request = (HttpServletRequest)context.get(HTTP_REQUEST);Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/ActionMessage.java b/core/src/main/java/org/apache/struts2/components/ActionMessage.java index 10ba59f16..c62dd5db9 100644 --- a/core/src/main/java/org/apache/struts2/components/ActionMessage.java +++ b/core/src/main/java/org/apache/struts2/components/ActionMessage.java @@ -40,7 +40,7 @@ import java.util.List; * * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/Anchor.java b/core/src/main/java/org/apache/struts2/components/Anchor.java index 5819294f5..118ae6f02 100644 --- a/core/src/main/java/org/apache/struts2/components/Anchor.java +++ b/core/src/main/java/org/apache/struts2/components/Anchor.java @@ -39,13 +39,14 @@ import java.util.Map; /** * - * + ** A tag that creates a HTML <a >.This tag supports the same attributes as the "url" tag, - * including nested parameters using the "param" tag.
+ * including nested parameters using the "param" tag. + * * - * - * Examples - * + * + *Examples
+ * ** * <s:a id="link1" href="/do-it.action"> diff --git a/core/src/main/java/org/apache/struts2/components/Bean.java b/core/src/main/java/org/apache/struts2/components/Bean.java index 2039d95c8..bb0b913ff 100644 --- a/core/src/main/java/org/apache/struts2/components/Bean.java +++ b/core/src/main/java/org/apache/struts2/components/Bean.java @@ -36,10 +36,10 @@ import java.io.Writer; * *Instantiates a class that conforms to the JavaBeans specification. This tag has a body which can contain * a number of {@link Param} elements to set any mutator methods on that class.
- * + * *If the var attribute is set on the BeanTag, it will place the instantiated bean into the * stack's Context.
- * + * * * * @@ -52,7 +52,7 @@ import java.io.Writer; * * *Examples:
- * + * ** * <-- in freemarker form --> @@ -68,16 +68,16 @@ import java.io.Writer; * </s:bean> * *- * + * * * *This example instantiates a bean called SimpleCounter and sets the foo property (setFoo('BAR')). The * SimpleCounter object is then pushed onto the Valuestack, which means that we can call its accessor methods (getFoo()) * with the Property tag and get their values.
- * + * *In the above example, the id has been set to a value of counter. This means that the SimpleCounter class * will be placed into the stack's context. You can access the SimpleCounter class using a Struts tag:
- * + * ** <-- jsp form --> * <s:property value="#counter" /> @@ -85,7 +85,7 @@ import java.io.Writer; * <-- freemarker form --> * [s:property value="#counter.foo"/] *- * + * *In the property tag example, the # tells Ognl to search the context for the SimpleCounter class which has * an id(key) of counter
* diff --git a/core/src/main/java/org/apache/struts2/components/Checkbox.java b/core/src/main/java/org/apache/struts2/components/Checkbox.java index e1765b295..a9f0fdc6b 100644 --- a/core/src/main/java/org/apache/struts2/components/Checkbox.java +++ b/core/src/main/java/org/apache/struts2/components/Checkbox.java @@ -34,7 +34,7 @@ import com.opensymphony.xwork2.util.ValueStack; * Renders an HTML input element of type checkbox, populated by the specified property from the ValueStack. * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/CheckboxList.java b/core/src/main/java/org/apache/struts2/components/CheckboxList.java index e83c8beb8..fde403789 100644 --- a/core/src/main/java/org/apache/struts2/components/CheckboxList.java +++ b/core/src/main/java/org/apache/struts2/components/CheckboxList.java @@ -36,7 +36,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/ComboBox.java b/core/src/main/java/org/apache/struts2/components/ComboBox.java index d7ac8dccb..99ae38dd7 100644 --- a/core/src/main/java/org/apache/struts2/components/ComboBox.java +++ b/core/src/main/java/org/apache/struts2/components/ComboBox.java @@ -34,21 +34,27 @@ import java.util.Map; /** * + ** The combo box is basically an HTML INPUT of type text and HTML SELECT grouped together to give you a combo box * functionality. You can place text in the INPUT control by using the SELECT control or type it in directly in - * the text field.
+ * the text field. + * * + ** In this example, the SELECT will be populated from id=year attribute. Counter is itself an Iterator. It will * span from first to last. The population is done via javascript, and requires that this tag be surrounded by a - * <form>.
+ * <form>. + * * + ** Note that unlike the <s:select/> tag, there is no ability to define the individual <option> tags' id attribute * or content separately. Each of these is simply populated from the toString() method of the list item. Presumably * this is because the select box isn't intended to actually submit useful data, but to assist the user in filling - * out the text field.
+ * out the text field. + * * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/Component.java b/core/src/main/java/org/apache/struts2/components/Component.java index b34178dbf..2fd8c1419 100644 --- a/core/src/main/java/org/apache/struts2/components/Component.java +++ b/core/src/main/java/org/apache/struts2/components/Component.java @@ -51,8 +51,8 @@ import java.util.concurrent.ConcurrentMap; /** * Base class to extend for UI components. - * - * This class is a good extension point when building reuseable UI components. + *
+ * This class is a good extension point when building reusable UI components. * */ public class Component { @@ -116,8 +116,8 @@ public class Component { this.urlHelper = urlHelper; } /** - * Gets the OGNL value stack assoicated with this component. - * @return the OGNL value stack assoicated with this component. + * Gets the OGNL value stack associated with this component. + * @return the OGNL value stack associated with this component. */ public ValueStack getStack() { return stack; @@ -150,7 +150,7 @@ public class Component { /** * Callback for the end tag of this component. * Should the body be evaluated again? - * + *
* NOTE: will pop component stack. * @param writer the output writer. * @param body the rendered body. @@ -163,7 +163,7 @@ public class Component { /** * Callback for the start tag of this component. * Should the body be evaluated again? - * + *
* NOTE: has a parameter to determine to pop the component stack. * @param writer the output writer. * @param body the rendered body. @@ -225,7 +225,7 @@ public class Component { /** * Evaluates the OGNL stack to find a String value. - * + *
* If the given expression is null a error is logged and aRuntimeExceptionis thrown * constructed with a messaged based on the given field and errorMsg parameter. * @@ -245,7 +245,7 @@ public class Component { /** * Constructs aRuntimeExceptionbased on the given information. - * + *
* A message is constructed and logged at ERROR level before being returned * as aRuntimeException. * @param field field name used when throwingRuntimeException. @@ -290,7 +290,7 @@ public class Component { /** * Is the altSyntax enabled? [TRUE] - * + *
* Seestruts.propertieswhere the altSyntax flag is defined. */ public boolean altSyntax() { @@ -324,12 +324,16 @@ public class Component { } /** + ** Evaluates the OGNL stack to find an Object value. - *
+ * + * + ** Function just like
* * @param expr OGNL expression. * @param field field name used when throwingfindValue(String)except that if the * given expression is null a error is logged and * aRuntimeExceptionis thrown constructed with a - * messaged based on the given field and errorMsg paramter. + * messaged based on the given field and errorMsg parameter. + *RuntimeException. @@ -362,7 +366,7 @@ public class Component { *exprthe portion wrapped with altSyntax (%{...}) * against stack when altSyntax is on, else the wholeexpr* is evaluated against the stack. - * + *
* This method only supports the altSyntax. So this should be set to true. * @param expr OGNL expression. * @param toType the type expected to find. @@ -490,7 +494,7 @@ public class Component { /** * Adds the given key and value to this component's own parameter. - * + *
* If the provided key is null nothing happens. * If the provided value is null any existing parameter with * the given key name is removed. diff --git a/core/src/main/java/org/apache/struts2/components/Date.java b/core/src/main/java/org/apache/struts2/components/Date.java index cedb6af5d..befc1eb4e 100644 --- a/core/src/main/java/org/apache/struts2/components/Date.java +++ b/core/src/main/java/org/apache/struts2/components/Date.java @@ -61,12 +61,12 @@ import java.util.TimeZone; *- format
*
* * Following how the date component will work, depending on the value of nice attribute * (which by default is false) and the format attribute. * - * + *
* * Condition 1: With nice attribute as true *@@ -104,12 +104,12 @@ import java.util.TimeZone; * *
* - * + *
* * Condition 2: With nice attribute as false and format attribute is specified eg. dd/MM/yyyyy *In this case the format attribute will be used.
* - * + *
* * Condition 3: With nice attribute as false and no format attribute is specified *@@ -126,7 +126,7 @@ import java.util.TimeZone; * * * - * Examples + *
Examples
** * <s:date name="person.birthday" format="dd/MM/yyyy" /> @@ -208,8 +208,8 @@ public class Date extends ContextBean { } /** - * Calculates the difference in time from now to the given date, and outputs it nicely. An example:
Now = - * 2006/03/12 13:38:00, date = 2006/03/12 15:50:00 will output "in 1 hour, 12 minutes". + * Calculates the difference in time from now to the given date, and outputs it nicely.
An example:
+ * Now = 2006/03/12 13:38:00, date = 2006/03/12 15:50:00 will output "in 1 hour, 12 minutes". * * @param tp text provider * @param date the date diff --git a/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java b/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java index f6b4b8dec..22e53fae6 100644 --- a/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java +++ b/core/src/main/java/org/apache/struts2/components/DoubleListUIBean.java @@ -29,15 +29,16 @@ import javax.servlet.http.HttpServletResponse; import java.util.Map; /** + ** DoubleListUIBean is the standard superclass of all Struts double list handling components. - * - *
+ * * * - * + ** Note that the doublelistkey and doublelistvalue attribute will default to "key" and "value" * respectively only when the doublelist attribute is evaluated to a Map or its decendant. * Other thing else, will result in doublelistkey and doublelistvalue to be null and not used. + *
* * * diff --git a/core/src/main/java/org/apache/struts2/components/DoubleSelect.java b/core/src/main/java/org/apache/struts2/components/DoubleSelect.java index 4b0e1ce30..539d3aef2 100644 --- a/core/src/main/java/org/apache/struts2/components/DoubleSelect.java +++ b/core/src/main/java/org/apache/struts2/components/DoubleSelect.java @@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletResponse; * Renders two HTML select elements with second one changing displayed values depending on selected entry of first one. * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/FieldError.java b/core/src/main/java/org/apache/struts2/components/FieldError.java index 581ca460a..809253a8a 100644 --- a/core/src/main/java/org/apache/struts2/components/FieldError.java +++ b/core/src/main/java/org/apache/struts2/components/FieldError.java @@ -39,7 +39,7 @@ import java.util.List; * * * - * Examples + *Examples
* ** @@ -74,14 +74,13 @@ import java.util.List; ** * - * Description - * + *Description
* ** * - * Example 1: display all field errors - * Example 2: display field errors only for 'field1' and 'field2' + * Example 1: display all field errorsdiff --git a/core/src/main/java/org/apache/struts2/components/File.java b/core/src/main/java/org/apache/struts2/components/File.java index d98df908b..752c31c82 100644 --- a/core/src/main/java/org/apache/struts2/components/File.java +++ b/core/src/main/java/org/apache/struts2/components/File.java @@ -35,7 +35,7 @@ import javax.servlet.http.HttpServletResponse; * Renders an HTML file input element. * * - * Examples + *
+ * Example 2: display field errors only for 'field1' and 'field2'
* * *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/Form.java b/core/src/main/java/org/apache/struts2/components/Form.java index 5e85adfdd..69ad61e47 100644 --- a/core/src/main/java/org/apache/struts2/components/Form.java +++ b/core/src/main/java/org/apache/struts2/components/Form.java @@ -46,14 +46,19 @@ import java.util.Set; /** * - * - * Renders HTML an input form. - * + *+ * Renders HTML an input form. + *
+ * + ** The remote form allows the form to be submitted without the page being refreshed. The results from the form - * can be inserted into any HTML element on the page.
- * - * NOTE: - * The order / logic in determining the posting url of the generated HTML form is as follows:- + * can be inserted into any HTML element on the page. + * + *+ * NOTE:
+ * *
+ * The order / logic in determining the posting url of the generated HTML form is as follows: + **
- * + * * - * - * Examples - * + * + *- * If the action attribute is not specified, then the current request will be used to @@ -61,7 +66,7 @@ import java.util.Set; *
*- * If the action is given, Struts will try to obtain an ActionConfig. This will be - * successfull if the action attribute is a valid action alias defined struts.xml. + * successful if the action attribute is a valid action alias defined struts.xml. *
*- * If the action is given and is not an action alias defined in struts.xml, Struts @@ -69,16 +74,16 @@ import java.util.Set; * from it and using UrlHelper to generate the final url. *
*Examples
+ * ** - * + * * <s:form ... /> - * + * * ** diff --git a/core/src/main/java/org/apache/struts2/components/GenericUIBean.java b/core/src/main/java/org/apache/struts2/components/GenericUIBean.java index 9521e1f7b..53cbef0b5 100644 --- a/core/src/main/java/org/apache/struts2/components/GenericUIBean.java +++ b/core/src/main/java/org/apache/struts2/components/GenericUIBean.java @@ -31,41 +31,50 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * + ** Renders an custom UI widget using the specified templates. Additional objects can be passed in to the template - * using the param tags.
+ * using the param tags. + * * - * Freemarker: - * Objects provided can be retrieve from within the template via $parameters._paramname_. - * - * Jsp: - * Objects provided can be retrieve from within the template via <s:property value="%{parameters._paramname_}" /> + *Freemarker:
+ *Objects provided can be retrieve from within the template via $parameters._paramname_.* + *JSP:
+ *Objects provided can be retrieve from within the template via <s:property value="%{parameters._paramname_}" />* + ** In the bottom JSP and Velocity samples, two parameters are being passed in to the component. From within the - * component, they can be accessed as:-
+ * component, they can be accessed as: + * * - * Freemarker: - * $parameters.get('key1') and $parameters.get('key2') or $parameters.key1 and $parameters.key2 + *Freemarker:
+ *$parameters.get('key1') and $parameters.get('key2') or $parameters.key1 and $parameters.key2* - * Jsp: + *JSP:
+ ** <s:property value="%{parameters.key1}" /> and <s:property value="%{'parameters.key2'}" /> or - * <s:property value="%{parameters.get('key1')}" /> and <s:property value="%{parameters.get('key2')}" /> + * <s:property value="%{parameters.get('key1')}" /> and <s:property value="%{parameters.get('key2')}" /> + ** + ** Currently, your custom UI components can be written in Velocity, JSP, or Freemarker, and the correct rendering - * engine will be found based on file extension.
+ * engine will be found based on file extension. + * * + ** Remember: the value params will always be resolved against the ValueStack so if you mean to pass a * string literal to your component, make sure to wrap it in single quotes i.e. value="'value1'" (note the opening "' and closing '" otherwise, the the value - * stack will search for an Object on the stack with a method of getValue1().
- * + * stack will search for an Object on the stack with a method of getValue1(). + * * * - * Examples + *Examples
* - ** + ** JSP + *
+ ** <s:component template="/my/custom/component.vm"/> * * or @@ -74,8 +83,12 @@ import com.opensymphony.xwork2.util.ValueStack; * <s:param name="key1" value="value1"/> * <s:param name="key2" value="value2"/> * </s:component> + ** + ** Velocity + *
+ ** #s-component( "template=/my/custom/component.vm" ) * * or @@ -84,8 +97,12 @@ import com.opensymphony.xwork2.util.ValueStack; * #s-param( "name=key1" "value=value1" ) * #s-param( "name=key2" "value=value2" ) * #end + ** + ** Freemarker + *
+ ** <@s..component template="/my/custom/component.ftl" /> * * or @@ -96,10 +113,8 @@ import com.opensymphony.xwork2.util.ValueStack; * </@s..component> * * - *- * - * * + ** NOTE: * * @@ -108,7 +123,7 @@ import com.opensymphony.xwork2.util.ValueStack; * could not be picked up from the classpath. * * - * + *
*/ @StrutsTag(name="component", tldTagClass="org.apache.struts2.views.jsp.ui.ComponentTag", description="Render a custom ui widget") public class GenericUIBean extends UIBean { diff --git a/core/src/main/java/org/apache/struts2/components/Head.java b/core/src/main/java/org/apache/struts2/components/Head.java index 756799cfb..2cc4710a3 100644 --- a/core/src/main/java/org/apache/struts2/components/Head.java +++ b/core/src/main/java/org/apache/struts2/components/Head.java @@ -35,7 +35,7 @@ import javax.servlet.http.HttpServletResponse; * Renders parts of the HEAD section for an HTML file. Encoding can be set using this tag. * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/Hidden.java b/core/src/main/java/org/apache/struts2/components/Hidden.java index b51334060..9a85d9067 100644 --- a/core/src/main/java/org/apache/struts2/components/Hidden.java +++ b/core/src/main/java/org/apache/struts2/components/Hidden.java @@ -33,7 +33,7 @@ import com.opensymphony.xwork2.util.ValueStack; * Renders an HTML input element of type hidden, populated by the specified property from the ValueStack. * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/I18n.java b/core/src/main/java/org/apache/struts2/components/I18n.java index 651fd5af4..4db0e077c 100644 --- a/core/src/main/java/org/apache/struts2/components/I18n.java +++ b/core/src/main/java/org/apache/struts2/components/I18n.java @@ -48,8 +48,6 @@ import java.util.ResourceBundle; * * * - * - * * * *@@ -58,9 +56,9 @@ import java.util.ResourceBundle; * * * - * - * + *
* Example: + *
* ** diff --git a/core/src/main/java/org/apache/struts2/components/Include.java b/core/src/main/java/org/apache/struts2/components/Include.java index 298829c07..37e9c430a 100644 --- a/core/src/main/java/org/apache/struts2/components/Include.java +++ b/core/src/main/java/org/apache/struts2/components/Include.java @@ -60,7 +60,7 @@ import java.util.*; * * * - * Examples + *Examples
** * <-- One: --> @@ -313,15 +313,19 @@ public class Include extends Component { /** + ** Simple wrapper to HTTPServletResponse that will allow getWriter() * and getResponse() to be called as many times as needed without * causing conflicts. - *
+ * + ** The underlying outputStream is a wrapper around * {@link PageOutputStream} which will store * the written content to a buffer. - *
+ * + ** This buffer can later be retrieved by calling {@link #getContent}. + *
* * @author Joe Walnes * @author Scott Farquhar diff --git a/core/src/main/java/org/apache/struts2/components/InputTransferSelect.java b/core/src/main/java/org/apache/struts2/components/InputTransferSelect.java index c137ec8f3..c4012004d 100644 --- a/core/src/main/java/org/apache/struts2/components/InputTransferSelect.java +++ b/core/src/main/java/org/apache/struts2/components/InputTransferSelect.java @@ -35,28 +35,23 @@ import java.util.Map; /** * - * + ** Create a input transfer select component which is basically an text input * and <select ...> tag with buttons in the middle of them allowing text * to be added to the transfer select. Will auto-select all its * elements upon its containing form submission. - * + *
* * - * - * - * * - * + ** NOTE: The id and doubleId need not be supplied as they will generated provided * that the inputtransferselect tag is being used in a form tag. The generated id * and doubleId will be <form_id>_<inputtransferselect_doubleName> and * <form_id>_<inputtransferselect_doubleName> respectively. - * + *
* * - * - * ** * diff --git a/core/src/main/java/org/apache/struts2/components/IteratorComponent.java b/core/src/main/java/org/apache/struts2/components/IteratorComponent.java index 9ca073d1b..b62424fa8 100644 --- a/core/src/main/java/org/apache/struts2/components/IteratorComponent.java +++ b/core/src/main/java/org/apache/struts2/components/IteratorComponent.java @@ -38,7 +38,9 @@ import java.util.List; * * *- *Iterator will iterate over a value. An iterable value can be any of: java.util.Collection, java.util.Iterator, - * java.util.Enumeration, java.util.Map, or an array.
+ * java.util.Enumeration, java.util.Map, or an array. + * + * * * * @@ -96,12 +98,12 @@ import java.util.List; * <s:param name="day" value="'foo'"/> * <s:param name="day" value="'bar'"/> * </s:bean> - * + * * <table border="0" cellspacing="0" cellpadding="1"> * <tr> * <th>Days of the week</th> * </tr> - * + * * <s:iterator value="#it.days" status="rowstatus"> * <tr> * <s:if test="#rowstatus.odd == true"> @@ -142,11 +144,10 @@ import java.util.List; * * ** * * - *
The next example iterates over a an action collection and passes every iterator value to another action. The + *The next example iterates over a an action collection and passes every iterator value to another action. The * trick here lies in the use of the '[0]' operator. It takes the current iterator value and passes it on to the edit * action. Using the '[0]' operator has the same effect as using <s:property />. (The latter, however, does not * work from inside the param tag).
@@ -172,7 +173,7 @@ import java.util.List; * * * - * A loop that iterates 5 times + *A loop that iterates 5 times
* * * @@ -189,10 +190,10 @@ import java.util.List; * * * - * Another way to create a simple loop, similar to JSTL's + *Another way to create a simple loop, similar to JSTL's * <c:forEach begin="..." end="..." ...> is to use some * OGNL magic, which provides some under-the-covers magic to - * make 0-n loops trivial. This example also loops five times. + * make 0-n loops trivial. This example also loops five times.
* * * @@ -208,7 +209,7 @@ import java.util.List; * * * - * A loop that iterates over a partial list + *A loop that iterates over a partial list
* * * diff --git a/core/src/main/java/org/apache/struts2/components/Label.java b/core/src/main/java/org/apache/struts2/components/Label.java index 9a162f71e..d0e9f39d2 100644 --- a/core/src/main/java/org/apache/struts2/components/Label.java +++ b/core/src/main/java/org/apache/struts2/components/Label.java @@ -36,12 +36,12 @@ import com.opensymphony.xwork2.util.ValueStack; * the rest of your UI controls. * * - * Examples - * + *Examples
+ * * - * In this example, a label is rendered. The label is retrieved from a ResourceBundle via the key attribute + *In this example, a label is rendered. The label is retrieved from a ResourceBundle via the key attribute * giving you an output of 'User Name: Ford.Prefect'. Assuming that i18n message userName corresponds - * to 'User Name' and the action's getUserName() method returns 'Ford.Prefect'
+ * to 'User Name' and the action's getUserName() method returns 'Ford.Prefect' * ** diff --git a/core/src/main/java/org/apache/struts2/components/ListUIBean.java b/core/src/main/java/org/apache/struts2/components/ListUIBean.java index cd113264d..94be9d19c 100644 --- a/core/src/main/java/org/apache/struts2/components/ListUIBean.java +++ b/core/src/main/java/org/apache/struts2/components/ListUIBean.java @@ -34,16 +34,17 @@ import java.util.Collection; import java.util.Map; /** + ** DoubleListUIBean is the standard superclass of all Struts list handling components. - *
- * - * + * + * + * * - * + ** Note that the listkey and listvalue attribute will default to "key" and "value" * respectively only when the list attribute is evaluated to a Map or its decendant. * Everything else will result in listkey and listvalue to be null and not used. - *
+ * * */ public abstract class ListUIBean extends UIBean { diff --git a/core/src/main/java/org/apache/struts2/components/Number.java b/core/src/main/java/org/apache/struts2/components/Number.java index 400ade82a..a52bff228 100644 --- a/core/src/main/java/org/apache/struts2/components/Number.java +++ b/core/src/main/java/org/apache/struts2/components/Number.java @@ -38,23 +38,32 @@ import java.util.Currency; /** * - * + ** Format Number object in different ways. + *
+ * ** The number tag will allow you to format a Number in a quick and easy way, * based on the java.text.NumberFormat class. There are four basic number types, * a number, a currency, a percentage and an integer. If a currency is * specified, the number format will match the given currency. Further * parameters can be overridden as needed. - *
+ * + * + ** If a type is not defined, it will finally fall back to the default * NumberFormat.getNumberInstance() formatting. - *
+ * + * + ** Note: If the requested Number object isn't found on the stack, a blank * will be returned. *
- * - * Configurable attributes are :- + * + *+ * Configurable attributes are: + *
+ * **
- * - * - * - * Possible values for rounding mode are :- + * + * + *- name
*- currency - you can specify your own currency or as an OGNL expression
@@ -67,10 +76,12 @@ import java.util.Currency; *- parseIntegerOnly - see NumberFormat.isParseIntegerOnly
*- roundingMode - see below
*+ * Possible values for rounding mode are: + *
+ * **
- * - * - * + * * - * - * - * Examples - * + * + *- ceiling
*- down
@@ -81,14 +92,11 @@ import java.util.Currency; *- unnecessary
*- up
*Examples
+ * ** <!-- START SNIPPET: example --> * <s:number name="invoice.total" type="currency" currency="XYZ" /> @@ -97,8 +105,10 @@ import java.util.Currency; * <s:number name="invoice.terms" type="integer" /> * <!-- END SNIPPET: example --> *- * + * + **
*/ @StrutsTag(name = "number", tldBodyContent = "empty", tldTagClass = "org.apache.struts2.views.jsp.NumberTag", description = "Render a formatted number.") public class Number extends ContextBean { diff --git a/core/src/main/java/org/apache/struts2/components/OptGroup.java b/core/src/main/java/org/apache/struts2/components/OptGroup.java index d3e4d7708..1be09e0ab 100644 --- a/core/src/main/java/org/apache/struts2/components/OptGroup.java +++ b/core/src/main/java/org/apache/struts2/components/OptGroup.java @@ -39,21 +39,18 @@ import org.apache.logging.log4j.LogManager; /** * - * + *Number+ ** Create a optgroup component which needs to resides within a select tag. - * + *
* * - * - * * - * + ** This component is to be used within a Select component. + *
* * * - * - * ** * diff --git a/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java b/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java index c704817ab..091dd64cc 100644 --- a/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java +++ b/core/src/main/java/org/apache/struts2/components/OptionTransferSelect.java @@ -35,28 +35,24 @@ import java.util.Map; /** * - * + ** Create a option transfer select component which is basically two <select ...> * tag with buttons in the middle of them allowing options in each of the * <select ...> to be moved between themselves. Will auto-select all its * elements upon its containing form submision. - * + *
* * - * - * - * * - * + ** NOTE: The id and doubleId need not be supplied as they will generated provided * that the optiontransferselect tag is being used in a form tag. The generated id * and doubleId will be <form_id>_<optiontransferselect_nameame> and * <form_id>_<optiontransferselect_doubleName> respectively. + *
* * * - * - * ** * diff --git a/core/src/main/java/org/apache/struts2/components/Param.java b/core/src/main/java/org/apache/struts2/components/Param.java index 09178b44f..a71cd6421 100644 --- a/core/src/main/java/org/apache/struts2/components/Param.java +++ b/core/src/main/java/org/apache/struts2/components/Param.java @@ -31,16 +31,21 @@ import java.io.Writer; /** * - *This tag can be used to parameterize other tags.
+ *This tag can be used to parameterize other tags.
+ * + * + *
* The include tag and bean tag are examples of such tags. - ** The parameters can be added with or without a name as key. * If the tag provides a name attribute the parameters are added using the * {@link Component#addParameter(String, Object) addParamter} method. * For unnamed parameters the Tag must implement the {@link UnnamedParametric} interface defined in * this class (e.g. The TextTag does this). - *
+ * + * + ** This tag has the following two paramters. + *
* **
* - * + *- name (String) - the name of the parameter
@@ -48,7 +53,7 @@ import java.io.Writer; *- suppressEmptyParameters (boolean) - whether to suppress empty parameters
** Note: * When you declare the param tag, the value can be defined in either a value attribute or * as text between the start and end tag. Struts behaves a bit different according to these two situations. @@ -58,9 +63,10 @@ import java.io.Writer; *
* * - * Examples + *
In the first situation (A) the value would be evaluated to the stack as a java.lang.String object. * And in situation (B) the value would be evaluated to the stack as a java.lang.Object object. *
For more information see WW-808. + *Examples
* ** <ui:component> @@ -69,8 +75,11 @@ import java.io.Writer; * <ui:param name="context" value="[2]"/> * </ui:component> *- * + * + ** Whether to suppress empty parameters: + *
+ * ** <s:a action="eventAdd" accesskey="a"> * <s:text name="title.heading.eventadd" /> @@ -81,13 +90,15 @@ import java.io.Writer; * </s:a> ** - * + ** * where the key will be the identifier and the value the result of an OGNL expression run against the current * ValueStack. * - *
+ * + ** This second example demonstrates how the text tag can use parameters from this param tag. + *
* ** <s:text name="cart.total.cost"> @@ -95,7 +106,7 @@ import java.io.Writer; * </s:text> ** - * + * * * @see Include * @see Bean @@ -165,10 +176,13 @@ public class Param extends Component { } /** + ** Tags can implement this to support nested param tags without the name attribute. - *
+ * + ** The {@link Text TextTag} uses this approach. For unnamed parameters an example is given in the class * javadoc for {@link Param ParamTag}. + *
*/ public interface UnnamedParametric { diff --git a/core/src/main/java/org/apache/struts2/components/Password.java b/core/src/main/java/org/apache/struts2/components/Password.java index 47dc3dd37..3f54b2971 100644 --- a/core/src/main/java/org/apache/struts2/components/Password.java +++ b/core/src/main/java/org/apache/struts2/components/Password.java @@ -31,14 +31,16 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * Render an HTML input tag of type password. + *Render an HTML input tag of type password.
* * - * Examples - * + *Examples
+ * * + ** In this example, a password control is displayed. For the label, we are calling ActionSupport's getText() to - * retrieve password label from a resource bundle.
+ * retrieve password label from a resource bundle. + * * ** diff --git a/core/src/main/java/org/apache/struts2/components/Property.java b/core/src/main/java/org/apache/struts2/components/Property.java index e0961a944..3a34b5b16 100644 --- a/core/src/main/java/org/apache/struts2/components/Property.java +++ b/core/src/main/java/org/apache/struts2/components/Property.java @@ -33,15 +33,12 @@ import java.io.Writer; /** * - * + ** Used to get the property of a value, which will default to the top of * the stack if none is specified. - * + *
* * - * - * - * * * *@@ -69,10 +66,10 @@ import java.io.Writer; * *
* - * + ** diff --git a/core/src/main/java/org/apache/struts2/components/Push.java b/core/src/main/java/org/apache/struts2/components/Push.java index d9ea583bf..f5f428ba2 100644 --- a/core/src/main/java/org/apache/struts2/components/Push.java +++ b/core/src/main/java/org/apache/struts2/components/Push.java @@ -40,7 +40,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * * - * Examples + ** Example 1 prints the result of myBean's getMyBeanProperty() method. * Example 2 prints the result of myBean's getMyBeanProperty() method and if it is null, print 'a default value' instead. - * + *
* *Examples
** * <s:push value="user"> diff --git a/core/src/main/java/org/apache/struts2/components/Radio.java b/core/src/main/java/org/apache/struts2/components/Radio.java index 4d1a7451c..bc46882a0 100644 --- a/core/src/main/java/org/apache/struts2/components/Radio.java +++ b/core/src/main/java/org/apache/struts2/components/Radio.java @@ -30,18 +30,19 @@ import javax.servlet.http.HttpServletResponse; /** * - * Render a radio button input field. + *Render a radio button input field.
* * - * Examples - * + *Examples
+ ** * In this example, a radio control is displayed with a list of genders. The gender list is built from attribute * id=genders. The framework calls getGenders() which will return a Map. For examples using listKey and listValue attributes, * see the section select tag. The default selected one will be determined (in this case) by the getMale() method - * in the action class which should retun a value similar to the key of the getGenters() map if that particular - * gender is to be selected.
+ * in the action class which should return a value similar to the key of the getGenders() map if that particular + * gender is to be selected. * + * ** * <s:action name="GenderMap" var="genders"/> diff --git a/core/src/main/java/org/apache/struts2/components/Reset.java b/core/src/main/java/org/apache/struts2/components/Reset.java index 7b4dd2149..e489de2a3 100644 --- a/core/src/main/java/org/apache/struts2/components/Reset.java +++ b/core/src/main/java/org/apache/struts2/components/Reset.java @@ -40,7 +40,7 @@ import javax.servlet.http.HttpServletResponse; * text shown on the button face, but has issues with Microsoft Internet Explorer at least up to 6.0 * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/Select.java b/core/src/main/java/org/apache/struts2/components/Select.java index 5eb1f7d7f..a21aaa94b 100644 --- a/core/src/main/java/org/apache/struts2/components/Select.java +++ b/core/src/main/java/org/apache/struts2/components/Select.java @@ -36,7 +36,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * * - * Examples + *Examples
** * @@ -65,8 +65,7 @@ import com.opensymphony.xwork2.util.ValueStack; * ** - * - * + ** * * Note: For any of the tags that use lists (select probably being the most ubiquitous), which uses the OGNL list @@ -74,10 +73,10 @@ import com.opensymphony.xwork2.util.ValueStack; * the '01', '02', etc.) is typed. '1' is a char, '01' is a String, "1" is a String. This is important since if * the value returned by your "value" attribute is NOT the same type as the key in the "list" attribute, they * WILL NOT MATCH, even though their String values may be equivalent. If they don't match, nothing in your list - * will be auto-selected.
+ * will be auto-selected. * * - * + * */ @StrutsTag( name="select", diff --git a/core/src/main/java/org/apache/struts2/components/Set.java b/core/src/main/java/org/apache/struts2/components/Set.java index c198a6054..629563cee 100644 --- a/core/src/main/java/org/apache/struts2/components/Set.java +++ b/core/src/main/java/org/apache/struts2/components/Set.java @@ -37,7 +37,7 @@ import com.opensymphony.xwork2.util.ValueStack; *If the tag is used with body content, the evaluation of the value parameter is omitted. Instead, the String to * which the body evaluates is set as value for the scoped variable.
* - * The scopes available are as follows :- + *The scopes available are as follows:
**
* - * NOTE: + *- application - the value will be set in application scope according to servlet spec. using the name as its key
*- session - the value will be set in session scope according to servlet spec. using the name as key
@@ -46,12 +46,13 @@ import com.opensymphony.xwork2.util.ValueStack; *- action - the value will be set in the request scope and Struts' action context using the name as key
*+ * NOTE:
* * - * Parameters + *
* If no scope is specified, it will default to action scope. - * + *Parameters
* * * @@ -68,7 +69,7 @@ import com.opensymphony.xwork2.util.ValueStack; * * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/Text.java b/core/src/main/java/org/apache/struts2/components/Text.java index a26a2dd70..513a2aa9a 100644 --- a/core/src/main/java/org/apache/struts2/components/Text.java +++ b/core/src/main/java/org/apache/struts2/components/Text.java @@ -37,27 +37,26 @@ import java.util.List; /** * + ** Render a I18n text message. + *
* - * - * + ** The message must be in a resource bundle * with the same name as the action that it is associated with. In practice * this means that you should create a properties file in the same package * as your Java class with the same name as your class, but with .properties * extension. + *
* - * - * + ** If the named message is not found in a property file, then the body of the * tag will be used as default message. If no body is used, then the stack will * be searched, and if a value is returned, it will written to the output. * If no value is found on the stack, the key of the message will be written out. - * + *
* * - * - * * * *@@ -66,9 +65,10 @@ import java.util.List; * * * - * - * + *
* Example: + *
+ * ** * diff --git a/core/src/main/java/org/apache/struts2/components/TextArea.java b/core/src/main/java/org/apache/struts2/components/TextArea.java index 6e276873f..968d42e8a 100644 --- a/core/src/main/java/org/apache/struts2/components/TextArea.java +++ b/core/src/main/java/org/apache/struts2/components/TextArea.java @@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletResponse; * Render HTML textarea tag. * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/TextField.java b/core/src/main/java/org/apache/struts2/components/TextField.java index cae5cda97..a5b73651b 100644 --- a/core/src/main/java/org/apache/struts2/components/TextField.java +++ b/core/src/main/java/org/apache/struts2/components/TextField.java @@ -30,14 +30,16 @@ import javax.servlet.http.HttpServletResponse; /** * - * Render an HTML input field of type text + *Render an HTML input field of type text
* * - * Examples - * + *Examples
+ ** * In this example, a text control for the "user" property is rendered. The label is also retrieved from a ResourceBundle via the key attribute. * + *
+ * ** * <s:textfield key="user" /> @@ -49,7 +51,6 @@ import javax.servlet.http.HttpServletResponse; * <s:textfield name="user" label="User Name" /> * *- */ @StrutsTag( name="textfield", diff --git a/core/src/main/java/org/apache/struts2/components/Token.java b/core/src/main/java/org/apache/struts2/components/Token.java index dc9fa7bc0..65bedb0fb 100644 --- a/core/src/main/java/org/apache/struts2/components/Token.java +++ b/core/src/main/java/org/apache/struts2/components/Token.java @@ -40,7 +40,7 @@ import com.opensymphony.xwork2.util.ValueStack; * the unique token. * * - * Examples + *Examples
* ** diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java index d30322aa0..cbceefc68 100644 --- a/core/src/main/java/org/apache/struts2/components/UIBean.java +++ b/core/src/main/java/org/apache/struts2/components/UIBean.java @@ -46,9 +46,10 @@ import java.util.List; import java.util.Map; /** + ** UIBean is the standard superclass of all Struts UI components. * It defines common Struts and html properties all UI components should present for usage. - * + *
* * *@@ -99,8 +100,6 @@ import java.util.Map; * * * - * - * * * *
@@ -202,8 +201,6 @@ import java.util.Map; * * * - * - * * * *
@@ -299,8 +296,6 @@ import java.util.Map; * * * - * - * * * *
@@ -345,33 +340,37 @@ import java.util.Map; * * * + *
* tooltipConfig is deprecated, use individual tooltip configuration attributes instead + *
* + ** Every Form UI component (in xhtml / css_xhtml or any other that extends them) can * have tooltips assigned to them. The Form component's tooltip related attribute, once * defined, will be applied to all form UI components that are created under it unless - * explicitly overriden by having the Form UI component itself defined with their own tooltip attribute. + * explicitly overridden by having the Form UI component itself defined with their own tooltip attribute. + *
* - * - * - * In Example 1, the textfield will inherit the tooltipDelay and tooltipIconPath attribte from + *+ * In Example 1, the textfield will inherit the tooltipDelay and tooltipIconPath attribute from * its containing form. In other words, although it doesn't define a tooltipIconPath * attribute, it will have that attribute inherited from its containing form. + *
* - * - * - * In Example 2, the textfield will inherite both the tooltipDelay and + *+ * In Example 2, the textfield will inherit both the tooltipDelay and * tooltipIconPath attribute from its containing form, but the tooltipDelay - * attribute is overriden at the textfield itself. Hence, the textfield actually will + * attribute is overridden at the textfield itself. Hence, the textfield actually will * have its tooltipIcon defined as /myImages/myIcon.gif, inherited from its containing form, and * tooltipDelay defined as 5000. + *
* - * - * + ** Example 3, 4 and 5 show different ways of setting the tooltip configuration attribute.
* * * diff --git a/core/src/main/java/org/apache/struts2/components/URL.java b/core/src/main/java/org/apache/struts2/components/URL.java index a8eed3509..4da6d642c 100644 --- a/core/src/main/java/org/apache/struts2/components/URL.java +++ b/core/src/main/java/org/apache/struts2/components/URL.java @@ -81,7 +81,7 @@ import java.io.Writer; * * * - * Examples + *
* Example 3: Set tooltip config through the body of the param tag
* Example 4: Set tooltip config through the value attribute of the param tag
* Example 5: Set tooltip config through the tooltip attributes of the component tag
+ *Examples
** * diff --git a/core/src/main/java/org/apache/struts2/components/UpDownSelect.java b/core/src/main/java/org/apache/struts2/components/UpDownSelect.java index 150c5b599..210b4196e 100644 --- a/core/src/main/java/org/apache/struts2/components/UpDownSelect.java +++ b/core/src/main/java/org/apache/struts2/components/UpDownSelect.java @@ -35,15 +35,13 @@ import java.util.Map; /** * - * + ** Create a Select component with buttons to move the elements in the select component * up and down. When the containing form is submited, its elements will be submitted in * the order they are arranged (top to bottom). - * + *
* * - * - * ** * @@ -72,8 +70,6 @@ import java.util.Map; * ** - * @version $Date$ $Id$ - * * @s.tag name="updownselect" tld-body-content="JSP" tld-tag-class="org.apache.struts2.views.jsp.ui.UpDownSelectTag" * description="Render a up down select element" */ diff --git a/core/src/main/java/org/apache/struts2/components/template/Template.java b/core/src/main/java/org/apache/struts2/components/template/Template.java index 361dcb6a9..40c30fcc0 100644 --- a/core/src/main/java/org/apache/struts2/components/template/Template.java +++ b/core/src/main/java/org/apache/struts2/components/template/Template.java @@ -25,10 +25,10 @@ import java.util.ArrayList; import java.util.List; /** - * A template. - * + ** A template is used as a model for rendering output. * This object contains basic common template information + *
*/ public class Template implements Cloneable { String dir; diff --git a/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java b/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java index bd8c3b4a2..a93d39e8a 100644 --- a/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java +++ b/core/src/main/java/org/apache/struts2/components/template/TemplateEngineManager.java @@ -64,9 +64,14 @@ public class TemplateEngineManager { } /** + ** Registers the given template engine. - *
+ * + * + ** Will add the engine to the existing list of known engines. + *
+ * * @param templateExtension filename extension (eg. .jsp, .ftl, .vm). * @param templateEngine the engine. */ @@ -79,11 +84,13 @@ public class TemplateEngineManager { } /** + ** Gets the TemplateEngine for the template name. If the template name has an extension (for instance foo.jsp), then * this extension will be used to look up the appropriate TemplateEngine. If it does not have an extension, it will * look for a Configuration setting "struts.ui.templateSuffix" for the extension, and if that is not set, it * will fall back to "ftl" as the default. - * + *
+ * * @param template Template used to determine which TemplateEngine to return * @param templateTypeOverride Overrides the default template type * @return the engine. diff --git a/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java b/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java index ef8505b68..d0728343c 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java @@ -38,24 +38,31 @@ import java.net.URLDecoder; import java.util.*; /** + ** Default implementation to server static content - *
+ * + * + ** This class is used to serve common static content needed when using various parts of Struts, such as JavaScript * files, CSS files, etc. It works by looking for requests to /struts/* (or /static/*), and then mapping the value after "/struts/" * to common packages in Struts and, optionally, in your class path. By default, the following packages are * automatically searched: + *
+ * **
- * This means that you can simply request /struts/xhtml/styles.css and the XHTML UI theme's default stylesheet + * + *- org.apache.struts2.static
*- template
*- static
*+ * This means that you can simply request /struts/xhtml/styles.css and the XHTML UI theme's default stylesheet * will be returned. Likewise, many of the AJAX UI components require various JavaScript files, which are found in the * org.apache.struts2.static package. If you wish to add additional packages to be searched, you can add a comma * separated (space, tab and new line will do as well) list in the filter init parameter named "packages". Be * careful, however, to expose any packages that may have sensitive information, such as properties file with * database access credentials. - *
+ * */ public class DefaultStaticContentLoader implements StaticContentLoader { diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java index a63e503f4..b56db9cbf 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java @@ -127,11 +127,15 @@ public class Dispatcher { private static final String DEFAULT_CONFIGURATION_PATHS = "struts-default.xml,struts-plugin.xml,struts.xml"; /** + ** Store state of STRUTS_DISPATCHER_PARAMETERSWORKAROUND. - *
+ * + * + ** The workaround is for WebLogic. - * We try to autodect WebLogic on Dispatcher init. + * We try to autodetect WebLogic on Dispatcher init. * The workaround can also be enabled manually. + *
*/ private boolean paramsWorkaroundEnabled = false; @@ -490,14 +494,18 @@ public class Dispatcher { } /** + ** Load Action class for mapping and invoke the appropriate Action method, or go directly to the Result. - *
+ * + * + ** This method first creates the action context from the given parameters, * and then loads an ActionProxy from the given action name and namespace. * After that, the Action method is executed and output channels through the response object. * Actions not found are sent back to the user via the {@link Dispatcher#sendError} method, * using the 404 return code. * All other errors are reported by throwing a ServletException. + *
* * @param request the HttpServletRequest object * @param response the HttpServletResponse object diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java index bb42556ce..bc1788114 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapper.java @@ -27,21 +27,27 @@ import javax.servlet.http.HttpServletRequest; /** * - * + ** The ActionMapper interface provides a mapping between HTTP requests and action invocation requests and vice-versa. - *
+ * + * + ** When given an HttpServletRequest, the ActionMapper may return null if no action invocation request matches, * or it may return an {@link ActionMapping} that describes an action invocation for the framework to try. - *
+ * + * + ** The ActionMapper is not required to guarantee that the {@link ActionMapping} returned be a real action or otherwise * ensure a valid request. * Accordingly, most ActionMappers do not need to consult the Struts configuration * just to determine if a request should be mapped. - *
+ * + * + ** Just as requests can be mapped from HTTP to an action invocation, the opposite is true as well. * However, because HTTP requests (when shown in HTTP responses) must be in String form, * a String is returned rather than an actual request object. - * + *
* */ public interface ActionMapper { diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java index d5b9e4eed..493376561 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java @@ -42,39 +42,43 @@ import java.util.regex.Pattern; /** * - * + ** Default action mapper implementation, using the standard *.[ext] (where ext * usually "action") pattern. The extension is looked up from the Struts * configuration key struts.action.extension. - *
- * To help with dealing with buttons and other related requirements, this + * + * + *+ * To help with dealing with buttons and other related requirements, this * mapper (and other {@link ActionMapper}s, we hope) has the ability to name a * button with some predefined prefix and have that button name alter the * execution behaviour. The four prefixes are: - *
+ * + * **
- * + * + *- Method prefix - method:default
*- Action prefix - action:dashboard
** In addition to these four prefixes, this mapper also understands the * action naming pattern of foo!bar in either the extension form (eg: * foo!bar.action) or in the prefix form (eg: action:foo!bar). This syntax tells * this mapper to map to the action named foo and the method bar. - *
+ * * * Method Prefix * - * + ** With method-prefix, instead of calling baz action's execute() method (by * default if it isn't overriden in struts.xml to be something else), the baz * action's anotherMethod() will be called. A very elegant way determine which * button is clicked. Alternatively, one would have submit button set a * particular value on the action when clicked, and the execute() method decides * on what to do with the setted value depending on which button is clicked. - *
+ * * - * + * ** <!-- START SNIPPET: method-example --> * <s:form action="baz"> @@ -86,14 +90,14 @@ import java.util.regex.Pattern; ** Action prefix * - * + ** With action-prefix, instead of executing baz action's execute() method (by - * default if it isn't overriden in struts.xml to be something else), the - * anotherAction action's execute() method (assuming again if it isn't overriden + * default if it isn't overridden in struts.xml to be something else), the + * anotherAction action's execute() method (assuming again if it isn't overridden * with something else in struts.xml) will be executed. - *
+ * * - * + * ** <!-- START SNIPPET: action-example --> * <s:form action="baz"> diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/PrefixBasedActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/PrefixBasedActionMapper.java index 2ecccb5fe..457279aff 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/PrefixBasedActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/PrefixBasedActionMapper.java @@ -16,24 +16,24 @@ import java.util.Map; /** * - * - * A prefix based action mapper that is capable of delegating to other {@link ActionMapper}s based on the request's prefix - * - * It is configured through struts.xml - * + *+ * A prefix based action mapper that is capable of delegating to other {@link ActionMapper}s based on the request's prefix.
* *
+ * It is configured through struts.xml
* For example, with the following entries in struts.properties + ** <constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/> * <constant name="struts.mapper.prefixMapping" value="/communities:pseudoRestful,/communityTags:pseudoRestful,/events:pseudoRestful,/mediaList:pseudoRestful,/users:pseudoRestful,/community:struts,/communityTag:struts,/event:struts,/media:struts,/user:struts,:struts"/> *- * + * + ** When {@link PrefixBasedActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} or * {@link PrefixBasedActionMapper#getUriFromActionMapping(ActionMapping)} is invoked, * {@link PrefixBasedActionMapper} will check each possible prefix (url prefix terminating just before a /) to find the most specific ActionMapper that returns a mapping when asked to map the request. If none are found, null is returned for both * {@link PrefixBasedActionMapper#getMapping(HttpServletRequest, ConfigurationManager)} and * {@link PrefixBasedActionMapper#getUriFromActionMapping(ActionMapping)} methods. - *
+ * * * * diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java index 3a3539ebc..c74bf63c8 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java @@ -34,20 +34,27 @@ import java.util.*; /** + ** Parse a multipart request and provide a wrapper around the request. The parsing implementation used * depends on the struts.multipart.parser setting. It should be set to a class which - * extends {@link org.apache.struts2.dispatcher.multipart.MultiPartRequest}. - *
+ * extends {@link org.apache.struts2.dispatcher.multipart.MultiPartRequest}. + * + * + ** The struts.multipart.parser property should be set to jakarta for the * Jakarta implementation, pell for the Pell implementation and cos for the Jason Hunter * implementation. - *
+ * + * + ** The files are uploaded when the object is instantiated. If there are any errors they are logged using * {@link #addError(String)}. An action handling a multipart form should first check {@link #hasErrors()} * before doing any other processing. - *
- * An alternate implementation, PellMultiPartRequest, is provided as a plugin. + * * + *+ * An alternate implementation, PellMultiPartRequest, is provided as a plugin. + *
*/ public class MultiPartRequestWrapper extends StrutsRequestWrapper { diff --git a/core/src/main/java/org/apache/struts2/factory/PrefixBasedActionProxyFactory.java b/core/src/main/java/org/apache/struts2/factory/PrefixBasedActionProxyFactory.java index 5aa165066..028a32afe 100644 --- a/core/src/main/java/org/apache/struts2/factory/PrefixBasedActionProxyFactory.java +++ b/core/src/main/java/org/apache/struts2/factory/PrefixBasedActionProxyFactory.java @@ -14,18 +14,24 @@ import java.util.Map; /** * + ** Prefix based factory should be used with {@link org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper} * to use appropriate {@link com.opensymphony.xwork2.ActionProxyFactory} connected with given * {@link org.apache.struts2.dispatcher.mapper.ActionMapper} + *
* + ** Add below entry to struts.xml to enable the factory: - *
+ * + * ** <constant name="struts.actionProxyFactory" value="prefix"/> ** + ** The factory will use the same set of patterns as defined with: - *
+ * + * ** <constant name="struts.mapper.prefixMapping" value="..."/> *diff --git a/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java index ba8389e6c..93f527bfe 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ActionMappingParametersInteceptor.java @@ -32,35 +32,40 @@ import java.util.TreeMap; /** * + ** This interceptor sets all parameters from the action mapping, for this request, on the value stack. It operates * exactly like {@link ParametersInterceptor}, only the parameters come from the {@link ActionMapping}, not the * {@link ActionContext#getParameters()} method. + *
+ * * - * - * Interceptor parameters: - * + * + *Interceptor parameters:
+ * * - * + * *- * + * *
- * + * * - * - * Extending the interceptor: - * + * + *- ordered - set to true if you want the top-down property setter behaviour
- * + * *Extending the interceptor:
+ * * - * - * The best way to add behavior to this interceptor is to utilize the {@link com.opensymphony.xwork2.interceptor.ParameterNameAware} interface in your + * + *+ * The best way to add behavior to this interceptor is to utilize the {@link com.opensymphony.xwork2.interceptor.ParameterNameAware} interface in your * actions. However, if you wish to apply a global rule that isn't implemented in your action, then you could extend * this interceptor and override the {@link #acceptableName(String)} method. - *
+ * + * * - * - * Example code: - * + * + *Example code:
+ * ** * <action name="someAction" class="com.examples.SomeAction"> @@ -91,9 +96,10 @@ public class ActionMappingParametersInteceptor extends ParametersInterceptor { * * @param ac The action context * @param newParams The parameter map to apply - * + ** 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. + *
*/ @Override protected void addParametersToContext(ActionContext ac, Map newParams) { diff --git a/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java b/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java index 78ac18a37..a68608638 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ApplicationAware.java @@ -25,12 +25,14 @@ import java.util.Map; /** + ** Actions that want to be aware of the application Map object should implement this interface. * This will give them access to a Map where they can put objects that should be available - * to other parts of the application.
- *
+ * to other parts of the application. + * + ** Typical uses are configuration objects and caches. - * + *
*/ public interface ApplicationAware { diff --git a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java index 8fd638b31..bad1c2529 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java @@ -33,19 +33,21 @@ import java.util.Set; /** * + ** Looks for a hidden identification field that specifies the original value of the checkbox. * If the checkbox isn't submitted, insert it into the parameters as if it was with the value * of 'false'. + *
* - * + * * - *+ *
- setUncheckedValue - - * The default value of an unchecked box can be overridden by setting the 'uncheckedValue' property. - *
+ *
* - * + * * - * + * * */ public class CheckboxInterceptor extends AbstractInterceptor { diff --git a/core/src/main/java/org/apache/struts2/interceptor/ClearSessionInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ClearSessionInterceptor.java index aa4f3e525..9bf769993 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ClearSessionInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ClearSessionInterceptor.java @@ -31,19 +31,18 @@ import java.util.Map; /** * - * + *- setUncheckedValue - The default value of an unchecked box can be overridden by setting the 'uncheckedValue' property.
+ ** This interceptor clears the HttpSession. - *
+ * * * * - * Interceptor parameters: - * + *Interceptor parameters:
* * * *- *
* * @@ -52,14 +51,12 @@ import java.util.Map; * * *- none
+ *- None
*- * *
* * * - * Example: + *- None
- * *Example:
* ** diff --git a/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java index c25180b99..771ed6326 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java @@ -42,25 +42,37 @@ import java.util.Set; /** * * - * The aim of this intercepter is to set values in the stack/action based on cookie name/value - * of interest. + *+ * The aim of this interceptor is to set values in the stack/action based on cookie name/value + * of interest. + *
* + ** If an asterisk is present in cookiesName parameter, it will be assume that * all cookies name are to be injected into struts' action, even though - * cookiesName is comma-separated by other values, e.g. (cookie1,*,cookie2).
+ * cookiesName is comma-separated by other values, e.g. (cookie1,*,cookie2). + * * + ** If cookiesName is left empty it will assume that no cookie will be injected - * into Struts' action.
+ * into Struts' action. + * * + ** If an asterisk is present in cookiesValue parameter, it will assume that all * cookies name irrespective of its value will be injected into Struts' action so - * long as the cookie name matches those specified in cookiesName parameter.
+ * long as the cookie name matches those specified in cookiesName parameter. + * * + ** If cookiesValue is left empty it will assume that all cookie that match the cookieName - * parameter will be injected into Struts' action.
+ * parameter will be injected into Struts' action. + * * + ** The action could implement {@link CookiesAware} in order to have a {@link Map} - * of filtered cookies set into it.
+ * of filtered cookies set into it. + * * * * diff --git a/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java index 6f604d0ef..8bdbc4e7d 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/CreateSessionInterceptor.java @@ -33,21 +33,24 @@ import javax.servlet.http.HttpSession; /** * * + ** This interceptor creates the HttpSession if it doesn't exist, also SessionMap is recreated and put in ServletActionContext. - *
+ * + * + ** This is particular useful when using the <@s.token> tag in freemarker templates. * The tag do require that a HttpSession is already created since freemarker commits * the response to the client immediately. - * + *
* * - * Interceptor parameters: + *Interceptor parameters:
* * * * *- *
* * @@ -56,14 +59,12 @@ import javax.servlet.http.HttpSession; * * *- none
+ *- None
*- * *
* * * - * Example: + *- None
- * *Example:
* ** @@ -76,8 +77,6 @@ import javax.servlet.http.HttpSession; * * *- * - * @version $Date$ $Id$ */ public class CreateSessionInterceptor extends AbstractInterceptor { diff --git a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java index 8b107ee1b..5add14a7b 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ExecuteAndWaitInterceptor.java @@ -40,47 +40,54 @@ import java.util.Map; /** * - * + ** The ExecuteAndWaitInterceptor is great for running long-lived actions in the background while showing the user a nice * progress meter. This also prevents the HTTP request from timing out when the action takes more than 5 or 10 minutes. + *
* - * Using this interceptor is pretty straight forward. Assuming that you are including struts-default.xml, this + *Using this interceptor is pretty straight forward. Assuming that you are including struts-default.xml, this * interceptor is already configured but is not part of any of the default stacks. Because of the nature of this * interceptor, it must be the last interceptor in the stack. + *
* - * This interceptor works on a per-session basis. That means that the same action name (myLongRunningAction, in the + *This interceptor works on a per-session basis. That means that the same action name (myLongRunningAction, in the * above example) cannot be run more than once at a time in a given session. On the initial request or any subsequent * requests (before the action has completed), the wait result will be returned. The wait result is * responsible for issuing a subsequent request back to the action, giving the effect of a self-updating progress * meter. + *
* - * If no "wait" result is found, Struts will automatically generate a wait result on the fly. This result is + *If no "wait" result is found, Struts will automatically generate a wait result on the fly. This result is * written in FreeMarker and cannot run unless FreeMarker is installed. If you don't wish to deploy with FreeMarker, you * must provide your own wait result. This is generally a good thing to do anyway, as the default wait page is very * plain. + *
* - * Whenever the wait result is returned, the action that is currently running in the background will be placed on + *Whenever the wait result is returned, the action that is currently running in the background will be placed on * top of the stack. This allows you to display progress data, such as a count, in the wait page. By making the wait * page automatically reload the request to the action (which will be short-circuited by the interceptor), you can give * the appearance of an automatic progress meter. + *
* - * This interceptor also supports using an initial wait delay. An initial delay is a time in milliseconds we let the + *This interceptor also supports using an initial wait delay. An initial delay is a time in milliseconds we let the * server wait before the wait page is shown to the user. During the wait this interceptor will wake every 100 millis * to check if the background process is done premature, thus if the job for some reason doesn't take to long the wait * page is not shown to the user. *
* - * Important: Because the action will be running in a seperate thread, you can't use ActionContext because it + *
This is useful for e.g. search actions that have a wide span of execution time. Using a delay time of 2000 * millis we ensure the user is presented fast search results immediately and for the slow results a wait page is used. + *Important: Because the action will be running in a separate thread, you can't use ActionContext because it * is a ThreadLocal. This means if you need to access, for example, session data, you need to implement SessionAware * rather than calling ActionContext.getSession(). + *
* - * The thread kicked off by this interceptor will be named in the form actionNameBackgroundProcess. + *The thread kicked off by this interceptor will be named in the form actionNameBackgroundProcess. * For example, the search action would run as a thread named searchBackgroundProcess. - * + *
* * - * Interceptor parameters: + *Interceptor parameters:
* * * @@ -94,20 +101,18 @@ import java.util.Map; * * * - * Extending the interceptor: - * - * + *Extending the interceptor:
* * - * + ** If you wish to make special preparations before and/or after the invocation of the background thread, you can extend * the BackgroundProcess class and implement the beforeInvocation() and afterInvocation() methods. This may be useful * for obtaining and releasing resources that the background process will need to execute successfully. To use your * background process extension, extend ExecuteAndWaitInterceptor and implement the getNewBackgroundProcess() method. - * + *
* * - * Example code: + *Example code:
* ** @@ -131,9 +136,11 @@ import java.util.Map; * </html> ** - * Example code2: + *Example code2:
+ ** This example will wait 2 second (2000 millis) before the wait page is shown to the user. Therefore * if the long process didn't last long anyway the user isn't shown a wait page. + *
* ** <action name="someAction" class="com.examples.SomeAction"> @@ -146,10 +153,12 @@ import java.util.Map; * </action> ** - * Example code3: + *Example code3:
+ ** This example will wait 1 second (1000 millis) before the wait page is shown to the user. * And at every 50 millis this interceptor will check if the background process is done, if so * it will return before the 1 second has elapsed, and the user isn't shown a wait page. + *
* ** <action name="someAction" class="com.examples.SomeAction"> @@ -303,13 +312,17 @@ public class ExecuteAndWaitInterceptor extends MethodFilterInterceptor { } /** + ** Performs the initial delay. - *
+ * + * + ** When this interceptor is executed for the first time this methods handles any provided initial delay. * An initial delay is a time in milliseconds we let the server wait before we continue. *
* * @param bp the background process * @throws InterruptedException is thrown by Thread.sleep diff --git a/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java index 5e12df0cc..644203add 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/FileUploadInterceptor.java @@ -40,79 +40,81 @@ import java.util.*; /** * - * + *
During the wait this interceptor will wake every 100 millis to check if the background * process is done premature, thus if the job for some reason doesn't take to long the wait * page is not shown to the user. + ** Interceptor that is based off of {@link MultiPartRequestWrapper}, which is automatically applied for any request that * includes a file. It adds the following parameters, where [File Name] is the name given to the file uploaded by the * HTML form: - *
+ * *- * + * *
- * - * You can get access to these files by merely providing setters in your action that correspond to any of the three + * + *- [File Name] : File - the actual File
- * + * *- [File Name]ContentType : String - the content type of the file
- * + * *- [File Name]FileName : String - the actual name of the file uploaded (not the HTML name)
- * + * *You can get access to these files by merely providing setters in your action that correspond to any of the three * patterns above, such as setDocument(File document), setDocumentContentType(String contentType), etc. *
- * This interceptor will add several field errors, assuming that the action implements {@link ValidationAware}. + * + * + *
See the example code section. - *This interceptor will add several field errors, assuming that the action implements {@link ValidationAware}. * These error messages are based on several i18n values stored in struts-messages.properties, a default i18n file * processed for all i18n requests. You can override the text of these messages by providing text for the following * keys: - *
+ * + * *- * + * *
- * + * * - * - * Interceptor parameters: - * + * + *- struts.messages.error.uploading - a general error that occurs when the file could not be uploaded
- * + * *- struts.messages.error.file.too.large - occurs when the uploaded file is too large
- * + * *- struts.messages.error.content.type.not.allowed - occurs when the uploaded file does not match the expected * content types specified
- * + * *- struts.messages.error.file.extension.not.allowed - occurs when the uploaded file does not match the expected * file extensions specified
- * + * *Interceptor parameters:
+ * * - * + * *- * + * *
- * - * + * + * * - * - * Extending the interceptor: - * - * - * + * + *- maximumSize (optional) - the maximum size (in bytes) that the interceptor will allow a file reference to be set * on the action. Note, this is not related to the various properties found in struts.properties. * Default to approximately 2MB.
- * + * *- allowedTypes (optional) - a comma separated list of content types (ie: text/html) that the interceptor will allow * a file reference to be set on the action. If none is specified allow all types to be uploaded.
- * + * *- allowedExtensions (optional) - a comma separated list of file extensions (ie: .html) that the interceptor will allow * a file reference to be set on the action. If none is specified allow all extensions to be uploaded.
*Extending the interceptor:
+ * + * + * * - * + ** You can extend this interceptor and override the acceptFile method to provide more control over which files * are supported and which are not. - *
+ * * - * - * Example code: - * + * + *Example code:
+ * ** * <action name="doUpload" class="com.example.UploadAction"> @@ -122,13 +124,13 @@ import java.util.*; * </action> * *- * + * * - * + ** You must set the encoding to
+ * * - * + * *multipart/form-datain the form where the user selects the file to upload. - ** * <s:form action="doUpload" method="post" enctype="multipart/form-data"> @@ -137,10 +139,11 @@ import java.util.*; * </s:form> * *- * + ** And then in your action code you'll have access to the File object if you provide setters according to the * naming convention documented in the start. - *
+ * + * ** * package com.example; diff --git a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java index 2112401ba..d250a8f61 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java @@ -32,29 +32,31 @@ import java.util.Map; /** * + ** This interceptor extends the original xwork i18n interceptor * and adds functionality to support cookies. + *
* * * * - * + * *- * + * *
- * + * * * * diff --git a/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java index f10cd4842..a3f83db1c 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/MessageStoreInterceptor.java @@ -36,39 +36,42 @@ import java.util.Map; /** * - * + *- 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 request_locale
- * + * *- requestCookieParameterName (optional) - the name of the HTTP request parameter that dictates the locale to switch to * and save in a cookien. By default this is request_cookie_locale
- * + * *- 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 request_only_locale
- * + * *- attributeName (optional) - the name of the session key to store the selected locale. By default this is * WW_TRANS_I18N_LOCALE
- * + * ** An interceptor to store a {@link ValidationAware} action's messages / errors and field errors into * HTTP Session, such that it will be retrievable at a later stage. This allows the action's message / * errors and field errors to be available longer that just the particular HTTP request. + *
* + ** If no session exists, nothing will be stored and can be retrieved later. In other terms, * the application is responsible to open the session. + *
* - * - * + ** In the 'STORE' mode, the interceptor will store the {@link ValidationAware} action's message / errors * and field errors into HTTP session. + *
* - * - * + ** In the 'RETRIEVE' mode, the interceptor will retrieve the stored action's message / errors and field * errors and put them back into the {@link ValidationAware} action. - * - *
+ * * + ** In the 'AUTOMATIC' mode, the interceptor will always retrieve the stored action's message / errors * and field errors and put them back into the {@link ValidationAware} action, and after Action execution, * if the {@link com.opensymphony.xwork2.Result} is an instance of {@link ServletRedirectResult}, the action's message / errors * and field errors into automatically be stored in the HTTP session.. + *
* - * - * + ** The interceptor does nothing in the 'NONE' mode, which is the default. + *
* - * - * - * The operation mode could be switched using :- - * 1] Setting the iterceptor parameter eg. + *+ * The operation mode could be switched using:
*
+ * 1] Setting the interceptor parameter eg. + ** <action name="submitApplication" ...> * <interceptor-ref name="store"> @@ -79,7 +82,10 @@ import java.util.Map; * </action> ** + ** 2] Through request parameter (allowRequestParameterSwitch must be 'true' which is the default) + *
+ * ** // the request will have the operation mode in 'STORE' * http://localhost:8080/context/submitApplication.action?operationMode=STORE @@ -101,11 +107,12 @@ import java.util.Map; * * * - * * * + *+ * The following method could be overridden: + *
* - * The following method could be overriden :- **
- getRequestOperationMode - get the operation mode of this interceptor based on the request parameters
*- mergeCollection - merge two collections
@@ -137,15 +144,13 @@ import java.util.Map; * * * - * + ** With the example above, 'submitApplication.action' will have the action messages / errors / field errors stored * in the HTTP Session. Later when needed, (in this case, when 'applicationFailed.action' is fired, it * will get the action messages / errors / field errors stored in the HTTP Session and put them back into * the action. - * + *
* - * - * @version $Date$ $Id$ */ public class MessageStoreInterceptor extends AbstractInterceptor { diff --git a/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java b/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java index 6e53960ef..c440946aa 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ParameterAware.java @@ -25,15 +25,20 @@ import java.util.Map; /** + ** This interface gives actions an alternative way of receiving input parameters. The map will - * contain all input parameters as name/value entries. Actions that need this should simply implement it.
- *
+ * contain all input parameters as name/value entries. Actions that need this should simply implement it. + * + * + ** One common use for this is to have the action propagate parameters to internally instantiated data - * objects.
- *
+ * objects. + * + * + ** Note that all parameter values for a given name will be returned, so the type of the objects in * the map is java.lang.String[]. - * + *
*/ public interface ParameterAware { diff --git a/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java b/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java index 666f8911d..2a13300b8 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/RequestAware.java @@ -24,9 +24,13 @@ package org.apache.struts2.interceptor; import java.util.Map; /** - * Actions that want access to the current serlvet request attributes should implement this interface. + *+ * Actions that want access to the current servlet request attributes should implement this interface. + *
* - * This interface is only relevant if the Action is used in a servlet environment. + *+ * This interface is only relevant if the Action is used in a servlet environment. + *
*/ public interface RequestAware { diff --git a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java index a8fce6746..6518b7cd3 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java @@ -35,10 +35,12 @@ import java.util.List; /** * + ** This interceptor ensures that the action will only be executed if the user has the correct role. + *
* * - * Interceptor parameters: + *Interceptor parameters:
* * * @@ -60,7 +62,10 @@ import java.util.List; * * * + ** There are three extensions to the existing interceptor: + *
+ * **
- isAllowed(HttpServletRequest,Object) - whether or not to allow * the passed action execution with this request
diff --git a/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java index dfcd4d306..4ce9c15ed 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java @@ -41,29 +41,33 @@ import java.util.Map; /** * - * + ** This is designed to solve a few simple issues related to wizard-like functionality in Struts. One of those issues is * that some applications have a application-wide parameters commonly used, such pageLen (used for records per * page). Rather than requiring that each action check if such parameters are supplied, this interceptor can look for * specified parameters and pull them out of the session. + *
* - * This works by setting listed properties at action start with values from session/application attributes keyed + *This works by setting listed properties at action start with values from session/application attributes keyed * after the action's class, the action's name, or any supplied key. After action is executed all the listed properties * are taken back and put in session or application context. + *
* - * To make sure that each execution of the action is consistent it makes use of session-level locking. This way it + *To make sure that each execution of the action is consistent it makes use of session-level locking. This way it * guarantees that each action execution is atomic at the session level. It doesn't guarantee application level * consistency however there has yet to be enough reasons to do so. Application level consistency would also be a big * performance overkill. + *
* - * Note that this interceptor takes a snapshot of action properties just before result is presented (using a {@link + *Note that this interceptor takes a snapshot of action properties just before result is presented (using a {@link * PreResultListener}), rather than after action is invoked. There is a reason for that: At this moment we know that * action's state is "complete" as it's values may depend on the rest of the stack and specifically - on the values of * nested interceptors. + *
* * * - * Interceptor parameters: + *Interceptor parameters:
* * * @@ -110,17 +114,15 @@ import java.util.Map; * * * - * Extending the interceptor: - * - * + *Extending the interceptor:
* * * - * There are no know extension points for this interceptor. + *There are no know extension points for this interceptor.
* * * - * Example code: + *Example code:
* ** diff --git a/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java index 12f3cbfdf..3a3f132cb 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ServletConfigInterceptor.java @@ -38,12 +38,14 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor; /** * - * + ** An interceptor which sets action properties based on the interfaces an action implements. For example, if the action * implements {@link ParameterAware} then the action context's parameter map will be set on it. + *
* - * This interceptor is designed to set all properties an action needs if it's aware of servlet parameters, the + *This interceptor is designed to set all properties an action needs if it's aware of servlet parameters, the * servlet context, the session, etc. Interfaces that it supports are: + *
* ** @@ -67,7 +69,7 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor; * * * - * Interceptor parameters: + *
Interceptor parameters:
* * * @@ -79,17 +81,15 @@ import com.opensymphony.xwork2.interceptor.AbstractInterceptor; * * * - * Extending the interceptor: - * - * + *Extending the interceptor:
* * * - * There are no known extension points for this interceptor. + *There are no known extension points for this interceptor.
* * * - * Example code: + *Example code:
* ** diff --git a/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java b/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java index 7adb5dc79..814864c4c 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ServletRequestAware.java @@ -25,13 +25,18 @@ import javax.servlet.http.HttpServletRequest; /** - * All Actions that want to have access to the servlet request object must implement this interface.- *
- * This interface is only relevant if the Action is used in a servlet environment.- *
+ *+ * All Actions that want to have access to the servlet request object must implement this interface. + *
+ * + *+ * This interface is only relevant if the Action is used in a servlet environment. + *
+ * + ** Note that using this interface makes the Action tied to a servlet environment, so it should be * avoided if possible since things like unit testing will become more difficult. - * + *
*/ public interface ServletRequestAware { diff --git a/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java b/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java index 5674c695b..2fa55379d 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/ServletResponseAware.java @@ -25,13 +25,16 @@ import javax.servlet.http.HttpServletResponse; /** - * All Actions that want to have access to the servlet response object must implement this interface.- *
- * This interface is only relevant if the Action is used in a servlet environment.- *
+ *+ * All Actions that want to have access to the servlet response object must implement this interface. + *
+ *+ * This interface is only relevant if the Action is used in a servlet environment. + *
+ ** Note that using this interface makes the Action tied to a servlet environment, so it should be * avoided if possible since things like unit testing will become more difficult. - * + *
*/ public interface ServletResponseAware { diff --git a/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java b/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java index 4791f18bc..ea101bbfb 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java +++ b/core/src/main/java/org/apache/struts2/interceptor/SessionAware.java @@ -25,13 +25,16 @@ import java.util.Map; /** - * Actions that want access to the user's HTTP session attributes should implement this interface.- *
+ *+ * Actions that want access to the user's HTTP session attributes should implement this interface. + *
+ ** This will give them access to a Map where they can put objects that can be made available - * to subsequent requests.
- * + * to subsequent requests. + * + ** Typical uses may be cached user data such as name, or a shopping cart. - * + *
*/ public interface SessionAware { diff --git a/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java index 799848937..aad8d76e0 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/StrutsConversionErrorInterceptor.java @@ -28,14 +28,14 @@ import com.opensymphony.xwork2.util.ValueStack; /** * - * + ** This interceptor extends {@link ConversionErrorInterceptor} but only adds conversion errors from the ActionContext to * the field errors of the action if the field value is not null, "", or {""} (a size 1 String array with only an empty * String). See {@link ConversionErrorInterceptor} for more information, as well as the Type Conversion documentation. - * + *
* * - * Interceptor parameters: + *Interceptor parameters:
* * * @@ -47,14 +47,12 @@ import com.opensymphony.xwork2.util.ValueStack; * * * - * Extending the interceptor: - * - * + *Extending the interceptor:
* * - * + ** There are no known extension points for this interceptor. - * + *
* * *diff --git a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java index 229fcaff6..785421333 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java @@ -33,38 +33,39 @@ import javax.servlet.http.HttpSession; /** * - * + ** Ensures that only one request per token is processed. This interceptor can make sure that back buttons and double * clicks don't cause un-intended side affects. For example, you can use this to prevent careless users who might double * click on a "checkout" button at an online store. This interceptor uses a fairly primitive technique for when an * invalid token is found: it returns the result invalid.token, which can be mapped in your action configuration. * A more complex implementation, {@link TokenSessionStoreInterceptor}, can provide much better logic for when invalid * tokens are found. + *
* - * - * + ** Note: To set a token in your form, you should use the token tag. This tag is required and must be used * in the forms that submit to actions protected by this interceptor. Any request that does not provide a token (using * the token tag) will be processed as a request with an invalid token. + *
* - * - * + ** Internationalization Note: The following key could be used to internationalized the action errors generated * by this token interceptor + *
* **
* - * - * + *- struts.messages.invalid.token
** NOTE: As this method extends off MethodFilterInterceptor, it is capable of * deciding if it is applicable only to selective methods in the action class. See *
* * * - * Interceptor parameters: + *MethodFilterInterceptorfor more info. + *Interceptor parameters:
* * * @@ -76,19 +77,17 @@ import javax.servlet.http.HttpSession; * * * - * Extending the interceptor: - * - * + *Extending the interceptor:
* * - * + ** While not very common for users to extend, this interceptor is extended by the {@link TokenSessionStoreInterceptor}. * The {@link #handleInvalidToken} and {@link #handleValidToken} methods are protected and available for more * interesting logic, such as done with the token session interceptor. - * + *
* * - * Example code: + *Example code:
* ** diff --git a/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java index 871f24d83..4ad443117 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/TokenSessionStoreInterceptor.java @@ -37,23 +37,24 @@ import java.util.Map; /** * - * + ** This interceptor builds off of the {@link TokenInterceptor}, providing advanced logic for handling invalid tokens. * Unlike the normal token interceptor, this interceptor will attempt to provide intelligent fail-over in the event of * multiple requests using the same session. That is, it will block subsequent requests until the first request is * complete, and then instead of returning the invalid.token code, it will attempt to display the same response * that the original, valid action invocation would have displayed if no multiple requests were submitted in the first * place. + *
* - * - * + ** NOTE: As this method extends off MethodFilterInterceptor, it is capable of * deciding if it is applicable only to selective methods in the action class. See *
* * * - * Interceptor parameters: + *MethodFilterInterceptorfor more info. + *Interceptor parameters:
* * * @@ -65,17 +66,15 @@ import java.util.Map; * * * - * Extending the interceptor: - * - * + *Extending the interceptor:
* * - * + ** There are no known extension points for this interceptor. - * + *
* * - * Example code: + *Example code:
* ** diff --git a/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java index 33b19f4f8..6eed2800d 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java @@ -49,11 +49,15 @@ import java.util.*; /** * + ** Provides several different debugging screens to provide insight into the * data behind the page. + *
* + ** The value of the 'debug' request parameter determines * the screen: + *
* **
* - * - * Example: + *- *
xml- Dumps the parameters, context, session, and value @@ -69,18 +73,20 @@ import java.util.*; * debug=browser&object=%23parameters+ * Example: + *
* * http://localhost:8080/Welcome.action?debug=xml * - * + ** * This interceptor only is activated when devMode is enabled in * struts.properties. The 'debug' parameter is removed from the parameter list * before the action is executed. All operations occur before the natural * Result has a chance to execute. * + *
*/ public class DebuggingInterceptor extends AbstractInterceptor { diff --git a/core/src/main/java/org/apache/struts2/result/HttpHeaderResult.java b/core/src/main/java/org/apache/struts2/result/HttpHeaderResult.java index 47454757f..d68769efc 100644 --- a/core/src/main/java/org/apache/struts2/result/HttpHeaderResult.java +++ b/core/src/main/java/org/apache/struts2/result/HttpHeaderResult.java @@ -37,40 +37,41 @@ import java.util.Map; /** * - * + ** A custom Result type for setting HTTP headers and status by optionally evaluating against the ValueStack. * This result can also be used to send and error to the client. All the parameters can be evaluated against the ValueStack. - *
+ * + * * - * + ** This result type takes the following parameters: - *
+ * * - * + * *- * + * *
- * + * * - * + *- status - the http servlet response status code that should be set on a response.
- * + * *- parse - true by default. If set to false, the headers param will not be parsed for Ognl expressions.
- * + * *- headers - header values.
- * + * *- error - the http servlet response error code that should be set on a response.
- * + * *- errorMessage - error message to be set on response if 'error' is set.
** Example: - *
+ * ** <result name="success" type="httpheader"> * <param name="status">204</param> * <param name="headers.a">a custom header value</param> * <param name="headers.b">another custom header value</param> * </result> - * + * * <result name="proxyRequired" type="httpheader"> * <param name="error">305</param> * <param name="errorMessage">this action must be accessed through a prozy</param> diff --git a/core/src/main/java/org/apache/struts2/result/PostbackResult.java b/core/src/main/java/org/apache/struts2/result/PostbackResult.java index ee14384cd..95b392716 100644 --- a/core/src/main/java/org/apache/struts2/result/PostbackResult.java +++ b/core/src/main/java/org/apache/struts2/result/PostbackResult.java @@ -36,12 +36,15 @@ import java.util.Map; /** * + ** A result that renders the current request parameters as a form which * immediately submits a postback * to the specified destination. + *
* - * + ** Parameters: + *
* **
* - * + *- location - http location to post the form
@@ -53,8 +56,9 @@ import java.util.Map; *- parse (true|false) - when set to true actionName, namespace and method are parsed, default "true"
** Examples: + *
** * <action name="registerThirdParty" > diff --git a/core/src/main/java/org/apache/struts2/result/ServletDispatcherResult.java b/core/src/main/java/org/apache/struts2/result/ServletDispatcherResult.java index 8d20e99c2..42bfbf32a 100644 --- a/core/src/main/java/org/apache/struts2/result/ServletDispatcherResult.java +++ b/core/src/main/java/org/apache/struts2/result/ServletDispatcherResult.java @@ -40,14 +40,17 @@ import java.util.Map; /** * - * + ** Includes or forwards to a view (usually a jsp). Behind the scenes Struts * will use a RequestDispatcher, where the target servlet/JSP receives the same * request/response objects as the original servlet/JSP. Therefore, you can pass * data between them using request.setAttribute() - the Struts action is * available. - *
+ * + * + ** There are three possible ways the result can be executed: + *
* ** @@ -65,7 +68,7 @@ import java.util.Map; *
* * - * This result type takes the following parameters: + *This result type takes the following parameters:
* * * @@ -79,7 +82,7 @@ import java.util.Map; * * * - * Example: + *Example:
* ** <result name="success" type="dispatcher"> @@ -87,7 +90,9 @@ import java.util.Map; * </result> ** + ** This result follows the same rules from {@link StrutsResultSupport}. + *
* * @see javax.servlet.RequestDispatcher */ diff --git a/core/src/main/java/org/apache/struts2/result/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/result/ServletRedirectResult.java index c3fe70b60..7f2e148fb 100644 --- a/core/src/main/java/org/apache/struts2/result/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/result/ServletRedirectResult.java @@ -47,7 +47,7 @@ import static javax.servlet.http.HttpServletResponse.SC_FOUND; /** * - * + ** Calls the {@link HttpServletResponse#sendRedirect(String) sendRedirect} * method to the location specified. The response is told to redirect the * browser to the specified location (a new request from the client). The @@ -56,11 +56,11 @@ import static javax.servlet.http.HttpServletResponse.SC_FOUND; * available. This is because actions are built on a single-thread model. The * only way to pass data is through the session or with web parameters * (url?name=value) which can be OGNL expressions. - * + *
* - * + ** This result type takes the following parameters: - * + *
* * *@@ -79,9 +79,10 @@ import static javax.servlet.http.HttpServletResponse.SC_FOUND; * * * - * + *
* Example: - * + *
+ * ** * <!-- diff --git a/core/src/main/java/org/apache/struts2/result/StreamResult.java b/core/src/main/java/org/apache/struts2/result/StreamResult.java index 8438fbc7a..7829e3c7e 100644 --- a/core/src/main/java/org/apache/struts2/result/StreamResult.java +++ b/core/src/main/java/org/apache/struts2/result/StreamResult.java @@ -32,14 +32,14 @@ import java.io.OutputStream; /** * - * + ** A custom Result type for sending raw data (via an InputStream) directly to the * HttpServletResponse. Very useful for allowing users to download content. - * + *
* - * + ** This result type takes the following parameters: - * + *
* * *@@ -73,8 +73,9 @@ import java.io.OutputStream; * provide
getContentType()to override that parameter for the current action. * * - * + ** Example: + *
* ** <result name="success" type="stream"> diff --git a/core/src/main/java/org/apache/struts2/result/StrutsResultSupport.java b/core/src/main/java/org/apache/struts2/result/StrutsResultSupport.java index bdb1b93f8..06a1f12e9 100644 --- a/core/src/main/java/org/apache/struts2/result/StrutsResultSupport.java +++ b/core/src/main/java/org/apache/struts2/result/StrutsResultSupport.java @@ -36,11 +36,15 @@ import java.util.Collection; /** * - * + ** A base class for all Struts action execution results. * The "location" param is the default parameter, meaning the most common usage of this result would be: - *
+ * + * + ** This class provides two common parameters for any subclass: + *
+ * **
* + *- location - the location to go to after execution (could be a jsp page or another action). * It can be parsed as per the rules definied in the @@ -50,54 +54,64 @@ import java.util.Collection; *
- encode - false by default. If set to false, the location param will not be url encoded. This only have effect when parse is true
** NOTE: * The encode param will only have effect when parse is true + *
* * * - * - * * * - * + ** In the struts.xml configuration file, these would be included as: - *
+ * + * ** <result name="success" type="redirect"> * <param name="location">foo.jsp</param> * </result>- * + * * or - * + * ** <result name="success" type="redirect" > * <param name="location">foo.jsp?url=${myUrl}</param> * <param name="parse">true</param> * <param name="encode">true</param> - * </result>- * - * In the above case, myUrl will be parsed against Ognl Value Stack and then - * URL encoded. - * + * </result> + * + * + *In the above case, myUrl will be parsed against Ognl Value Stack and then + * URL encoded.1 + *
+ ** or when using the default parameter feature - *
+ * + * *- * <result name="success" type="redirect">foo.jsp</result>- * + * <result name="success" type="redirect">foo.jsp</result> + * + ** You should subclass this class if you're interested in adding more parameters or functionality * to your Result. If you do subclass this class you will need to - * override {@link #doExecute(String, ActionInvocation)}.
- *
+ * override {@link #doExecute(String, ActionInvocation)}. + * + * + ** Any custom result can be defined in struts.xml as: - *
+ * + * ** <result-types> * ... * <result-type name="myresult" class="com.foo.MyResult" /> - * </result-types>- * - * Please see the {@link com.opensymphony.xwork2.Result} class for more info on Results in general. + * </result-types> + * * + *+ * Please see the {@link com.opensymphony.xwork2.Result} class for more info on Results in general. + *
* * * @see com.opensymphony.xwork2.Result diff --git a/core/src/main/java/org/apache/struts2/result/VelocityResult.java b/core/src/main/java/org/apache/struts2/result/VelocityResult.java index 810d191fb..2720209a0 100644 --- a/core/src/main/java/org/apache/struts2/result/VelocityResult.java +++ b/core/src/main/java/org/apache/struts2/result/VelocityResult.java @@ -53,9 +53,9 @@ import java.io.Writer; * streamed directly to the servlet output. * * - * + ** This result type takes the following parameters: - * + *
* * *@@ -71,14 +71,16 @@ import java.io.Writer; * * * - * + *
* Example: - * - *
+ * + ** */ public class VelocityResult extends StrutsResultSupport { @@ -170,8 +172,9 @@ public class VelocityResult extends StrutsResultSupport { /** * Retrieve the content type for this template. - * + *+ * * <result name="success" type="velocity"> * <param name="location">foo.vm</param> * </result> - *+ * + ** People can override this method if they want to provide specific content types for specific templates (eg text/xml). + *
* * @return The content type associated with this template (default "text/html") */ @@ -181,8 +184,9 @@ public class VelocityResult extends StrutsResultSupport { /** * Retrieve the encoding for this template. - * + ** People can override this method if they want to provide specific encodings for specific templates. + *
* * @return The encoding associated with this template (defaults to the value of 'struts.i18n.encoding' property) */ diff --git a/core/src/main/java/org/apache/struts2/util/AttributeMap.java b/core/src/main/java/org/apache/struts2/util/AttributeMap.java index 48498e3a9..4e95cb57f 100644 --- a/core/src/main/java/org/apache/struts2/util/AttributeMap.java +++ b/core/src/main/java/org/apache/struts2/util/AttributeMap.java @@ -32,14 +32,17 @@ import java.util.Set; /** * A Map that holds 4 levels of scope. - * - * The scopes are the ones known in the web world.: + *+ * The scopes are the ones known in the web world: + *
+ * **
+ * * A object is searched in the order above, starting from page and ending at application scope. * */ diff --git a/core/src/main/java/org/apache/struts2/util/Counter.java b/core/src/main/java/org/apache/struts2/util/Counter.java index aa5a6003c..08bec4208 100644 --- a/core/src/main/java/org/apache/struts2/util/Counter.java +++ b/core/src/main/java/org/apache/struts2/util/Counter.java @@ -26,9 +26,9 @@ import java.io.Serializable; /** * A bean that can be used to keep track of a counter. - * + *- Page scope
*- Request scope
*- Session scope
*- Application scope
** Since it is an Iterator it can be used by the iterator tag - * + *
*/ public class Counter implements java.util.Iterator, Serializable { diff --git a/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java b/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java index d01ec7a29..d37c79ffa 100644 --- a/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java +++ b/core/src/main/java/org/apache/struts2/util/StrutsTypeConverter.java @@ -28,19 +28,22 @@ import com.opensymphony.xwork2.conversion.impl.DefaultTypeConverter; /** * * + ** Base class for type converters used in Struts. This class provides two abstract methods that are used to convert - * both to and from strings -- the critical functionality that is core to Struts's type coversion system. - * - *
Type converters do not have to use this class. It is merely a helper base class, although it is recommended that + * both to and from strings -- the critical functionality that is core to Struts's type conversion system. + * + *Type converters do not have to use this class. It is merely a helper base class, although it is recommended that * you use this class as it provides the common type conversion contract required for all web-based type conversion. + *
* - * There's a hook (fall back method) calledperformFallbackConversionof which + *There's a hook (fall back method) called
* - * To allow the framework to recognize that a conversion error has occurred, throw an XWorkException or + *performFallbackConversionof which * could be used to perform some fallback conversion ifconvertValuemethod of this * failed. By default it just ask its super class (Ognl's DefaultTypeConverter) to do the conversion. + *To allow the framework to recognize that a conversion error has occurred, throw an XWorkException or * preferable a TypeConversionException. - * + *
* * */ diff --git a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java index 14265bba1..aee854fa6 100644 --- a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java +++ b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java @@ -144,8 +144,9 @@ public class StrutsUtil { /** * the selectedList objects are matched to the list.listValue - * + ** listKey and listValue are optional, and if not provided, the list item is used + *
* * @param selectedList the name of the action property * that contains the list of selected items diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java index 1508cb764..c4fde8099 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java @@ -55,11 +55,13 @@ import java.util.*; /** + ** Static Configuration Manager for the FreemarkerResult's configuration + *
* - * + *+ * Possible extension points are: * - * Possible extension points are :- *
*
* - * + *- createConfiguration method
*- loadSettings method
@@ -67,27 +69,31 @@ import java.util.*; *- populateContext method
** createConfiguration method
+ * * + *
* Create a freemarker Configuration. - ** loadSettings method
+ * * + *
* Load freemarker settings, default to freemarker.properties (if found in classpath) - ** createTemplateLoader method
+ * *
- * create a freemarker TemplateLoader that loads freemarker template in the following order :- + * create a freemarker TemplateLoader that loads freemarker template in the following order: + **
- * * + *- path defined in ServletContext init parameter named 'templatePath' or 'TemplatePath' (must be an absolute path)
*- webapp classpath
*- struts's static folder (under [STRUT2_SOURCE]/org/apache/struts2/static/
** populateContext method
*/ public class FreemarkerManager { @@ -289,8 +295,10 @@ public class FreemarkerManager { /** * Create the instance of the freemarker Configuration object. - * + *
* populate the created model. - * + ** this implementation + *
+ * **
- obtains the default configuration from Configuration.getDefaultConfiguration() *
- sets up template loading from a ClassTemplateLoader and a WebappTemplateLoader diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java index 0775f554f..b052da007 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerResult.java @@ -148,12 +148,14 @@ public class FreemarkerResult extends StrutsResultSupport { /** * Execute this result, using the specified template locationArg. - * - * The template locationArg has already been interoplated for any variable substitutions - * + *
+ * The template locationArg has already been interpolated for any variable substitutions + *
+ ** this method obtains the freemarker configuration and the object wrapper from the provided hooks. * It them implements the template processing workflow by calling the hooks for * preTemplateProcess and postTemplateProcess + *
*/ public void doExecute(String locationArg, ActionInvocation invocation) throws IOException, TemplateException { this.location = locationArg; @@ -230,27 +232,35 @@ public class FreemarkerResult extends StrutsResultSupport { } /** + ** This method is called from {@link #doExecute(String, ActionInvocation)} to obtain the * FreeMarker configuration object that this result will use for template loading. This is a * hook that allows you to custom-configure the configuration object in a subclass, or to fetch * it from an IoC container. - *
+ * + * + ** * The default implementation obtains the configuration from the ConfigurationManager instance. * + *
*/ protected Configuration getConfiguration() throws TemplateException { return freemarkerManager.getConfiguration(ServletActionContext.getServletContext()); } /** + ** This method is called from {@link #doExecute(String, ActionInvocation)} to obtain the * FreeMarker object wrapper object that this result will use for adapting objects into template * models. This is a hook that allows you to custom-configure the wrapper object in a subclass. - *
+ * + * + ** * The default implementation returns {@link Configuration#getObjectWrapper()} * + *
*/ protected ObjectWrapper getObjectWrapper() { return configuration.getObjectWrapper(); @@ -273,9 +283,10 @@ public class FreemarkerResult extends StrutsResultSupport { /** * Build the instance of the ScopesHashModel, including JspTagLib support - * + ** Objects added to the model are - *
+ * + * **
- Application - servlet context attributes hash model *
- JspTaglibs - jsp tag lib factory model diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java index 47ea5ef3d..98cec4b7f 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/ScopesHashModel.java @@ -35,13 +35,19 @@ import java.util.Map; /** + *
* Simple Hash model that also searches other scopes. - *
+ * + * + ** If the key doesn't exist in this hash, this template model tries to * resolve the key within the attributes of the following scopes, * in the order stated: Request, Session, Servlet Context + *
* + ** Updated to subclass AllHttpScopesHashModel.java to incorporate invisible scopes and compatibility with freemarker. + *
*/ public class ScopesHashModel extends SimpleHash implements TemplateModel { diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java b/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java index df9d64ae2..ad1222fbb 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/StrutsBeanWrapper.java @@ -36,17 +36,18 @@ import freemarker.template.TemplateModel; /** * - * + ** The StrutsBeanWrapper extends the default FreeMarker BeansWrapper and provides almost no change in functionality, * except for how it handles maps. Normally, FreeMarker has two modes of operation: either support for friendly * map built-ins (?keys, ?values, etc) but only support for String keys; OR no special built-in support (ie: ?keys * returns the methods on the map instead of the keys) but support for String and non-String keys alike. Struts * provides an alternative implementation that gives us the best of both worlds. + *
* - * It is possible that this special behavior may be confusing or can cause problems. Therefore, you can set the + *It is possible that this special behavior may be confusing or can cause problems. Therefore, you can set the * struts.freemarker.wrapper.altMap property in struts.properties to false, allowing the normal BeansWrapper * logic to take place instead. - * + *
* */ public class StrutsBeanWrapper extends BeansWrapper { diff --git a/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java b/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java index 8f498560a..9828eaf2f 100644 --- a/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java +++ b/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java @@ -118,9 +118,11 @@ public class VelocityManager { } /** + ** This method is responsible for creating the standard VelocityContext used by all WW2 velocity views. The * following context parameters are defined: - *
+ * + * **
- request - the current HttpServletRequest
*- response - the current HttpServletResponse
@@ -394,22 +396,24 @@ public class VelocityManager { /** - * + ** Instantiates a new VelocityEngine. *
- * + ** The following is the default Velocity configuration *
+ * ** resource.loader = file, class * file.resource.loader.path = real path of webapp * class.resource.loader.description = Velocity Classpath Resource Loader * class.resource.loader.class = org.apache.struts2.views.velocity.StrutsResourceLoader *- * + ** this default configuration can be overridden by specifying a struts.velocity.configfile property in the * struts.properties file. the specified config file will be searched for in the following order: *
+ * **
- relative to the servlet context path
*- relative to the WEB-INF directory
diff --git a/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java b/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java index 69a8ad33b..67202fc4c 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/AdapterFactory.java @@ -156,16 +156,22 @@ public class AdapterFactory { } /** + ** Construct a proxy adapter for a value that is an existing DOM Node. * This allows arbitrary DOM Node trees to be mixed in with our results. * The proxied nodes are read-only and currently support only * limited types of Nodes including Element, Text, and Attributes. (Other * Node types may be ignored by the proxy and not appear in the result tree). - *
+ * + * + ** // TODO: * NameSpaces are not yet supported. - *
+ * + * + ** This method is primarily for use by the adapter node classes. + *
*/ public Node proxyNode(AdapterNode parent, Node node) { // If the property is a Document, "unwrap" it to the root element diff --git a/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java index 59f77d02b..194d52bb9 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/StringAdapter.java @@ -57,13 +57,17 @@ public class StringAdapter extends AbstractAdapterElement { } /** + ** Get the object to be adapted as a String value. - *
+ * + * + ** This method can be overridden by subclasses that wish to use StringAdapter * as a simplified customizable XML adapter for Java types. A subclass can * enable parsing of the value string as containing XML text via the * setParseStringAsXML() method and then override getStringValue() to return a * String containing the custom formatted XML. + *
*/ protected String getStringValue() { return getPropertyValue().toString(); diff --git a/core/src/main/resources/org/apache/struts2/interceptor/wait.ftl b/core/src/main/resources/org/apache/struts2/interceptor/wait.ftl index ff87ccbe3..83bf03cd0 100644 --- a/core/src/main/resources/org/apache/struts2/interceptor/wait.ftl +++ b/core/src/main/resources/org/apache/struts2/interceptor/wait.ftl @@ -26,8 +26,8 @@ Please wait while we process your request... - - +This page will reload automatically and display your request when it is completed. +