You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2006/12/06 01:08:11 UTC

svn commit: r482834 - /incubator/wicket/branches/wicket-1.x/wicket-spring/src/main/java/wicket/spring/SpringWebApplicationFactory.java

Author: ehillenius
Date: Tue Dec  5 16:08:09 2006
New Revision: 482834

URL: http://svn.apache.org/viewvc?view=rev&rev=482834
Log:
removed obsolete method

Modified:
    incubator/wicket/branches/wicket-1.x/wicket-spring/src/main/java/wicket/spring/SpringWebApplicationFactory.java

Modified: incubator/wicket/branches/wicket-1.x/wicket-spring/src/main/java/wicket/spring/SpringWebApplicationFactory.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-spring/src/main/java/wicket/spring/SpringWebApplicationFactory.java?view=diff&rev=482834&r1=482833&r2=482834
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-spring/src/main/java/wicket/spring/SpringWebApplicationFactory.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-spring/src/main/java/wicket/spring/SpringWebApplicationFactory.java Tue Dec  5 16:08:09 2006
@@ -28,7 +28,6 @@
 import wicket.protocol.http.IWebApplicationFactory;
 import wicket.protocol.http.WebApplication;
 import wicket.protocol.http.WicketFilter;
-import wicket.protocol.http.WicketServlet;
 
 /**
  * Implementation of IWebApplicationFactory that pulls the WebApplication object
@@ -37,36 +36,36 @@
  * Configuration example:
  * 
  * <pre>
- *   &lt;servlet&gt;
- *   &lt;servlet-name&gt;phonebook&lt;/servlet-name&gt;
- *   &lt;servlet-class&gt;wicket.protocol.http.WicketServlet&lt;/servlet-class&gt;
- *   &lt;init-param&gt;
- *   &lt;param-name&gt;applicationFactoryClassName&lt;/param-name&gt;
- *   &lt;param-value&gt;wicket.contrib.spring.SpringWebApplicationFactory&lt;/param-value&gt;
- *   &lt;/init-param&gt;
- *   &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
- *   &lt;/servlet&gt;
+ *    &lt;servlet&gt;
+ *    &lt;servlet-name&gt;phonebook&lt;/servlet-name&gt;
+ *    &lt;servlet-class&gt;wicket.protocol.http.WicketServlet&lt;/servlet-class&gt;
+ *    &lt;init-param&gt;
+ *    &lt;param-name&gt;applicationFactoryClassName&lt;/param-name&gt;
+ *    &lt;param-value&gt;wicket.contrib.spring.SpringWebApplicationFactory&lt;/param-value&gt;
+ *    &lt;/init-param&gt;
+ *    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
+ *    &lt;/servlet&gt;
  * </pre>
  * 
- * beanName init parameter can be used if there are multiple WebApplications defined
- * on the spring application context. 
+ * beanName init parameter can be used if there are multiple WebApplications
+ * defined on the spring application context.
  * 
  * Example:
  * 
  * <pre>
- *   &lt;servlet&gt;
- *   &lt;servlet-name&gt;phonebook&lt;/servlet-name&gt;
- *   &lt;servlet-class&gt;wicket.protocol.http.WicketServlet&lt;/servlet-class&gt;
- *   &lt;init-param&gt;
- *   &lt;param-name&gt;applicationFactoryClassName&lt;/param-name&gt;
- *   &lt;param-value&gt;wicket.contrib.spring.SpringWebApplicationFactory&lt;/param-value&gt;
- *   &lt;/init-param&gt;
- *   &lt;init-param&gt;
- *   &lt;param-name&gt;beanName&lt;/param-name&gt;
- *   &lt;param-value&gt;phonebookApplication&lt;/param-value&gt;
- *   &lt;/init-param&gt;
- *   &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
- *   &lt;/servlet&gt;
+ *    &lt;servlet&gt;
+ *    &lt;servlet-name&gt;phonebook&lt;/servlet-name&gt;
+ *    &lt;servlet-class&gt;wicket.protocol.http.WicketServlet&lt;/servlet-class&gt;
+ *    &lt;init-param&gt;
+ *    &lt;param-name&gt;applicationFactoryClassName&lt;/param-name&gt;
+ *    &lt;param-value&gt;wicket.contrib.spring.SpringWebApplicationFactory&lt;/param-value&gt;
+ *    &lt;/init-param&gt;
+ *    &lt;init-param&gt;
+ *    &lt;param-name&gt;beanName&lt;/param-name&gt;
+ *    &lt;param-value&gt;phonebookApplication&lt;/param-value&gt;
+ *    &lt;/init-param&gt;
+ *    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
+ *    &lt;/servlet&gt;
  * </pre>
  * 
  * 
@@ -77,26 +76,13 @@
 public class SpringWebApplicationFactory implements IWebApplicationFactory
 {
 	/**
-	 * @see wicket.protocol.http.IWebApplicationFactory#createApplication(wicket.protocol.http.WicketServlet)
-	 */
-	public WebApplication createApplication(WicketServlet servlet)
-	{
-		ServletContext sc = servlet.getServletContext();
-		ApplicationContext ac = WebApplicationContextUtils
-		.getRequiredWebApplicationContext(sc);
-
-		String beanName = servlet.getInitParameter("applicationBean");
-		return createApplication(ac, beanName);
-	}
-
-	/**
 	 * @see IWebApplicationFactory#createApplication(WicketFilter)
 	 */
 	public WebApplication createApplication(WicketFilter filter)
 	{
 		ServletContext sc = filter.getFilterConfig().getServletContext();
 		ApplicationContext ac = WebApplicationContextUtils
-		.getRequiredWebApplicationContext(sc);
+				.getRequiredWebApplicationContext(sc);
 
 		String beanName = filter.getFilterConfig().getInitParameter("applicationBean");
 		return createApplication(ac, beanName);
@@ -104,14 +90,18 @@
 
 	private WebApplication createApplication(ApplicationContext ac, String beanName)
 	{
-		if(beanName!=null){
-			WebApplication application = (WebApplication)ac.getBean(beanName);
-			if(application == null)
+		if (beanName != null)
+		{
+			WebApplication application = (WebApplication) ac.getBean(beanName);
+			if (application == null)
 			{
-				throw new IllegalArgumentException("Unable to find WebApplication bean with name ["+beanName+"]");
+				throw new IllegalArgumentException(
+						"Unable to find WebApplication bean with name [" + beanName + "]");
 			}
 			return application;
-		} else {
+		}
+		else
+		{
 			Map beans = ac.getBeansOfType(WebApplication.class, false, false);
 			if (beans.size() == 0)
 			{