Author: julien(a)jboss.com
Date: 2007-06-28 22:32:27 -0400 (Thu, 28 Jun 2007)
New Revision: 7632
Modified:
tags/JBoss_Portal_2_6_0_CR3/faces/src/main/org/jboss/portal/faces/portlet/JSFMetaBridgePortlet.java
Log:
facelet config fix
Modified:
tags/JBoss_Portal_2_6_0_CR3/faces/src/main/org/jboss/portal/faces/portlet/JSFMetaBridgePortlet.java
===================================================================
---
tags/JBoss_Portal_2_6_0_CR3/faces/src/main/org/jboss/portal/faces/portlet/JSFMetaBridgePortlet.java 2007-06-29
02:28:05 UTC (rev 7631)
+++
tags/JBoss_Portal_2_6_0_CR3/faces/src/main/org/jboss/portal/faces/portlet/JSFMetaBridgePortlet.java 2007-06-29
02:32:27 UTC (rev 7632)
@@ -32,7 +32,12 @@
import javax.portlet.PortletSecurityException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.PortletContext;
+import javax.faces.context.FacesContext;
+import javax.faces.application.ViewHandler;
import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.Map;
/**
* JSF portlet which works with every JSF implementation existing on my radar.
@@ -82,6 +87,32 @@
// Proceed to life cycle
PortletConfig bridgeConfig = new JSFMetaBridgePortletConfig(config, metaBridge);
bridgePortlet.init(bridgeConfig);
+
+
+ // If we do that it means we are desesperate to make the same JSF app work in a
+ // a portlet environment with different JSF impl and different bridges
+ // it's 5:00 AM in the morning and that kind of stuff deserves a good rant
+ if (metaBridge instanceof SunRIJSFBridge)
+ {
+ try
+ {
+ PortletContext portletContext = config.getPortletContext();
+ Field servletContextField =
portletContext.getClass().getDeclaredField("servletContext");
+ servletContextField.setAccessible(true);
+ Object servletContext = servletContextField.get(portletContext);
+ Field contextField =
servletContext.getClass().getDeclaredField("context");
+ contextField.setAccessible(true);
+ Object context = contextField.get(servletContext);
+ Field parametersField =
context.getClass().getDeclaredField("parameters");
+ parametersField.setAccessible(true);
+ Map parameters = (Map)parametersField.get(context);
+ parameters.put("facelets.BUILD_BEFORE_RESTORE", "true");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
}
public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
Show replies by date