You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pe...@apache.org on 2012/01/22 13:43:04 UTC
git commit: WICKET-4350 Add more programmatic support for web app
construction via servlet 3
Updated Branches:
refs/heads/wicket-1.5.x a4a3eb04e -> 47e1bc769
WICKET-4350 Add more programmatic support for web app construction via servlet 3
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/47e1bc76
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/47e1bc76
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/47e1bc76
Branch: refs/heads/wicket-1.5.x
Commit: 47e1bc7698359943d12dd0b830fcbf63b1f182a1
Parents: a4a3eb0
Author: Peter Ertl <pe...@apache.org>
Authored: Sat Jan 21 16:01:29 2012 +0100
Committer: Peter Ertl <pe...@apache.org>
Committed: Sun Jan 22 13:42:13 2012 +0100
----------------------------------------------------------------------
.../wicket/protocol/http/WebApplication.java | 18 ++++++++
.../apache/wicket/protocol/http/WicketFilter.java | 32 ++++++++++++++-
2 files changed, 48 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/47e1bc76/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
index 5306bc9..4516f48 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
@@ -614,6 +614,24 @@ public abstract class WebApplication extends Application
}
/**
+ * set runtime configuration type
+ * <p/>
+ * this is a write-once property: once configured it can not be changed later on.
+ *
+ * @param configurationType
+ */
+ public void setConfigurationType(RuntimeConfigurationType configurationType)
+ {
+ if (this.configurationType != null)
+ {
+ throw new IllegalStateException(
+ "Configuration type is write-once. You can not change it. " + "" +
+ "Current value='" + configurationType);
+ }
+ this.configurationType = Args.notNull(configurationType, "configurationType");
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
http://git-wip-us.apache.org/repos/asf/wicket/blob/47e1bc76/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
index 6c29190..4ed6ef5 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
@@ -35,6 +35,7 @@ import org.apache.wicket.request.cycle.RequestCycle;
import org.apache.wicket.request.http.WebRequest;
import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.util.file.WebXmlFile;
+import org.apache.wicket.util.lang.Args;
import org.apache.wicket.util.string.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,6 +96,28 @@ public class WicketFilter implements Filter
private boolean isServlet = false;
/**
+ * default constructor, usually invoked through the servlet
+ * container by the web.xml configuration
+ */
+ public WicketFilter()
+ {
+ }
+
+ /**
+ * constructor supporting programmatic setup of the filter
+ * <p/>
+ * this can be useful for programmatically creating and appending the
+ * wicket filter to the servlet context using servlet 3 features.
+ *
+ * @param application
+ * web application
+ */
+ public WicketFilter(WebApplication application)
+ {
+ this.application = Args.notNull(application, "application");
+ }
+
+ /**
* @return The class loader
*/
protected ClassLoader getClassLoader()
@@ -304,8 +327,13 @@ public class WicketFilter implements Filter
this.isServlet = isServlet;
initIgnorePaths(filterConfig);
- applicationFactory = getApplicationFactory();
- application = applicationFactory.createApplication(this);
+ // locate application instance unless it was already specified during construction
+ if (application == null)
+ {
+ applicationFactory = getApplicationFactory();
+ application = applicationFactory.createApplication(this);
+ }
+
application.setName(filterConfig.getFilterName());
application.setWicketFilter(this);