http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/annotations.html ---------------------------------------------------------------------- diff --git a/content/docs/annotations.html b/content/docs/annotations.html new file mode 100644 index 0000000..dfba092 --- /dev/null +++ b/content/docs/annotations.html @@ -0,0 +1,237 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<html> +<head> + <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css"> + <style type="text/css"> + .dp-highlighter { + width:95% !important; + } + </style> + <style type="text/css"> + .footer { + background-image: url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif'); + background-repeat: repeat-x; + background-position: left top; + padding-top: 4px; + color: #666; + } + </style> + <script type="text/javascript" language="javascript"> + var hide = null; + var show = null; + var children = null; + + function init() { + /* Search form initialization */ + var form = document.forms['search']; + if (form != null) { + form.elements['domains'].value = location.hostname; + form.elements['sitesearch'].value = location.hostname; + } + + /* Children initialization */ + hide = document.getElementById('hide'); + show = document.getElementById('show'); + children = document.all != null ? + document.all['children'] : + document.getElementById('children'); + if (children != null) { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + } + + function showChildren() { + children.style.display = 'block'; + show.style.display = 'none'; + hide.style.display = 'inline'; + } + + function hideChildren() { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + </script> + <title>Annotations</title> +</head> +<body onload="init()"> +<table border="0" cellpadding="2" cellspacing="0" width="100%"> + <tr class="topBar"> + <td align="left" valign="middle" class="topBarDiv" align="left" nowrap> + <a href="home.html">Home</a> > <a href="guides.html">Guides</a> > <a href="core-developers-guide.html">Core Developers Guide</a> > <a href="annotations.html">Annotations</a> + </td> + <td align="right" valign="middle" nowrap> + <form name="search" action="https://www.google.com/search" method="get"> + <input type="hidden" name="ie" value="UTF-8" /> + <input type="hidden" name="oe" value="UTF-8" /> + <input type="hidden" name="domains" value="" /> + <input type="hidden" name="sitesearch" value="" /> + <input type="text" name="q" maxlength="255" value="" /> + <input type="submit" name="btnG" value="Google Search" /> + </form> + </td> + </tr> +</table> + +<div id="PageContent"> + <div class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div> + <div style="margin: 0px 10px 8px 10px" class="pagetitle">Annotations</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14017"> + <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14017">Edit Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW"> + <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif" + height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a> + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a> + + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14017"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14017">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14017"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add News"></a> + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14017">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><p>In many places, applications can use Java 5 annotations as an alternative to XML and Java properties configuration. This page serves as a reference for all annotations across the framework.</p><h2 id="Annotations-ActionAnnotations">Action Annotations</h2><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Since 2.1, these annotations are provided by the <a shape="rect" href="convention-plugin.html">Convention Plugin</a>. Codebehind and Zero Config plugins are deprecated from 2.1 on.</p></div></div><p>Action annotations are available when the framework scans the classpath for Action classes, rather than specifying individual mappings through XML configuration. See the <a shape="rect" href="convention-plugin.html">Convention Plugin</a> page for information on how to set u p classpath scanning to allow the use of Action annotations.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Annotation</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">Actions Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Group of @Action annotations, maps multiple URLs to the same action</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">Action Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Defines the URL of an action</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">InterceptorRefs Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Gropup of @InterceptorRef annotati ons</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">InterceptorRef Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Interceptor, or interceptor stack to be applied to at action</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">Results Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Group of @Result annotations</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">Result Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Defines a result for an action</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">Namespace Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set the path of the action URL (used to overwrite the default)</p></td>< /tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">ResultPath Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set where the results are located (used to overwrite the default)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">ParentPackage Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set the parent package of the actions (used to overwrite the default)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">ExceptionMappings</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Group of @ExceptionMapping annotations</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="convention-plugin.html">ExceptionMapping</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Defines an exception mapping</p>< /td></tr></tbody></table></div><h2 id="Annotations-WorkflowAnnotations">Workflow Annotations</h2><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Annotation</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="inputconfig-annotation.html">InputConfig Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Defines what method to execute, or result to be returned if there are validation errors</p></td></tr></tbody></table></div><h2 id="Annotations-InterceptorAnnotations">Interceptor Annotations</h2><p>To use these annotations, you have to specify the <a shape="rect" href="annotationworkflowinterceptor.html">AnnotationWorkflowInterceptor</a> to your interceptor stack.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Anno tation</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="after-annotation.html">After Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Marks a action method that needs to be executed after the result.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="before-annotation.html">Before Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Marks a action method that needs to be executed before the main action method.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="beforeresult-annotation.html">BeforeResult Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Marks a action method that needs to be executed before the result.</p></td></tr></tbody></table></div><h2 id="Annotations-ValidationAnnotations">Validation Annotations</h2> <p>To use annotation-based validation, annotate the class or interface with <a shape="rect" href="validation-annotation.html">Validation Annotation</a>.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Annotation</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="conversionerrorfieldvalidator-annotation.html">ConversionErrorFieldValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Checks if there are any conversion errors for a field.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="daterangefieldvalidator-annotation.html">DateRangeFieldValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Checks that a date field has a value within a specified range.</p></td></tr><tr><td colspan="1" rowspan="1" cla ss="confluenceTd"><p><a shape="rect" href="doublerangefieldvalidator-annotation.html">DoubleRangeFieldValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Checks that a double field has a value within a specified range.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="emailvalidator-annotation.html">EmailValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Checks that a field is a valid e-mail address.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="expressionvalidator-annotation.html">ExpressionValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Validates an expression.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="fieldexpressionvalidator-annotation.html">FieldExpressionValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Uses an OGNL expression to perform its validator.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="intrangefieldvalidator-annotation.html">IntRangeFieldValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Checks that a numeric field has a value within a specified range.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="regexfieldvalidator-annotation.html">RegexFieldValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Validates a regular expression for a field.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="requiredfieldvalidator-annotation.html">RequiredFieldValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Checks that a field is non-null.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="requiredstringvalidator-annotation.h tml">RequiredStringValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Checks that a String field is not empty.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="stringlengthfieldvalidator-annotation.html">StringLengthFieldValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Checks that a String field is of the right length.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="urlvalidator-annotation.html">UrlValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Checks that a field is a valid URL.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="validation-annotation.html">Validation Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Marker annotation for validation at Type level.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <p><a shape="rect" href="validations-annotation.html">Validations Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Used to group validation annotations.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="visitorfieldvalidator-annotation.html">VisitorFieldValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Invokes the validation for a property's object type.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="customvalidator-annotation.html">CustomValidator Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Use this annotation for your custom validator types.</p></td></tr></tbody></table></div><h3 id="Annotations-Resources">Resources</h3><ul><li><a shape="rect" class="external-link" href="http://arsenalist.com/2007/05/10/struts-2-validation-using-annotations/" rel="nofollow">Validation using Annotations</a> (arsenalist)</li> </ul><h2 id="Annotations-TypeConversionAnnotations">Type Conversion Annotations</h2><p>By default, type conversion for Maps and Collections using generics is directly supported.</p><p>In short, instead of specifying the types found in collections and maps as documented in <a shape="rect" href="type-conversion.html">Type Conversion</a>, <strong>the collection's generic type is used</strong>. By using annotations, an application should be able to avoid using any <code>ClassName-conversion.properties</code> files.</p><p>To use annotation-based type conversion, annotate the class or interface with the <a shape="rect" href="conversion-annotation.html">Conversion Annotation</a>.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Annotation</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="conversion-annotatio n.html">Conversion Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Marker annotation for type conversions at Type level.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="createifnull-annotation.html">CreateIfNull Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For Collection and Map types: Create the types within the Collection or Map, if null.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="element-annotation.html">Element Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For Generic types: Specify the element type for Collection types and Map values.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="key-annotation.html">Key Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For Generic types: Specify the key type for Map keys.</p></td></tr><tr><td colspan= "1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="keyproperty-annotation.html">KeyProperty Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>For Generic types: Specify the key property name value.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" href="typeconversion-annotation.html">TypeConversion Annotation</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Used for class and application wide conversion rules.</p></td></tr></tbody></table></div><h2 id="Annotations-TilesAnnotations">Tiles Annotations</h2><p>The <a shape="rect" href="tiles-plugin.html">Tiles Plugin</a> provides it's own set of Annotations. They can be used to keep <code>tiles.xml</code> short. Instead tiles definitions can be created by annotating actions.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">Annotation</th><th colspan="1" rowspan="1" class="confluenceT h">Description</th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">TilesDefinition</td><td colspan="1" rowspan="1" class="confluenceTd">Represents a <code><definition></code> element in <code>tiles.xml</code></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">TilesDefinitions</td><td colspan="1" rowspan="1" class="confluenceTd">A list of <code>TilesDefinition</code> Annotations</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>TilesPutAttribute</p></td><td colspan="1" rowspan="1" class="confluenceTd">Represents a <code><put-attribute></code> element in <code>tiles.xml</code></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">TilesPutListAttribute</td><td colspan="1" rowspan="1" class="confluenceTd">Represents a <code><put-list-attribute></code> element in <code>tiles.xml</code></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">TilesAddAttribute</td><td colspan="1" rowspan="1" class="confluenceTd">Represents a <code><add-attribute></code> element in <code>tiles.xml</code></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">TilesAddListAttribute</td><td colspan="1" rowspan="1" class="confluenceTd">Represents a <code><add-list-attribute></code> element in <code>tiles.xml</code></td></tr></tbody></table></div><p> </p><h2 id="Annotations-Next:">Next: <a shape="rect" href="configuration-elements.html">Configuration Elements</a></h2></div> + </div> + + <div class="tabletitle"> + Children + <span class="smalltext" id="show" style="display: inline;"> + <a href="javascript:showChildren()">Show Children</a></span> + <span class="smalltext" id="hide" style="display: none;"> + <a href="javascript:hideChildren()">Hide Children</a></span> + </div> + <div class="greybox" id="children" style="display: none;"> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + $page.link($child) + <span class="smalltext">(Apache Struts 2 Documentation)</span> + <br> + </div> + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html>
http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/annotationworkflowinterceptor.html ---------------------------------------------------------------------- diff --git a/content/docs/annotationworkflowinterceptor.html b/content/docs/annotationworkflowinterceptor.html new file mode 100644 index 0000000..122fb70 --- /dev/null +++ b/content/docs/annotationworkflowinterceptor.html @@ -0,0 +1,223 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<html> +<head> + <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css"> + <style type="text/css"> + .dp-highlighter { + width:95% !important; + } + </style> + <style type="text/css"> + .footer { + background-image: url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif'); + background-repeat: repeat-x; + background-position: left top; + padding-top: 4px; + color: #666; + } + </style> + <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> + <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> + <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> + <script type="text/javascript"> + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all(); + </script> + <script type="text/javascript" language="javascript"> + var hide = null; + var show = null; + var children = null; + + function init() { + /* Search form initialization */ + var form = document.forms['search']; + if (form != null) { + form.elements['domains'].value = location.hostname; + form.elements['sitesearch'].value = location.hostname; + } + + /* Children initialization */ + hide = document.getElementById('hide'); + show = document.getElementById('show'); + children = document.all != null ? + document.all['children'] : + document.getElementById('children'); + if (children != null) { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + } + + function showChildren() { + children.style.display = 'block'; + show.style.display = 'none'; + hide.style.display = 'inline'; + } + + function hideChildren() { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + </script> + <title>AnnotationWorkflowInterceptor</title> +</head> +<body onload="init()"> +<table border="0" cellpadding="2" cellspacing="0" width="100%"> + <tr class="topBar"> + <td align="left" valign="middle" class="topBarDiv" align="left" nowrap> + <a href="home.html">Home</a> > <a href="guides.html">Guides</a> > <a href="core-developers-guide.html">Core Developers Guide</a> > <a href="annotations.html">Annotations</a> > <a href="annotationworkflowinterceptor.html">AnnotationWorkflowInterceptor</a> + </td> + <td align="right" valign="middle" nowrap> + <form name="search" action="https://www.google.com/search" method="get"> + <input type="hidden" name="ie" value="UTF-8" /> + <input type="hidden" name="oe" value="UTF-8" /> + <input type="hidden" name="domains" value="" /> + <input type="hidden" name="sitesearch" value="" /> + <input type="text" name="q" maxlength="255" value="" /> + <input type="submit" name="btnG" value="Google Search" /> + </form> + </td> + </tr> +</table> + +<div id="PageContent"> + <div class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div> + <div style="margin: 0px 10px 8px 10px" class="pagetitle">AnnotationWorkflowInterceptor</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14252"> + <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14252">Edit Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW"> + <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif" + height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a> + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a> + + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14252"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14252">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14252"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add News"></a> + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14252">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><h1 id="AnnotationWorkflowInterceptor-AnnotationWorkflowInterceptorInterceptor">AnnotationWorkflowInterceptor Interceptor</h1> + +<p></p><p>Invokes any annotated methods on the action. Specifically, it supports the following +annotations:</p> +<ul><li> @Before - will be invoked before the action method. If the returned value is not null, it is +returned as the action result code</li><li> @BeforeResult - will be invoked after the action method but before the result execution</li><li> @After - will be invoked after the action method and result execution</li></ul> + +<p></p><p>There can be multiple methods marked with the same annotations, but the order of their execution +is not guaranteed. However, the annotated methods on the superclass chain are guaranteed to be invoked before the +annotated method in the current class in the case of a Before annotations and after, if the annotations is +After.</p> + +<h2 id="AnnotationWorkflowInterceptor-Examples">Examples</h2> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ + 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"; + } + } +]]></script> +</div></div> +<p>Configure a stack in struts.xml that replaces the PrepareInterceptor with the AnnotationWorkflowInterceptor:</p> +<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"> +<interceptor-stack name="annotatedStack"> + <interceptor-ref name="static-params"/> + <interceptor-ref name="params"/> + <interceptor-ref name="conversionError"/> + <interceptor-ref name="annotationWorkflow"/> +</interceptor-stack> +</pre> +</div></div> +<p>Given an Action, AnnotatedAction, add a reference to the AnnotationWorkflowInterceptor interceptor.</p> +<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;"> +<action name="AnnotatedAction" class="com.examples.AnnotatedAction"> + <interceptor-ref name="annotationWorkflow"/> + <result name="success" type="freemarker">good_result.ftl</result> +</action> +</pre> +</div></div> +<p></p><p>With the interceptor applied and the action executed on <code>AnnotatedAction</code> the log +instance variable will contain <code>baseBefore-before-execute-beforeResult-after</code>.</p></div> + </div> + + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html> http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-1.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-1.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-1.jpeg new file mode 100644 index 0000000..111f69b Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-1.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-2.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-2.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-2.jpeg new file mode 100644 index 0000000..f92d3d8 Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-2.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-3.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-3.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-3.jpeg new file mode 100644 index 0000000..925fb57 Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-3.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-4.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-4.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-4.jpeg new file mode 100644 index 0000000..9ad04c5 Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-4.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-5.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-5.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-5.jpeg new file mode 100644 index 0000000..9cb52b3 Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-5.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-6.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-6.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-6.jpeg new file mode 100644 index 0000000..ff8d03f Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-6.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-7.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-7.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-7.jpeg new file mode 100644 index 0000000..15db518 Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-7.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-8.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-8.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-8.jpeg new file mode 100644 index 0000000..92c2358 Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-8.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-1.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-1.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-1.jpeg new file mode 100644 index 0000000..3ea4d49 Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-1.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-2.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-2.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-2.jpeg new file mode 100644 index 0000000..c8743e0 Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-2.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-3.jpeg ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-3.jpeg b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-3.jpeg new file mode 100644 index 0000000..c5fc3e4 Binary files /dev/null and b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-3.jpeg differ http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.html ---------------------------------------------------------------------- diff --git a/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.html b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.html new file mode 100644 index 0000000..ae834b0 --- /dev/null +++ b/content/docs/apache-struts-pseudo-nightly-builds-on-apache-hudson.html @@ -0,0 +1,247 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<html> +<head> + <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css"> + <style type="text/css"> + .dp-highlighter { + width:95% !important; + } + </style> + <style type="text/css"> + .footer { + background-image: url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif'); + background-repeat: repeat-x; + background-position: left top; + padding-top: 4px; + color: #666; + } + </style> + <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> + <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> + <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> + <script type="text/javascript"> + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all(); + </script> + <script type="text/javascript" language="javascript"> + var hide = null; + var show = null; + var children = null; + + function init() { + /* Search form initialization */ + var form = document.forms['search']; + if (form != null) { + form.elements['domains'].value = location.hostname; + form.elements['sitesearch'].value = location.hostname; + } + + /* Children initialization */ + hide = document.getElementById('hide'); + show = document.getElementById('show'); + children = document.all != null ? + document.all['children'] : + document.getElementById('children'); + if (children != null) { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + } + + function showChildren() { + children.style.display = 'block'; + show.style.display = 'none'; + hide.style.display = 'inline'; + } + + function hideChildren() { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + </script> + <title>Apache Struts Pseudo-Nightly Builds on Apache Hudson</title> +</head> +<body onload="init()"> +<table border="0" cellpadding="2" cellspacing="0" width="100%"> + <tr class="topBar"> + <td align="left" valign="middle" class="topBarDiv" align="left" nowrap> + <a href="home.html">Home</a> > <a href="guides.html">Guides</a> > <a href="contributors-guide.html">Contributors Guide</a> > <a href="apache-struts-pseudo-nightly-builds-on-apache-hudson.html">Apache Struts Pseudo-Nightly Builds on Apache Hudson</a> + </td> + <td align="right" valign="middle" nowrap> + <form name="search" action="https://www.google.com/search" method="get"> + <input type="hidden" name="ie" value="UTF-8" /> + <input type="hidden" name="oe" value="UTF-8" /> + <input type="hidden" name="domains" value="" /> + <input type="hidden" name="sitesearch" value="" /> + <input type="text" name="q" maxlength="255" value="" /> + <input type="submit" name="btnG" value="Google Search" /> + </form> + </td> + </tr> +</table> + +<div id="PageContent"> + <div class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div> + <div style="margin: 0px 10px 8px 10px" class="pagetitle">Apache Struts Pseudo-Nightly Builds on Apache Hudson</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=107776"> + <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=107776">Edit Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW"> + <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif" + height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a> + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a> + + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=107776"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=107776">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=107776"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add News"></a> + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=107776">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><h1 id="ApacheStrutsPseudo-NightlyBuildsonApacheHudson-ApacheStrutsPseudo-NightlyBuildsonApacheHudson">Apache Struts Pseudo-Nightly Builds on Apache Hudson</h1> + + +<p>Apache Struts has moved their Continuous Integration builds over to the Apache owned instance of Hudson. Hudson is a popular open source CI server with a plugin interface that allows for flexible building and management. More information and documentation about Hudson is available here - <a shape="rect" class="external-link" href="https://hudson.dev.java.net/" rel="nofollow">https://hudson.dev.java.net/</a>. Out of the box, Hudson supports SVN and Apache Maven, which makes it a good fit for Apache Struts. The Apache instance of Hudson is used by a few other projects, but has more than enough cycles available for our needs. One advantage of using Hudson hosted by Apache is that other committers will be able to gain access to both the Hudson web-app performing the builds and the host that houses the Hudson web-app. To request access to the Hudson zone and Hudson web-app, any PMC member can follow the instructions outlined here - <a shape="rect" class="external-link" href="http://wi ki.apache.org/general/Hudson">http://wiki.apache.org/general/Hudson</a>.</p> + +<h2 id="ApacheStrutsPseudo-NightlyBuildsonApacheHudson-UserInformation">User Information</h2> + +<p>Hudson is currently setup to perform our SNAPSHOT builds. SNAPSHOT builds are not considered stable, but many developers use these builds because they will often contain the latest features and fixes. The price for using the latest and greatest is that you run the risk of stumbling across previously undiscovered bugs. If you are using a SNAPSHOT build and encounter a problem with the framework, then you should first ask about the problem on the u...@struts.apache.org mailing list. Most of the Struts developers actively provide support on the user mailing list and will most likely indicate whether there is a workaround or if a bug report should be filed. To join the mailing list, follow the instructions <a shape="rect" class="external-link" href="http://struts.apache.org/mail.html">here</a>, bugs are filed <a shape="rect" class="external-link" href="https://issues.apache.org/struts/secure/Dashboard.jspa">here</a>.</p> + +<p>To see the results of the latest and previous Hudson builds, you can visit the Struts view on Hudson <a shape="rect" class="external-link" href="http://hudson.zones.apache.org/hudson/view/Struts/">here</a>. As part of the build process, Hudson is configured to deploy the artifacts to the snapshot repository. Rather than downloading the artifacts directly from Hudson, it is easier to configure your project to grab the snapshots from the snapshot repository. This is quite easy if you are using Maven, check <a shape="rect" class="external-link" href="http://struts.apache.org/dev/builds.html#MavenSnapshots">here</a> for information on adding the Struts Snapshot Repository. If you do not use Maven, Hudson also pushes out downloadable copies of our libraries, documentation and reference applications. You can download those <a shape="rect" class="external-link" href="http://people.apache.org/builds/struts/nightlies/">here</a>. We refer to these zips as "Pseudo-Nightly" builds because th ey will be generated once a day, if there has been a change to the source code since the last time the zips were generated. There will be a fixed number of the zips laying around in this folder since recent changes are not always fully tested. This way, you can grab a build from a few builds ago in case a recent change is causing problems. The name of the zip file includes the date and time that the file was transferred to the web server. The transfer happens for each successful build, but the transfer can also be launched manually. </p> + +<h2 id="ApacheStrutsPseudo-NightlyBuildsonApacheHudson-BuildSetup-HighLevel">Build Setup - High Level</h2> + +<p>Hudson's build facility is somewhat simple. You tell it where to grab the source and then it will build. Each build will checkout what you tell it to and begin building from the directory you specify. This only presents a few minor problems. My first thought was to check out the entire source tree and then dive into each individual directory (maven, struts1, struts2, sandbox) and launch a build. This did not work since Hudson wants to do one build at a time. Also, it does not allow you (as far as I could tell) to specify the same workspace for subsequent builds. Fortunately, this was relatively easy to work around. The Struts 1. x and Struts 2.x builds depend on the struts-master and struts-annotations artifacts. Although these artifacts are published to the public Maven repositories, they contain information that the other builds need. For instance, the top-level pom.xml in the struts2 source directory declares struts-master as it's parent. To make this work, I setup struts-mast er and struts-annotations as their own builds in Hudson. The build setup for these two simply points to their source directory in SVN and runs the clean and install maven goals. This way, both artifacts are installed into the local maven repository for Hudson. After that, I setup builds for both the struts1 and struts2 directories in SVN.</p> + +<h2 id="ApacheStrutsPseudo-NightlyBuildsonApacheHudson-BuildSetup-Struts1.x">Build Setup - Struts 1.x</h2> + +<p>The Struts 1.x build is done the same way that a person would do it. Hudson is directed to check for changes in SVN, if the source has changed since the last build, launch a new build. Let's take a look at the current setup - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-1.jpeg"></span></p> + +<p>Currently, the build is not setup to throw away previous builds or enable parameters. There are no needs for parameterized builds since Hudson allows us to specify the Maven goals we want to build. No one has complained yet about the space we are taking up on the Hudson zone, so there is also no need to throw away previous builds. Moving down a little further - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-2.jpeg"></span></p> + +<p>The Struts 1.x build does not currently require any batch tasks. In the Struts 2.x builds, as you will see below, batch tasks are used to fix permissions and push out the nightlies from the assembly goal. More on this later. We do not use the "Promote Builds" functionality. The option to "Disable Build" is left unchecked so that builds will happen as scheduled. If there is a compile problem and Hudson is spamming the d...@struts.apache.org mailing list, this option can be checked to stop Hudson from attempting to build while we work on a solution. JDK 6 is used for the builds, but this should not cause any problems since our pom.xml files seem to all specify that the target platform is 1.5. The "Tie Project to Node" box is checked because I want the builds to happen on the Hudson zone. Since struts-master is installed into the Hudson zone's hudson user, I am not sure if pushing the build to another node would work. This option forces builds to stay on the Hudson zone server. Movin g along -</p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-3.jpeg"></span></p> + +<p>The "Quiet Period" is not used. This feature can be useful if commits were done in a way that meant that builds should wait a bit before beginning. Since we are only checking SVN once daily for this build, there is no need for a "Quiet Period." The Source Repository points directly to the trunk struts1 directory. Hudson will check out struts1/trunk and create a workspace from there. Moving along - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-4.jpeg"></span></p> + +<p>The "local module directory" option allows us to specify a name for the folder that gets checked out. Otherwise, it would be named "trunk," so I went ahead and called it struts1. By checking the "use update" option, the builds will go faster. The downside is that unversioned files may stick around in the workspace. To remedy this, I run the "clean" goal as part of the build. I also leave it up to Hudson to try to figure out which repository browser is in place. Moving along - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-5.jpeg"></span></p> + +<p>This screencap shows the triggers that can cause Hudson to launch a build. The first option, when SNAPSHOT dependencies are built, is likely never to launch a build in our case. Currently, we are not using any external SNAPSHOT dependencies, and as far as I know, Hudson would only know if a SNAPSHOT dependency is built if this instance of Hudson builds it. I am leaving it checked as a just-in-case type of trigger. The second option checked, Poll SCM, is likely to be the trigger that fires our builds. The current schedule "30 9 * * *" is very similar to CRON. The struts1 build is scheduled to check SVN every day at 9:30AM. If it detects a change since the last build, a full build will begin. Moving along - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-6.jpeg"></span></p> + +<p>The Maven configuration is straightforward. The Heap and PermGen settings were added because I have had problems on Linux building without them. We do not use a private repository because we all of our external dependencies are non-SNAPSHOT. The modules are not currently built in parallel, but if the length of time to build becomes an issue, we could try turning this one. Moving along - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-7.jpeg"></span></p> + +<p>None of these build settings are currently enabled. In the next few days I will try to enable the notification emails so that successful or failed builds are sent to d...@struts.apache.org. Currently no emails are sent because I have been making frequent changes to the build configurations. Moving along - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts1-8.jpeg"></span></p> + +<p>The build lock is setup so that we only perform one struts build at a time on Hudson. Part of this is based on wanting to be a good guest on the Apache Hudson instance, but this lock may also become necessary if we begin building sandbox artifacts. </p> + +<p>The struts1 build is an easy-to-follow setup and has run a few times without problems. Next, we will take a look at the struts2 build which is very similar but has configuration added to handle deployment of SNAPSHOTs and the zips from the assembly module. </p> + + +<h2 id="ApacheStrutsPseudo-NightlyBuildsonApacheHudson-BuildSetup-Struts2.x">Build Setup - Struts 2.x</h2> + +<p>The Struts 2.x build is very similar to the Struts 1.x builds. There is added logic for deploying SNAPSHOT artifacts and pushing nightly builds from the assembly module. Let's take a look at the configuration - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-1.jpeg"></span></p> + +<p>The batch task setup for Hudson allows for tasks to be executed as part of a build. The tasks configured here are the sort of things that would generally be run manually. This facility allows tasks to be run in a way that is tracked. Adding tasks to this section of the configuration does not mark the tasks to be run automatically, it simply makes them available. Further down in the configuration, the tasks are flagged to be run after the build is complete. </p> + +<p>The first batch task listed will log into people.apache.org and add the group writeable flag to all the files that this build just deploys. Hudson logs into people.apache.org as 'wesw' because the public ssh key for the hudson user account on the hudson zone is setup in the 'wesw' account on people.apache.org. Since Hudson logs into people.apache.org as 'wesw,' when SNAPSHOT artifacts are deployed, they are owned by 'wesw.' The umask is setup on people.apache.org so that files are created with group read but not group write permissions. Changing the permissions allows other struts developers (other than 'wesw') to make changes or manually push the files from somewhere other than Hudson. </p> + +<p>The second batch task publishes the nightly files by calling a shell script. The contents of the script are listed below -</p> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>nightly-2.x.sh</b></div><div class="codeContent panelContent pdl"> +<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;"> +#!/bin/bash + +TODAY=`date +%Y%m%d%H%M` +TARGET_BASE=w...@people.apache.org +TARGET_DIR=/www/people.apache.org/builds/struts/nightlies/2.x +TARGET_URL=$TARGET_BASE:$TARGET_DIR + +for zip in $(ls struts2/assembly/target/assembly/out/*.zip); +do + BASE_NAME=`basename $zip .zip` + scp $zip $TARGET_URL/$BASE_NAME-$TODAY.zip +done + +ssh $TARGET_BASE "chmod g+w $TARGET_DIR/*.zip" +</pre> +</div></div> + +<p>The logic in the shell script is copied quite a bit from James Mitchell's previous nightly script (thank James!). Currently, there is no logic for removing old files. I will add this as soon as more than 5 copies of the assembly zips have been published. This script is group writeable, so other developers can make changes to it. If Wes Wannemacher is unavailable, then this script can be copied to another location on the hudson zone and manipulated as necessary. Then, the struts2 job configuration can be updated as necessary.</p> + +<p>Much of the struts2 job's configuration is identical, or only slightly modified (such as pointing to the struts2 folder in SVN) from the struts1 configuration. The next significant differences come up in the Post-build section. Let's take a look - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-2.jpeg"></span></p> + +<p>The struts2 job performs the maven clean and install goals, but then leaves the snapshot deployments up to Hudson as a post-build action. This is done because this is a multi-module build. If the deploy goal were specified as part of the build, it is possible that some artifacts would be deployed and other would not. Having hudson do deployments as a post-build action means that deployment will happen as a separate step after the builds complete successfully. Moving along - </p> + +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="apache-struts-pseudo-nightly-builds-on-apache-hudson.data/struts2-3.jpeg"></span></p> + +<p>The tasks configured above are specified here to run as post-build actions. Although these tasks are tied to this build, and will happen with each successful build, they can also be launched manually from within Hudson. The Hudson job configuration allows you to specify tasks from any job, so it would be prudent to make sure scripts and commands operate in a way that they could be launched from any other Apache Struts build job (such as reusing the nightly-2.x.sh script to publish struts1 zips as well). </p></div> + </div> + + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html> http://git-wip-us.apache.org/repos/asf/struts-site/blob/124e36c4/content/docs/append.html ---------------------------------------------------------------------- diff --git a/content/docs/append.html b/content/docs/append.html new file mode 100644 index 0000000..eeb0f2b --- /dev/null +++ b/content/docs/append.html @@ -0,0 +1,217 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<html> +<head> + <link type="text/css" rel="stylesheet" href="https://struts.apache.org/css/default.css"> + <style type="text/css"> + .dp-highlighter { + width:95% !important; + } + </style> + <style type="text/css"> + .footer { + background-image: url('https://cwiki.apache.org/confluence/images/border/border_bottom.gif'); + background-repeat: repeat-x; + background-position: left top; + padding-top: 4px; + color: #666; + } + </style> + <link href='https://struts.apache.org/highlighter/style/shCoreStruts.css' rel='stylesheet' type='text/css' /> + <link href='https://struts.apache.org/highlighter/style/shThemeStruts.css' rel='stylesheet' type='text/css' /> + <script src='https://struts.apache.org/highlighter/js/shCore.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushPlain.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushXml.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushJScript.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushGroovy.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushBash.js' type='text/javascript'></script> + <script src='https://struts.apache.org/highlighter/js/shBrushCss.js' type='text/javascript'></script> + <script type="text/javascript"> + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all(); + </script> + <script type="text/javascript" language="javascript"> + var hide = null; + var show = null; + var children = null; + + function init() { + /* Search form initialization */ + var form = document.forms['search']; + if (form != null) { + form.elements['domains'].value = location.hostname; + form.elements['sitesearch'].value = location.hostname; + } + + /* Children initialization */ + hide = document.getElementById('hide'); + show = document.getElementById('show'); + children = document.all != null ? + document.all['children'] : + document.getElementById('children'); + if (children != null) { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + } + + function showChildren() { + children.style.display = 'block'; + show.style.display = 'none'; + hide.style.display = 'inline'; + } + + function hideChildren() { + children.style.display = 'none'; + show.style.display = 'inline'; + hide.style.display = 'none'; + } + </script> + <title>append</title> +</head> +<body onload="init()"> +<table border="0" cellpadding="2" cellspacing="0" width="100%"> + <tr class="topBar"> + <td align="left" valign="middle" class="topBarDiv" align="left" nowrap> + <a href="home.html">Home</a> > <a href="guides.html">Guides</a> > <a href="tag-developers-guide.html">Tag Developers Guide</a> > <a href="struts-tags.html">Struts Tags</a> > <a href="tag-reference.html">Tag Reference</a> > <a href="generic-tag-reference.html">Generic Tag Reference</a> > <a href="append.html">append</a> + </td> + <td align="right" valign="middle" nowrap> + <form name="search" action="https://www.google.com/search" method="get"> + <input type="hidden" name="ie" value="UTF-8" /> + <input type="hidden" name="oe" value="UTF-8" /> + <input type="hidden" name="domains" value="" /> + <input type="hidden" name="sitesearch" value="" /> + <input type="text" name="q" maxlength="255" value="" /> + <input type="submit" name="btnG" value="Google Search" /> + </form> + </td> + </tr> +</table> + +<div id="PageContent"> + <div class="pageheader" style="padding: 6px 0px 0px 0px;"> + <!-- We'll enable this once we figure out how to access (and save) the logo resource --> + <!--img src="/wiki/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"--> + <div style="margin: 0px 10px 0px 10px" class="smalltext">Apache Struts 2 Documentation</div> + <div style="margin: 0px 10px 8px 10px" class="pagetitle">append</div> + + <div class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;"> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14241"> + <img src="https://cwiki.apache.org/confluence/images/icons/notep_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Edit Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=14241">Edit Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW"> + <img src="https://cwiki.apache.org/confluence/images/icons/browse_space.gif" + height="16" width="16" border="0" align="absmiddle" title="Browse Space"></a> + <a href="https://cwiki.apache.org/confluence/pages/listpages.action?key=WW">Browse Space</a> + + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14241"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_page_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add Page"></a> + <a href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=WW&fromPageId=14241">Add Page</a> + + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14241"> + <img src="https://cwiki.apache.org/confluence/images/icons/add_blogentry_16.gif" + height="16" width="16" border="0" align="absmiddle" title="Add News"></a> + <a href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=WW&fromPageId=14241">Add News</a> + </div> + </div> + + <div class="pagecontent"> + <div class="wiki-content"> + <div id="ConfluenceContent"><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Please make sure you have read the <a shape="rect" href="tag-syntax.html">Tag Syntax</a> document and understand how tag attribute syntax works.</p></div></div> + +<h2 id="append-Description">Description</h2> + +<p></p><p>Component for AppendIteratorTag, which jobs is to append iterators to form an +appended iterator whereby entries goes from one iterator to another after each +respective iterator is exhausted of entries.</p> + +<p></p><p>For example, if there are 3 iterator appended (each iterator has 3 entries), +the following will be how the appended iterator entries will be arranged:</p> + +<p></p><ol><li>First Entry of the First Iterator</li><li>Second Entry of the First Iterator</li><li>Third Entry of the First Iterator</li><li>First Entry of the Second Iterator</li><li>Second Entry of the Second Iterator</li><li>Third Entry of the Second Iterator</li><li>First Entry of the Third Iterator</li><li>Second Entry of the Third Iterator</li><li>Third Entry of the Third ITerator</li></ol> + +<h2 id="append-Parameters">Parameters</h2> + +<p><table width="100%"><tr><td colspan="6" rowspan="1"><h4>Dynamic Attributes Allowed:</h4> false</td></tr><tr><td colspan="6" rowspan="1"> </td></tr><tr><th align="left" colspan="1" rowspan="1" valign="top"><h4>Name</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Required</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Default</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Evaluated</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Type</h4></th><th align="left" colspan="1" rowspan="1" valign="top"><h4>Description</h4></th></tr><tr><td align="left" colspan="1" rowspan="1" valign="top">var</td><td align="left" colspan="1" rowspan="1" valign="top">false</td><td align="left" colspan="1" rowspan="1" valign="top"></td><td align="left" colspan="1" rowspan="1" valign="top">false</td><td align="left" colspan="1" rowspan="1" valign="top">String</td><td align="left" colspan="1" rowspan="1" valign="top">The name o f which if supplied will have the resultant appended iterator stored under in the stack's context</td></tr></table></p> + +<h2 id="append-Example">Example</h2> + +<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +public class AppendIteratorTagAction extends ActionSupport { + + private List myList1; + private List myList2; + private List myList3; + + + public String execute() throws Exception { + + myList1 = new ArrayList(); + myList1.add("1"); + myList1.add("2"); + myList1.add("3"); + + myList2 = new ArrayList(); + myList2.add("a"); + myList2.add("b"); + myList2.add("c"); + + myList3 = new ArrayList(); + myList3.add("A"); + myList3.add("B"); + myList3.add("C"); + + return "done"; + } + + public List getMyList1() { return myList1; } + public List getMyList2() { return myList2; } + public List getMyList3() { return myList3; } + +]]></script> +</div></div> +<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ +<s:append var="myAppendIterator"> + <s:param value="%{myList1}" /> + <s:param value="%{myList2}" /> + <s:param value="%{myList3}" /> +</s:append> +<s:iterator value="%{#myAppendIterator}"> + <s:property /> +</s:iterator> +]]></script> +</div></div></div> + </div> + + + </div> +</div> +<div class="footer"> + Generated by CXF SiteExporter +</div> +</body> +</html>