mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
WW-3916 adds usage of the latest Jetty plugin
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1435931 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+26
-2
@@ -68,11 +68,35 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.0.1</version>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>8.1.7.v20120910</version>
|
||||
<configuration>
|
||||
<stopKey>CTRL+C</stopKey>
|
||||
<stopPort>8999</stopPort>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>log4j.configuration</name>
|
||||
<value>file:${basedir}/src/main/resources/log4j.properties</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>slf4j</name>
|
||||
<value>false</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
|
||||
<webAppConfig>
|
||||
<contextPath>/struts2-mailreader</contextPath>
|
||||
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
|
||||
</webAppConfig>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
|
||||
#
|
||||
# The five logging levels used by Log are (in order):
|
||||
#
|
||||
# 1. DEBUG (the least serious)
|
||||
# 2. INFO
|
||||
# 3. WARN
|
||||
# 4. ERROR
|
||||
# 5. FATAL (the most serious)
|
||||
|
||||
|
||||
# Set root logger level to WARN and append to stdout
|
||||
log4j.rootLogger=DEBUG, stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Pattern to output the caller's file name and line number.
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
|
||||
|
||||
# Print only messages of level ERROR or above in the package noModule.
|
||||
log4j.logger.noModule=FATAL
|
||||
|
||||
# OpenSymphony Stuff
|
||||
log4j.logger.freemarker=INFO
|
||||
log4j.logger.com.opensymphony=INFO
|
||||
log4j.logger.com.opensymphony.xwork2.ognl=ERROR
|
||||
log4j.logger.org.apache.struts2=WARN
|
||||
log4j.logger.org.apache.struts2.components=WARN
|
||||
log4j.logger.org.apache.struts2.dispatcher=WARN
|
||||
log4j.logger.org.apache.struts2.convention=INFO
|
||||
|
||||
# Spring Stuff
|
||||
log4j.logger.org.springframework=WARN
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
<?xml version='1.0'?>
|
||||
<database>
|
||||
<user username="user" fromAddress="John.User@somewhere.com"
|
||||
fullName="John Q. User" password="pass">
|
||||
<subscription host="mail.hotmail.com" autoConnect="false"
|
||||
password="bar" type="pop3" username="user1234">
|
||||
</subscription>
|
||||
<subscription host="mail.yahoo.com" autoConnect="false" password="foo"
|
||||
type="imap" username="jquser">
|
||||
</subscription>
|
||||
</user>
|
||||
<user username="user" fromAddress="John.User@somewhere.com" fullName="John Q. User" password="pass">
|
||||
<subscription host="mail.yahoo.com" autoConnect="false" password="foo" type="imap" username="jquser">
|
||||
</subscription>
|
||||
<subscription host="mail.hotmail.com" autoConnect="false" password="bar" type="pop3" username="user1234">
|
||||
</subscription>
|
||||
</user>
|
||||
</database>
|
||||
|
||||
@@ -101,8 +101,10 @@
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>8.0.0.M2</version>
|
||||
<version>8.1.7.v20120910</version>
|
||||
<configuration>
|
||||
<stopKey>CTRL+C</stopKey>
|
||||
<stopPort>8999</stopPort>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>log4j.configuration</name>
|
||||
|
||||
@@ -204,8 +204,10 @@
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>8.0.0.M2</version>
|
||||
<version>8.1.7.v20120910</version>
|
||||
<configuration>
|
||||
<stopKey>CTRL+C</stopKey>
|
||||
<stopPort>8999</stopPort>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>log4j.configuration</name>
|
||||
|
||||
@@ -66,17 +66,35 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.1.21</version>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>8.1.7.v20120910</version>
|
||||
<configuration>
|
||||
<stopKey>CTRL+C</stopKey>
|
||||
<stopPort>8999</stopPort>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>log4j.configuration</name>
|
||||
<value>file:${basedir}/src/main/resources/log4j.properties</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>slf4j</name>
|
||||
<value>false</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
<scanTargets>
|
||||
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
|
||||
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
|
||||
<scanTarget>src/main/resources/struts.xml</scanTarget>
|
||||
<scanTarget>src/main/resources/example.xml</scanTarget>
|
||||
</scanTargets>
|
||||
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
|
||||
<webAppConfig>
|
||||
<contextPath>/struts2-blank</contextPath>
|
||||
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
|
||||
</webAppConfig>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
|
||||
#
|
||||
# The five logging levels used by Log are (in order):
|
||||
#
|
||||
# 1. DEBUG (the least serious)
|
||||
# 2. INFO
|
||||
# 3. WARN
|
||||
# 4. ERROR
|
||||
# 5. FATAL (the most serious)
|
||||
|
||||
|
||||
# Set root logger level to WARN and append to stdout
|
||||
log4j.rootLogger=WARN, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Pattern to output the caller's file name and line number.
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
|
||||
|
||||
# Print only messages of level ERROR or above in the package noModule.
|
||||
log4j.logger.noModule=ERROR
|
||||
|
||||
# OpenSymphony Stuff
|
||||
log4j.logger.com.opensymphony=INFO
|
||||
|
||||
# Struts2 Stuff
|
||||
log4j.logger.org.apache.struts2=INFO
|
||||
+26
-7
@@ -80,16 +80,35 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.1.21</version>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>8.1.7.v20120910</version>
|
||||
<configuration>
|
||||
<stopKey>CTRL+C</stopKey>
|
||||
<stopPort>8999</stopPort>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>log4j.configuration</name>
|
||||
<value>file:${basedir}/src/main/resources/log4j.properties</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>slf4j</name>
|
||||
<value>false</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
<scanTargets>
|
||||
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
|
||||
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
|
||||
<scanTarget>src/main/resources/struts.xml</scanTarget>
|
||||
</scanTargets>
|
||||
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
|
||||
<webAppConfig>
|
||||
<contextPath>/struts2-showcase</contextPath>
|
||||
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
|
||||
</webAppConfig>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
|
||||
#
|
||||
# The five logging levels used by Log are (in order):
|
||||
#
|
||||
# 1. DEBUG (the least serious)
|
||||
# 2. INFO
|
||||
# 3. WARN
|
||||
# 4. ERROR
|
||||
# 5. FATAL (the most serious)
|
||||
|
||||
|
||||
# Set root logger level to WARN and append to stdout
|
||||
log4j.rootLogger=WARN, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Pattern to output the caller's file name and line number.
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
|
||||
|
||||
# Print only messages of level ERROR or above in the package noModule.
|
||||
log4j.logger.noModule=ERROR
|
||||
|
||||
# OpenSymphony Stuff
|
||||
log4j.logger.com.opensymphony=INFO
|
||||
|
||||
# Struts2 Stuff
|
||||
log4j.logger.org.apache.struts2=INFO
|
||||
+28
-10
@@ -88,19 +88,37 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.1.21</version>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>8.1.7.v20120910</version>
|
||||
<configuration>
|
||||
<stopKey>CTRL+C</stopKey>
|
||||
<stopPort>8999</stopPort>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>log4j.configuration</name>
|
||||
<value>file:${basedir}/src/main/resources/log4j.properties</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>slf4j</name>
|
||||
<value>false</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
<scanTargets>
|
||||
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
|
||||
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
|
||||
<scanTarget>src/main/resources/struts.xml</scanTarget>
|
||||
<scanTarget>src/main/resources/applicationContext.xml</scanTarget>
|
||||
</scanTargets>
|
||||
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
|
||||
<webAppConfig>
|
||||
<contextPath>/struts2-showcase</contextPath>
|
||||
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
|
||||
</webAppConfig>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -197,10 +197,7 @@ public class DispatcherTest extends StrutsTestCase {
|
||||
mockContainer.expectAndReturn("getInstance", C.args(C.eq(String.class), C.eq(XWorkConstants.RELOAD_XML_CONFIGURATION)),
|
||||
reloadConfigs);
|
||||
mockContainer.expectAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), destroyedObjectFactory);
|
||||
mockContainer.expectAndReturn("getInstance", C.args(C.eq(String.class), C.eq(XWorkConstants.RELOAD_XML_CONFIGURATION)),
|
||||
reloadConfigs);
|
||||
|
||||
mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
|
||||
mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
|
||||
mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
|
||||
mockConfiguration.expect("destroy");
|
||||
@@ -227,14 +224,12 @@ public class DispatcherTest extends StrutsTestCase {
|
||||
|
||||
Map<String, PackageConfig> packageConfigs = new HashMap<String, PackageConfig>();
|
||||
packageConfigs.put("test", packageConfig);
|
||||
|
||||
|
||||
Mock mockContainer = new Mock(Container.class);
|
||||
mockContainer.matchAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), new ObjectFactory());
|
||||
String reloadConfigs = container.getInstance(String.class, XWorkConstants.RELOAD_XML_CONFIGURATION);
|
||||
mockContainer.expectAndReturn("getInstance", C.args(C.eq(String.class), C.eq(XWorkConstants.RELOAD_XML_CONFIGURATION)),
|
||||
reloadConfigs);
|
||||
mockContainer.expectAndReturn("getInstance", C.args(C.eq(String.class), C.eq(XWorkConstants.RELOAD_XML_CONFIGURATION)),
|
||||
reloadConfigs);
|
||||
|
||||
Mock mockConfiguration = new Mock(Configuration.class);
|
||||
mockConfiguration.matchAndReturn("getPackageConfigs", packageConfigs);
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.opensymphony.xwork2.XWorkConstants;
|
||||
import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
|
||||
import com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider;
|
||||
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
|
||||
import com.opensymphony.xwork2.inject.Container;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
import com.opensymphony.xwork2.util.logging.LoggerFactory;
|
||||
|
||||
@@ -46,6 +45,7 @@ public class ConfigurationManager {
|
||||
private List<PackageProvider> packageProviders = new CopyOnWriteArrayList<PackageProvider>();
|
||||
protected String defaultFrameworkBeanName;
|
||||
private boolean providersChanged = false;
|
||||
private boolean reloadConfigs = true; // for the first time
|
||||
|
||||
public ConfigurationManager() {
|
||||
this("xwork");
|
||||
@@ -70,7 +70,7 @@ public class ConfigurationManager {
|
||||
throw new ConfigurationException("Unable to load configuration.", e);
|
||||
}
|
||||
} else {
|
||||
conditionalReload(configuration.getContainer());
|
||||
conditionalReload();
|
||||
}
|
||||
|
||||
return configuration;
|
||||
@@ -169,10 +169,8 @@ public class ConfigurationManager {
|
||||
|
||||
/**
|
||||
* Reloads the Configuration files if the configuration files indicate that they need to be reloaded.
|
||||
* @param container current container used to obtain instance of {@link com.opensymphony.xwork2.util.fs.DefaultFileManager}
|
||||
*/
|
||||
public synchronized void conditionalReload(Container container) {
|
||||
boolean reloadConfigs = Boolean.parseBoolean(container.getInstance(String.class, XWorkConstants.RELOAD_XML_CONFIGURATION));
|
||||
public synchronized void conditionalReload() {
|
||||
if (reloadConfigs || providersChanged) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Checking ConfigurationProviders for reload.");
|
||||
@@ -185,16 +183,25 @@ public class ConfigurationManager {
|
||||
if (reload) {
|
||||
reloadProviders(providers);
|
||||
}
|
||||
updateReloadConfigsFlag();
|
||||
providersChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateReloadConfigsFlag() {
|
||||
reloadConfigs = Boolean.parseBoolean(configuration.getContainer().getInstance(String.class, XWorkConstants.RELOAD_XML_CONFIGURATION));
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Updating [#0], current value is [#1], new value [#2]",
|
||||
XWorkConstants.RELOAD_XML_CONFIGURATION, String.valueOf(reloadConfigs), String.valueOf(reloadConfigs));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean needReloadPackageProviders() {
|
||||
if (packageProviders != null) {
|
||||
for (PackageProvider provider : packageProviders) {
|
||||
if (provider.needsReload()) {
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Detected package provider " + provider + " needs to be reloaded. Reloading all providers.");
|
||||
LOG.info("Detected package provider [#0] needs to be reloaded. Reloading all providers.", provider.toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -207,7 +214,7 @@ public class ConfigurationManager {
|
||||
for (ContainerProvider provider : providers) {
|
||||
if (provider.needsReload()) {
|
||||
if (LOG.isInfoEnabled()) {
|
||||
LOG.info("Detected container provider " + provider + " needs to be reloaded. Reloading all providers.");
|
||||
LOG.info("Detected container provider [#0] needs to be reloaded. Reloading all providers.", provider.toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user