Author: ehillenius
Date: Sun Jul 15 13:20:59 2007
New Revision: 556443
URL: http://svn.apache.org/viewvc?view=rev&rev=556443
Log:
register the web application instance with the servlet context so that
extending framework can find the instance without having to rely on the current
thread
Modified:
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
Modified:
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java?view=diff&rev=556443&r1=556442&r2=556443
==============================================================================
---
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
(original)
+++
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
Sun Jul 15 13:20:59 2007
@@ -98,6 +98,13 @@
*/
public abstract class WebApplication extends Application
{
+ /**
+ * The key that will be used to store the instance of the web
application in
+ * the servlet context. This might be useful for extending frameworks
that
+ * want to discover the Wicket application instance.
+ */
+ public static final String SERVLET_CONTEXT_APPLICATION_KEY =
"wicket.application";
+
/** Log. */
private static final Logger log =
LoggerFactory.getLogger(WebApplication.class);
@@ -212,7 +219,8 @@
{
if (sessionAttributePrefix == null)
{
- sessionAttributePrefix = "wicket:" +
getWicketFilter().getFilterConfig().getFilterName() + ":";
+ sessionAttributePrefix = "wicket:" +
+
getWicketFilter().getFilterConfig().getFilterName() + ":";
}
// Namespacing for session attributes is provided by
// adding the servlet path
@@ -451,6 +459,8 @@
bufferedResponses.clear();
getSessionStore().destroy();
FileCleaner.destroy();
+
+
getServletContext().removeAttribute(SERVLET_CONTEXT_APPLICATION_KEY);
}
/**
@@ -492,6 +502,10 @@
// Configure the app.
configure();
+
+ // when done, register the application with the servlet context
for any
+ // extension project to discover it when they whish.
+
getServletContext().setAttribute(SERVLET_CONTEXT_APPLICATION_KEY, this);
}
/**