This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch restful in repository https://gitbox.apache.org/repos/asf/struts-site.git
commit 8bdac77c9b10a9026475f5b747d57fae488792ea Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Fri Dec 8 09:12:06 2017 +0100 Cleans up annotations --- source/core-developers/after-annotation.md | 56 +++------------ source/core-developers/annotations.md | 42 ++++++----- source/core-developers/before-annotation.md | 55 +++----------- source/core-developers/before-result-annotation.md | 55 +++----------- source/core-developers/input-config-annotation.md | 52 +++----------- .../core-developers/parent-package-annotation.md | 18 ----- source/core-developers/result-annotation.md | 82 --------------------- source/core-developers/validation-annotation.md | 84 ++++++---------------- 8 files changed, 82 insertions(+), 362 deletions(-) diff --git a/source/core-developers/after-annotation.md b/source/core-developers/after-annotation.md index 5b89be5..0ce3c5f 100644 --- a/source/core-developers/after-annotation.md +++ b/source/core-developers/after-annotation.md @@ -1,57 +1,24 @@ --- -layout: core-developers +layout: default title: After Annotation +parent: + title: Annotations + url: annotations.html --- # After Annotation -## After Annotation +Marks a action method that needs to be called after the main action method and the result was executed. Return value is ignored. +## Usage +The After annotation can be applied at method level. -{% comment %}start snippet id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.After {% endcomment %} -<p> Marks a action method that needs to be called after the main action method and the result was - executed. Return value is ignored. -</p> -{% comment %}end snippet id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.After {% endcomment %} +## Parameters -### Usage +- `priority` (optional) - Priority order of method execution, default: *10* - - -{% comment %}start snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.After {% endcomment %} -<p> The After annotation can be applied at method level. - -</p> -{% comment %}end snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.After {% endcomment %} - -### Parameters - - - -{% comment %}start snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.After {% endcomment %} -<p> <table class='confluenceTable' summary=''> - <tr> - <th class='confluenceTh'> Parameter </th> - <th class='confluenceTh'> Required </th> - <th class='confluenceTh'> Default </th> - <th class='confluenceTh'> Notes </th> - </tr> - <tr> - <td class='confluenceTd'>priority</td> - <td class='confluenceTd'>no</td> - <td class='confluenceTd'>10</td> - <td class='confluenceTd'>Priority order of method execution</td> - </tr> - </table> -</p> -{% comment %}end snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.After {% endcomment %} - -### Examples - - - -{% comment %}start snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.After {% endcomment %} +## Examples ```java public class SampleAction extends ActionSupport { @@ -66,7 +33,4 @@ title: After Annotation return SUCCESS; } } - ``` - -{% comment %}end snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.After {% endcomment %} \ No newline at end of file diff --git a/source/core-developers/annotations.md b/source/core-developers/annotations.md index 623c5ee..2655675 100644 --- a/source/core-developers/annotations.md +++ b/source/core-developers/annotations.md @@ -1,6 +1,9 @@ --- -layout: core-developers +layout: default title: Annotations +parent: + title: Core Developers Guide + url: index.html --- # Annotations @@ -14,26 +17,26 @@ This page serves as a reference for all annotations across the framework. ## Action Annotations -Since 2.1, these annotations are provided by the _Convention Plugin_. Codebehind and Zero Config plugins are -deprecated from 2.1 on. +Since 2.1, these annotations are provided by the [Convention Plugin](../plugins/convention/). Codebehind and Zero Config +plugins are deprecated from 2.1 on. Action annotations are available when the framework scans the classpath for Action classes, rather than specifying -individual mappings through XML configuration. See the _Convention Plugin_ page for information on how to set up -classpath scanning to allow the use of Action annotations. +individual mappings through XML configuration. See the [Convention Plugin](../plugins/convention/) page for information +on how to set up classpath scanning to allow the use of Action annotations. |Annotation|Description| |----------|-----------| -|_Actions Annotation_ |Group of `@Action` annotations, maps multiple URLs to the same action| -|_Action Annotation_ |Defines the URL of an action| -|_InterceptorRefs Annotation_ |Gropup of `@InterceptorRef` annotations| -|_InterceptorRef Annotation_ |Interceptor, or interceptor stack to be applied to at action| -|_Results Annotation_ |Group of `@Result` annotations| -|[Result Annotation](result-annotation.html)|Defines a result for an action| +|[Actions Annotation](../plugins/convention/#action-annotation) |Group of `@Action` annotations, maps multiple URLs to the same action| +|[Action Annotation](../plugins/convention/#action-annotation) |Defines the URL of an action| +|[InterceptorRefs Annotation](../plugins/convention/#interceptorref-annotation) |Group of `@InterceptorRef` annotations| +|[InterceptorRef Annotation](../plugins/convention/#interceptorref-annotation) |Interceptor, or interceptor stack to be applied to at action| +|[Results Annotation](../plugins/convention/#result-annotation) |Group of `@Result` annotations| +|[Result Annotation](../plugins/convention/#result-annotation)|Defines a result for an action| |[Namespace Annotation](namespace-annotation.html)|Set the path of the action URL (used to overwrite the default)| -|_ResultPath Annotation_ |Set where the results are located (used to overwrite the default)| -|[ParentPackage Annotation](parent-package-annotation.html)|Set the parent package of the actions (used to overwrite the default)| -|_ExceptionMappings_ |Group of `@ExceptionMapping` annotations| -|_ExceptionMapping_ |Defines an exception mapping| +|[ResultPath Annotation](../plugins/convention/#resultpath-annotation) |Set where the results are located (used to overwrite the default)| +|[ParentPackage Annotation](..//plugins/convention/#parentpackage-annotation)|Set the parent package of the actions (used to overwrite the default)| +|[ExceptionMappings](../plugins/convention/#exceptionmapping-annotation) |Group of `@ExceptionMapping` annotations| +|[ExceptionMapping](../plugins/convention/#exceptionmapping-annotation) |Defines an exception mapping| ## Workflow Annotations @@ -43,7 +46,8 @@ classpath scanning to allow the use of Action annotations. ## Interceptor Annotations -To use these annotations, you have to specify the [AnnotationWorkflowInterceptor](annotation-workflow-interceptor.html) to your interceptor stack. +To use these annotations, you have to specify the [AnnotationWorkflowInterceptor](annotation-workflow-interceptor.html) +to your interceptor stack. |Annotation|Description| |----------|-----------| @@ -76,7 +80,7 @@ To use annotation-based validation, annotate the class or interface with [Valida ### Resources -- [Validation using Annotations](http://arsenalist.com/2007/05/10/struts-2-validation-using-annotations/)^[http://arsenalist.com/2007/05/10/struts-2-validation-using-annotations/] (arsenalist) +- [Validation using Annotations](http://arsenalist.com/2007/05/10/struts-2-validation-using-annotations/) (arsenalist) ## Type Conversion Annotations @@ -99,8 +103,8 @@ To use annotation-based type conversion, annotate the class or interface with th ## Tiles Annotations -The _Tiles Plugin_ provides it's own set of Annotations. They can be used to keep `tiles.xml` short. Instead tiles -definitions can be created by annotating actions. +The [Tiles Plugin](../plugins/tiles/) provides it's own set of Annotations. They can be used to keep `tiles.xml` short. +Instead tiles definitions can be created by annotating actions. |Annotation|Description| |----------|-----------| diff --git a/source/core-developers/before-annotation.md b/source/core-developers/before-annotation.md index 71a530b..67ba3c4 100644 --- a/source/core-developers/before-annotation.md +++ b/source/core-developers/before-annotation.md @@ -1,56 +1,24 @@ --- -layout: core-developers +layout: default title: Before Annotation +parent: + title: Annotations + url: annotations.html --- # Before Annotation -## Before Annotation +Marks a action method that needs to be executed before the main action method. +## Usage +The Before annotation can be applied at method level. -{% comment %}start snippet id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.Before {% endcomment %} -<p> Marks a action method that needs to be executed before the main action method. -</p> -{% comment %}end snippet id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.Before {% endcomment %} +## Parameters -### Usage +- `priority` (optional) - Priority order of method execution, default: *10* - - -{% comment %}start snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.Before {% endcomment %} -<p> The Before annotation can be applied at method level. - -</p> -{% comment %}end snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.Before {% endcomment %} - -### Parameters - - - -{% comment %}start snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.Before {% endcomment %} -<p> <table class='confluenceTable' summary=''> - <tr> - <th class='confluenceTh'> Parameter </th> - <th class='confluenceTh'> Required </th> - <th class='confluenceTh'> Default </th> - <th class='confluenceTh'> Notes </th> - </tr> - <tr> - <td class='confluenceTd'>priority</td> - <td class='confluenceTd'>no</td> - <td class='confluenceTd'>10</td> - <td class='confluenceTd'>Priority order of method execution</td> - </tr> - </table> -</p> -{% comment %}end snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.Before {% endcomment %} - -### Examples - - - -{% comment %}start snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.Before {% endcomment %} +## Examples ```java public class SampleAction extends ActionSupport { @@ -65,7 +33,4 @@ title: Before Annotation return SUCCESS; } } - ``` - -{% comment %}end snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.Before {% endcomment %} diff --git a/source/core-developers/before-result-annotation.md b/source/core-developers/before-result-annotation.md index 850f339..0c325ba 100644 --- a/source/core-developers/before-result-annotation.md +++ b/source/core-developers/before-result-annotation.md @@ -1,56 +1,24 @@ --- -layout: core-developers +layout: default title: BeforeResult Annotation +parent: + title: Annotations + url: annotations.html --- # BeforeResult Annotation -## BeforeResult Annotation +Marks a action method that needs to be executed before the result. Return value is ignored. +## Usage +The BeforeResult annotation can be applied at method level. -{% comment %}start snippet id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult {% endcomment %} -<p> Marks a action method that needs to be executed before the result. Return value is ignored. -</p> -{% comment %}end snippet id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult {% endcomment %} +## Parameters -### Usage +- `priority` (optional) - Priority order of method execution, default: *10* - - -{% comment %}start snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult {% endcomment %} -<p> The BeforeResult annotation can be applied at method level. - -</p> -{% comment %}end snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult {% endcomment %} - -### Parameters - - - -{% comment %}start snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult {% endcomment %} -<p> <table class='confluenceTable' summary=''> - <tr> - <th class='confluenceTh'> Parameter </th> - <th class='confluenceTh'> Required </th> - <th class='confluenceTh'> Default </th> - <th class='confluenceTh'> Notes </th> - </tr> - <tr> - <td class='confluenceTd'>priority</td> - <td class='confluenceTd'>no</td> - <td class='confluenceTd'>10</td> - <td class='confluenceTd'>Priority order of method execution</td> - </tr> - </table> -</p> -{% comment %}end snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult {% endcomment %} - -### Examples - - - -{% comment %}start snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult {% endcomment %} +## Examples ```java public class SampleAction extends ActionSupport { @@ -65,7 +33,4 @@ title: BeforeResult Annotation return SUCCESS; } } - ``` - -{% comment %}end snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.BeforeResult {% endcomment %} diff --git a/source/core-developers/input-config-annotation.md b/source/core-developers/input-config-annotation.md index 4489bdc..61f1606 100644 --- a/source/core-developers/input-config-annotation.md +++ b/source/core-developers/input-config-annotation.md @@ -1,60 +1,26 @@ --- -layout: core-developers +layout: default title: InputConfig Annotation +parent: + title: Annotations + url: annotations.html --- # InputConfig Annotation - -{% comment %}start snippet id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig {% endcomment %} -<p> Marks a action method that if it's not validated by ValidationInterceptor then execute input method or input result. -</p> -{% comment %}end snippet id=description|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig {% endcomment %} +Marks a action method that if it's not validated by `ValidationInterceptor` then execute `input` method or `input` result. ## Usage - - -{% comment %}start snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig {% endcomment %} -<p> The InputConfig annotation can be applied at method level. - -</p> -{% comment %}end snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig {% endcomment %} +The InputConfig annotation can be applied at method level. ## Parameters - - -{% comment %}start snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig {% endcomment %} -<p> <table class='confluenceTable' summary=''> - <tr> - <th class='confluenceTh'> Parameter </th> - <th class='confluenceTh'> Required </th> - <th class='confluenceTh'> Default </th> - <th class='confluenceTh'> Notes </th> - </tr> - <tr> - <td class='confluenceTd'>methodName</td> - <td class='confluenceTd'>no</td> - <td class='confluenceTd'></td> - <td class='confluenceTd'>execute this method if specific</td> - </tr> - <tr> - <td class='confluenceTd'>resultName</td> - <td class='confluenceTd'>no</td> - <td class='confluenceTd'></td> - <td class='confluenceTd'>return this result if methodName not specific</td> - </tr> - </table> -</p> -{% comment %}end snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig {% endcomment %} +- `methodName` (optional) - execute this method if specific +- `resultName` (optional) - return this result if methodName not specific ## Examples - - -{% comment %}start snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig {% endcomment %} - ```java public class SampleAction extends ActionSupport { @@ -74,5 +40,3 @@ title: InputConfig Annotation } ``` - -{% comment %}end snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.interceptor.annotations.InputConfig {% endcomment %} diff --git a/source/core-developers/parent-package-annotation.md b/source/core-developers/parent-package-annotation.md deleted file mode 100644 index 9de2c71..0000000 --- a/source/core-developers/parent-package-annotation.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: core-developers -title: ParentPackage Annotation ---- - -# ParentPackage Annotation - -The `@ParentPackage` annotation allows the definition of `Action`'s package for an action found via [Zero Configuration](zero-configuration.html)\. - -## Usage - -This annotation is placed at the class level\. - -## Parameters - -| Name | Type | Required | Description | -|------|------|----------|-------------| -| value | String | true | Names the package the action will inherit\. | diff --git a/source/core-developers/result-annotation.md b/source/core-developers/result-annotation.md deleted file mode 100644 index 835e83c..0000000 --- a/source/core-developers/result-annotation.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -layout: core-developers -title: Result Annotation ---- - -# Result Annotation - -The `@Result` annotation allows the definition of `Action` results in the `Action` class rather than an XML file\. - - - -| The @Result annotation lives at the Action_class_ level and not the method level\. This matches what is found in an XML\-based Action configuration\. **Do not be tempted to annotate your Action's methods; it will not work\.** - -| - -In order for `@Result` and `@Results` annotations to be configured correctly you must set the `actionPackages` filter `init-param` to a comma\-separated list of packages containing the annotated `Action` classes\. See [Zero Configuration](zero-configuration.html) for further information; there are `Action` class naming conventions if you don't implement the `Action` interface and other tidbits there\. - -## @Result Annotation Parameters - - - -~~~~~~~ -{float:right|width=300px} - {info} - See org.apache.struts2.config.Result annotation JavaDocs. - {info} -{float} -~~~~~~~ - -+ name \- Result name; default `Action.SUCCESS` -+ value \- Value of result (result destination) - -+ type \- Type of result; default `NullResult`\. For example: - - - + `NullResult.class` - + `FreemarkerResult.class` - + `PlainTextResult.class` - + `VelocityResult.class` - + `ServletDispatcherResult.class` - + `ServletRedirectResult.class` - + `ServletActionRedirectResult.class` \- equivalent to the `redirectAction` type in XML config - - + `TilesResult.class` - + \.\. (for more result, please consult the API docs, and look for implementations of the XWork `Result` interface) - -+ params \- An Array of the parameters in the form \{key1, value1, key2, value2\} - -## @Result – Defining a Single Result - -Map the "success" result (explicitly named) to a Tile definition named "/home\.page"\. - -**Defining a Single Result** - - -~~~~~~~ - -@Result(name="success", value="/home.page", type=TilesResult.class) -public class HomeAction extends ActionSupport { - // ... -} - -~~~~~~~ - -## @Results – Defining Multiple Results - -Defines a set of results for an `Action`\. - -**Defining Multiple Results** - - -~~~~~~~ - -@Results({ - @Result(name="success", value="/home.page", type=TilesResult.class), - @Result(name="homeError", value="/homeError.page", type=TilesResult.class) -}) -public class HomeAction extends ActionSupport { - // .... -} - -~~~~~~~ diff --git a/source/core-developers/validation-annotation.md b/source/core-developers/validation-annotation.md index cf423aa..207df1e 100644 --- a/source/core-developers/validation-annotation.md +++ b/source/core-developers/validation-annotation.md @@ -1,60 +1,30 @@ --- -layout: core-developers +layout: default title: Validation Annotation +parent: + title: Annotations + url: annotations.html --- # Validation Annotation - - -{% comment %}start snippet id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} -<p> This annotation has been deprecated since 2.1 as its previous purpose, to define classes that support annotation validations, - is no longer necessary. -</p> -{% comment %}end snippet id=description|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} +This annotation has been deprecated since 2.1 as its previous purpose, to define classes that support annotation validations, +is no longer necessary. ## Usage - - -{% comment %}start snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} -<p> <p>The Validation annotation must be applied at Type level.</p> -</p> -{% comment %}end snippet id=usage|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} +Validation annotation must be applied at Type level. ## Parameters - - -{% comment %}start snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} -<p> <table class='confluenceTable' summary=''> - <tr> - <th class='confluenceTh'> Parameter </th> - <th class='confluenceTh'> Required </th> - <th class='confluenceTh'> Default </th> - <th class='confluenceTh'> Notes </th> - </tr> - <tr> - <td class='confluenceTd'>validations</td> - <td class='confluenceTd'>yes</td> - <td class='confluenceTd'> </td> - <td class='confluenceTd'></td> - </tr> - </table> -</p> -{% comment %}end snippet id=parameters|javadoc=true|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} +- `validations` - list of validations to apply ## Examples -**An Annotated Interface** - -+ Mark the interface with @Validation() - -+ Apply standard or custom annoations at method level - +### An Annotated Interface - -{% comment %}start snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} +- Mark the interface with `@Validation()` +- Apply standard or custom annotations at method level ```java @Validation() @@ -73,12 +43,7 @@ title: Validation Annotation ``` -{% comment %}end snippet id=example|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} - -**An Annotated Class** - - -{% comment %}start snippet id=example2|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} +### An Annotated Class ```java @Validation() @@ -122,22 +87,15 @@ title: Validation Annotation } } - ``` -{% comment %}end snippet id=example2|javadoc=true|lang=java|url=com.opensymphony.xwork2.validator.annotations.Validation {% endcomment %} - - -> - -> - -> When multiple methods are used to map different actions on the same class, and one of them is annotated with _@Validations_ , those validators will be triggered for all the actions, unless they are annotated with @SkipValidation or _validateAnnotatedMethodOnly_ is set to _true_ in the "validation" interceptor, like: +When multiple methods are used to map different actions on the same class, and one of them is annotated with `@Validations`, +those validators will be triggered for all the actions, unless they are annotated with `@SkipValidation` or `validateAnnotatedMethodOnly` +is set to `true` in the `validation` interceptor, like: -> - > \<interceptor\-ref name="validation"\> - > \<param name="validateAnnotatedMethodOnly"\>true\</param\> - > \<param name="excludeMethods"\>input,back,cancel,browse\</param\> - > \</interceptor\-ref\> - > - \ No newline at end of file +```xml +<interceptor-ref name="validation"> + <param name="validateAnnotatedMethodOnly">true</param> + <param name="excludeMethods">input,back,cancel,browse</param> +</interceptor-ref> +``` -- To stop receiving notification emails like this one, please contact "commits@struts.apache.org" <commits@struts.apache.org>.