You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2007/10/05 11:24:52 UTC

svn commit: r582156 - /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java

Author: skitching
Date: Fri Oct  5 02:24:51 2007
New Revision: 582156

URL: http://svn.apache.org/viewvc?rev=582156&view=rev
Log:
Get rid of Spring dependencies.

Modified:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java?rev=582156&r1=582155&r2=582156&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java Fri Oct  5 02:24:51 2007
@@ -21,7 +21,6 @@
 import java.io.IOException;
 
 import javax.faces.context.FacesContext;
-import javax.servlet.ServletContext;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
@@ -29,17 +28,14 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.orchestra.conversation.ConversationWiperThread;
 import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
 import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapterInterface;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
 
 /**
- * A JSF Implementation for the FrameworkAdapter.
+ * An implementation of the FrameworkAdapter for JSF environments.
  * <p>
- * This class requires the OrchestraServletFilter to be configured to run for every
- * JSF request.
+ * This class requires the JsfFrameworkAdapterFilter to be configured to run
+ * or every JSF request.
  */
 public class JsfFrameworkAdapter implements FrameworkAdapterInterface
 {
@@ -97,6 +93,9 @@
 			return context.getExternalContext().getRequestParameterMap().get(key);
 		}
 
+		// Fall back to standard request stuff. Note that this is necessary as this
+		// method might be called before the FacesServletFilter has been run, ie
+		// the FacesContext might not yet exist. 
 		HttpServletRequest request = getRequest();
 		if (request != null)
 		{
@@ -245,14 +244,6 @@
 		throw new IllegalStateException(ISE_MESSAGE);
 	}
 
-	protected ConfigurableApplicationContext getApplicationContext()
-	{
-		// TODO: What about portlets ?
-		ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
-
-		return (ConfigurableApplicationContext) WebApplicationContextUtils.getWebApplicationContext(servletContext);
-	}
-
 	public void redirect(String url) throws IOException
 	{
 		StringBuffer redir = new StringBuffer();
@@ -272,11 +263,16 @@
 
 	public Object getBean(String name)
 	{
-		if (!getApplicationContext().containsBean(name))
+		FacesContext context = getFacesContext();
+		if (context == null)
 		{
-			return null;
+			throw new IllegalStateException("getBean invoked before FacesServlet");
 		}
-		return getApplicationContext().getBean(name);
+
+		Object bean = context.getApplication()
+	        .getVariableResolver().resolveVariable(context, name);		
+
+		return bean;
 	}
 
 	public void invokeNavigation(String navigationName)