Changed xwork dep to snapshot, fixed config files to only reload once

per request
WW-1483 


git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@468999 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald J. Brown
2006-10-29 21:19:30 +00:00
parent 6a787881fe
commit d13faf9eee
3 changed files with 18 additions and 5 deletions
+1 -1
View File
@@ -103,7 +103,7 @@
<groupId>opensymphony</groupId>
<artifactId>xwork</artifactId>
<classifier>javadoc</classifier>
<version>2.0-beta-1</version>
<version>2.0-SNAPSHOT</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/xwork-apidocs</outputDirectory>
+1 -1
View File
@@ -39,7 +39,7 @@
<dependency>
<groupId>opensymphony</groupId>
<artifactId>xwork</artifactId>
<version>2.0-beta-1</version>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
@@ -17,6 +17,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
/**
@@ -27,6 +28,7 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider {
private static final Log LOG = LogFactory.getLog(StrutsXmlConfigurationProvider.class);
private File baseDir = null;
private String filename;
private String reloadKey;
/**
* Constructs the configuration provider
@@ -46,6 +48,7 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider {
public StrutsXmlConfigurationProvider(String filename, boolean errorIfMissing) {
super(filename, errorIfMissing);
this.filename = filename;
reloadKey = "configurationReload-"+filename;
Map<String,String> dtdMappings = new HashMap<String,String>(getDtdMappings());
dtdMappings.put("-//Apache Software Foundation//DTD Struts Configuration 2.0//EN", "struts-2.0.dtd");
setDtdMappings(dtdMappings);
@@ -54,6 +57,18 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider {
this.baseDir = file.getParentFile();
}
}
/* (non-Javadoc)
* @see com.opensymphony.xwork2.config.providers.XmlConfigurationProvider#init(com.opensymphony.xwork2.config.Configuration)
*/
@Override
public void init(Configuration configuration) {
ActionContext ctx = ActionContext.getContext();
ctx.put(reloadKey, Boolean.TRUE);
super.init(configuration);
}
/**
* Look for the configuration file on the classpath and in the file system
@@ -106,9 +121,7 @@ public class StrutsXmlConfigurationProvider extends XmlConfigurationProvider {
@Override
public boolean needsReload() {
ActionContext ctx = ActionContext.getContext();
String key = "configurationReload-"+filename;
if (ctx.get(key) == null) {
ctx.put(key, Boolean.TRUE);
if (ctx.get(reloadKey) == null) {
return super.needsReload();
}
return false;