svn commit: r1328526 - in /struts/struts2/trunk/core/src: main/java/org/apache/struts2/util/ main/resources/template/simple/ test/java/org/apache/struts2/util/ test/java/org/apache/struts2/views/jsp/u
Author: lukaszlenart Date: Fri Apr 20 22:19:41 2012 New Revision: 1328526 URL: http://svn.apache.org/viewvc?rev=1328526&view=rev Log: WW-3804 adds support of dynamic attributes to tag and extends support for dynamic attributes with expression evaluation Added: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-7.txt - copied, changed from r1328062, struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-1.txt Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl struts/struts2/trunk/core/src/main/resources/template/simple/radiomap.ftl struts/struts2/trunk/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/RadioTest.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java?rev=1328526&r1=1328525&r2=1328526&view=diff == --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/StrutsUtil.java Fri Apr 20 22:19:41 2012 @@ -25,6 +25,7 @@ import com.opensymphony.xwork2.ActionCon import com.opensymphony.xwork2.ObjectFactory; import com.opensymphony.xwork2.inject.Container; import com.opensymphony.xwork2.util.ClassLoaderUtil; +import com.opensymphony.xwork2.util.TextParseUtil; import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.util.logging.Logger; import com.opensymphony.xwork2.util.logging.LoggerFactory; @@ -148,6 +149,10 @@ public class StrutsUtil { return (request == null)? "" : request.getContextPath(); } +public String translateVariables(String expression) { +return TextParseUtil.translateVariables(expression, stack); +} + /** * the selectedList objects are matched to the list.listValue * Modified: struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl?rev=1328526&r1=1328525&r2=1328526&view=diff == --- struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/dynamic-attributes.ftl Fri Apr 20 22:19:41 2012 @@ -23,6 +23,8 @@ <#if (parameters.dynamicAttributes?? && parameters.dynamicAttributes?size > 0)><#rt/> <#assign aKeys = parameters.dynamicAttributes.keySet()><#rt/> <#list aKeys as aKey><#rt/> - ${aKey}="${parameters.dynamicAttributes[aKey]?html}"<#rt/> + <#assign keyValue = parameters.dynamicAttributes[aKey]/> + <#assign value = struts.translateVariables(keyValue)!keyValue/> + ${aKey}="${value?html}"<#rt/> <#rt/> <#rt/> \ No newline at end of file Modified: struts/struts2/trunk/core/src/main/resources/template/simple/radiomap.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/radiomap.ftl?rev=1328526&r1=1328525&r2=1328526&view=diff == --- struts/struts2/trunk/core/src/main/resources/template/simple/radiomap.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/radiomap.ftl Fri Apr 20 22:19:41 2012 @@ -61,6 +61,7 @@ <#include "/${parameters.templateDir}/simple/scripting-events.ftl" /> <#include "/${parameters.templateDir}/simple/common-attributes.ftl" /> +<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" /> /><#rt/> <#rt/> ${itemValue}<#t/> Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java?rev=1328526&r1=1328525&r2=1328526&view=diff == --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/util/StrutsUtilTest.java Fri Apr 20 22:19:41 2012 @@ -21,24 +21,19 @@ package org.apache.struts2.util; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; - +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.util.ValueStack; import org.apache.struts2.StrutsTestCase; import org.apache.struts2.Test
svn commit: r1328527 - in /struts/struts2/trunk/plugins/convention/src: main/java/org/apache/struts2/convention/ test/java/org/apache/struts2/convention/ test/java/org/apache/struts2/convention/action
Author: lukaszlenart Date: Fri Apr 20 22:21:40 2012 New Revision: 1328527 URL: http://svn.apache.org/viewvc?rev=1328527&view=rev Log: WW-3803 solves problem with package name contains the package locator Added: struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/actions/transactions/ struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/actions/transactions/TransNameAction.java Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java?rev=1328527&r1=1328526&r2=1328527&view=diff == --- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java (original) +++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java Fri Apr 20 22:21:40 2012 @@ -767,12 +767,13 @@ public class PackageBasedActionConfigBui if (pkgPart == null && packageLocators != null) { for (String packageLocator : packageLocators) { -int index = pkg.lastIndexOf(packageLocator); +// check subpackage and not a part of package name, eg. actions -> my.actions.transactions - WW-3803 +int index = pkg.lastIndexOf("." + packageLocator + "."); // This ensures that the match is at the end, beginning or has a dot on each side of it if (index >= 0 && (index + packageLocator.length() == pkg.length() || index == 0 || -(pkg.charAt(index - 1) == '.' && pkg.charAt(index + packageLocator.length()) == '.'))) { -pkgPart = actionClass.getName().substring(index + packageLocator.length() + 1); +(pkg.charAt(index) == '.' && pkg.charAt(index + 1 + packageLocator.length()) == '.'))) { +pkgPart = actionClass.getName().substring(index + packageLocator.length() + 2); } } } Modified: struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java?rev=1328527&r1=1328526&r2=1328527&view=diff == --- struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java (original) +++ struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java Fri Apr 20 22:21:40 2012 @@ -80,6 +80,7 @@ import org.apache.struts2.convention.act import org.apache.struts2.convention.actions.resultpath.ClassLevelResultPathAction; import org.apache.struts2.convention.actions.resultpath.PackageLevelResultPathAction; import org.apache.struts2.convention.actions.skip.Index; +import org.apache.struts2.convention.actions.transactions.TransNameAction; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Actions; import org.apache.struts2.convention.dontfind.DontFindMeAction; @@ -193,6 +194,8 @@ public class PackageBasedActionConfigBui "/skip", strutsDefault, null); PackageConfig chainPkg = makePackageConfig("org.apache.struts2.convention.actions.chain#struts-default#/chain", "/chain", strutsDefault, null); +PackageConfig transPkg = makePackageConfig("org.apache.struts2.convention.actions.transactions#struts-default#/transactions", +"/transactions", strutsDefault, null); ResultMapBuilder resultMapBuilder = createStrictMock(ResultMapBuilder.class); checkOrder(resultMapBuilder, false); @@ -293,6 +296,10 @@ public class PackageBasedActionConfigBui expect(resultMapBuilder.build(ChainedAction.class, getAnnotation(ChainedAction.class, "foo", Action.class), "foo", chainPkg)).andReturn(results); expect(resultMapBuilder.build(ChainedAction.class, getAnnotation(ChainedAction.class, "bar", Action.class), "foo-bar", chainPkg)).andReturn(results); +/* org.apache.struts2.convention.actions.transactions */ +expect(resultMapBuilder.build(TransNameAction.class, getAnnotation(TransNameAction.class, "trans1", Action.class), "trans1", tr
svn commit: r1328528 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java
Author: lukaszlenart Date: Fri Apr 20 22:23:26 2012 New Revision: 1328528 URL: http://svn.apache.org/viewvc?rev=1328528&view=rev Log: WW-3801 adds logic to clean ups uploaded files Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java?rev=1328528&r1=1328527&r2=1328528&view=diff == --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/ng/PrepareOperations.java Fri Apr 20 22:23:26 2012 @@ -20,23 +20,22 @@ */ package org.apache.struts2.dispatcher.ng; -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.dispatcher.mapper.ActionMapping; -import org.apache.struts2.dispatcher.mapper.ActionMapper; -import org.apache.struts2.StrutsException; -import org.apache.struts2.RequestUtils; - -import javax.servlet.ServletException; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.util.ValueStack; import com.opensymphony.xwork2.util.ValueStackFactory; import com.opensymphony.xwork2.util.logging.Logger; import com.opensymphony.xwork2.util.logging.LoggerFactory; +import org.apache.struts2.RequestUtils; +import org.apache.struts2.StrutsConstants; +import org.apache.struts2.StrutsException; +import org.apache.struts2.dispatcher.Dispatcher; +import org.apache.struts2.dispatcher.mapper.ActionMapper; +import org.apache.struts2.dispatcher.mapper.ActionMapping; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -47,6 +46,8 @@ import java.util.regex.Pattern; */ public class PrepareOperations { +private static final Logger LOG = LoggerFactory.getLogger(PrepareOperations.class); + private ServletContext servletContext; private Dispatcher dispatcher; private static final String STRUTS_ACTION_MAPPING_KEY = "struts.actionMapping"; @@ -98,10 +99,18 @@ public class PrepareOperations { return; } } - // always clean up the thread request, even if an action hasn't been executed -ActionContext.setContext(null); -Dispatcher.setInstance(null); +try { +dispatcher.cleanUpRequest(request); +} catch (IOException e) { +if (LOG.isWarnEnabled()) { +LOG.warn("Cannot clean up the request, some files can still remain in #1 after upload!", e, +StrutsConstants.STRUTS_MULTIPART_SAVEDIR); +} +} finally { +ActionContext.setContext(null); +Dispatcher.setInstance(null); +} } /** @@ -173,7 +182,7 @@ public class PrepareOperations { */ public void cleanupDispatcher() { if (dispatcher == null) { -throw new StrutsException("something is seriously wrong, Dispatcher is not initialized (null) "); +throw new StrutsException("Something is seriously wrong, Dispatcher is not initialized (null) "); } else { try { dispatcher.cleanup();
[CONF] Confluence Changes in the last 24 hours
This is a daily summary of all recent changes in Confluence. - Updated Spaces: - Apache Bigtop (incubating) (https://cwiki.apache.org/confluence/display/BIGTOP) Pages - Bigtop 0.4.0 hackathon May 17, 2012 agenda created by rvs (07:07 PM) https://cwiki.apache.org/confluence/display/BIGTOP/Bigtop+0.4.0+hackathon+May+17%2C+2012+agenda Apache Camel (https://cwiki.apache.org/confluence/display/CAMEL) Pages - Websocket edited by cmoulliard (02:55 AM) https://cwiki.apache.org/confluence/display/CAMEL/Websocket Apache CXF Documentation (https://cwiki.apache.org/confluence/display/CXF20DOC) Pages - Javadoc edited by mazzag (12:19 PM) https://cwiki.apache.org/confluence/display/CXF20DOC/Javadoc Apache Hive (https://cwiki.apache.org/confluence/display/Hive) Pages - ContributorMinutes20120418 created by cwsteinbach (08:21 PM) https://cwiki.apache.org/confluence/display/Hive/ContributorMinutes20120418 Development ContributorsMeetings edited by cwsteinbach (08:15 PM) https://cwiki.apache.org/confluence/display/Hive/Development+ContributorsMeetings Apache Kafka (https://cwiki.apache.org/confluence/display/KAFKA) Pages - kafka Detailed Replication Design V3 created by junrao (06:27 PM) https://cwiki.apache.org/confluence/display/KAFKA/kafka+Detailed+Replication+Design+V3 Apache Mahout (https://cwiki.apache.org/confluence/display/MAHOUT) Pages - LDA algorithm implimentation in java created by aneesha...@gmail.com (05:53 AM) https://cwiki.apache.org/confluence/display/MAHOUT/2012/04/20/LDA+algorithm+implimentation+in+java OFBiz (Open For Business) Project Open Wiki (https://cwiki.apache.org/confluence/display/OFBIZ) Pages - Dictionary for translations to German edited by chrisg (07:23 AM) https://cwiki.apache.org/confluence/display/OFBIZ/Dictionary+for+translations+to+German Comments https://cwiki.apache.org/confluence/display/OFBIZ/Complete+implementation+of+HR+application (1) Apache OpenOffice Community (https://cwiki.apache.org/confluence/display/OOOUSERS) Pages - AOO 3.4 (incubating) Release Candidate edited by jsc (09:00 PM) https://cwiki.apache.org/confluence/display/OOOUSERS/AOO+3.4+%28incubating%29+Release+Candidate AOO 3.4 RC Build Test Report created by zhaoxia (02:48 AM) https://cwiki.apache.org/confluence/display/OOOUSERS/AOO+3.4+RC+Build+Test+Report AOO 3.4 Release Notes in italian created by paolopoz (06:57 AM) https://cwiki.apache.org/confluence/display/OOOUSERS/AOO+3.4+Release+Notes+in+italian AOO 3.4 QA Weekly Status Report As of 20120409 - 20120416 created by zhaoxia (02:40 AM) https://cwiki.apache.org/confluence/display/OOOUSERS/AOO+3.4+QA+Weekly+Status+Report+As+of+20120409+-+20120416 Apache OpenNLP (https://cwiki.apache.org/confluence/display/OPENNLP) Pages - Related projects and competition edited by joern (09:04 AM) https://cwiki.apache.org/confluence/display/OPENNLP/Related+projects+and+competition Apache Struts 2 Wiki (https://cwiki.apache.org/confluence/display/S2WIKI) Comments https://cwiki.apache.org/confluence/display/S2WIKI/Projects+Using+WebWork+or+Struts2 (1) Apache Sling Website (https://cwiki.apache.org/confluence/display/SLINGxSITE) Pages - Navigation edited by fmeschbe (02:29 AM) https://cwiki.apache.org/confluence/display/SLINGxSITE/Navigation Security created by fmeschbe (02:19 AM) https://cwiki.apache.org/confluence/display/SLINGxSITE/Security Apache Struts 2 Documentation (https://cwiki.apache.org/confluence/display/WW) Pages - Freemarker Support edited by lukaszlenart (06:17 PM) https://cwiki.apache.org/confluence/display/WW/Freemarker+Support Change your notification preferences: https://cwiki.apache.org/confluence/users/viewnotifications.action