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>
- * <servlet>
- * <servlet-name>phonebook</servlet-name>
- * <servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
- * <init-param>
- * <param-name>applicationFactoryClassName</param-name>
- * <param-value>wicket.contrib.spring.SpringWebApplicationFactory</param-value>
- * </init-param>
- * <load-on-startup>1</load-on-startup>
- * </servlet>
+ * <servlet>
+ * <servlet-name>phonebook</servlet-name>
+ * <servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
+ * <init-param>
+ * <param-name>applicationFactoryClassName</param-name>
+ * <param-value>wicket.contrib.spring.SpringWebApplicationFactory</param-value>
+ * </init-param>
+ * <load-on-startup>1</load-on-startup>
+ * </servlet>
* </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>
- * <servlet>
- * <servlet-name>phonebook</servlet-name>
- * <servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
- * <init-param>
- * <param-name>applicationFactoryClassName</param-name>
- * <param-value>wicket.contrib.spring.SpringWebApplicationFactory</param-value>
- * </init-param>
- * <init-param>
- * <param-name>beanName</param-name>
- * <param-value>phonebookApplication</param-value>
- * </init-param>
- * <load-on-startup>1</load-on-startup>
- * </servlet>
+ * <servlet>
+ * <servlet-name>phonebook</servlet-name>
+ * <servlet-class>wicket.protocol.http.WicketServlet</servlet-class>
+ * <init-param>
+ * <param-name>applicationFactoryClassName</param-name>
+ * <param-value>wicket.contrib.spring.SpringWebApplicationFactory</param-value>
+ * </init-param>
+ * <init-param>
+ * <param-name>beanName</param-name>
+ * <param-value>phonebookApplication</param-value>
+ * </init-param>
+ * <load-on-startup>1</load-on-startup>
+ * </servlet>
* </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)
{