Author: alexsmirnov
Date: 2008-01-25 19:38:11 -0500 (Fri, 25 Jan 2008)
New Revision: 5656
Added:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/SeamPortletLifecycle.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/seam/ConversationIdRetriver.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/jboss/
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/jboss/seam/
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/jboss/seam/jsf/
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/jboss/seam/jsf/SeamPhaseListenerWrapper.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/resources/META-INF/.faces-config.xml.jsfdia
Removed:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletStateHolder.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/RenderPortletExternalContextImpl.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/ServletExternalContextImpl.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycleFactory.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/seam/SeamPhaseListener.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/resources/META-INF/faces-config.xml
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/ajaxrepeaterportlet-object.xml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/jboss-portlet.xml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/hotel.xhtml
Log:
Fix some Seam issues. Support Seam conversations propagation between portal and AJAX
requests.
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -14,6 +14,7 @@
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
+import javax.faces.lifecycle.Lifecycle;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
@@ -79,6 +80,8 @@
synchronized (portletContext) {
init();
PortletStateHolder.init(portletContext);
+ Lifecycle lifecycle = getLifecycle();
+ lifecycle.getPhaseListeners();
}
} catch (FacesException e) {
throw new PortletException("Initialization error", e);
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletStateHolder.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletStateHolder.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletStateHolder.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -148,12 +148,14 @@
*/
public PortletViewState getWindowState(FacesContext context) {
String stateId = getStateId(context);
- PortletViewState state;
- synchronized (states) {
- state = getWindowState(stateId);
- if (null == state) {
- state = new PortletViewState(stateId);
- states.put(stateId, state);
+ PortletViewState state = null;
+ if (null != stateId) {
+ synchronized (states) {
+ state = getWindowState(stateId);
+ if (null == state) {
+ state = new PortletViewState(stateId);
+ states.put(stateId, state);
+ }
}
}
return state;
@@ -164,8 +166,10 @@
* @return
*/
public PortletViewState getWindowState(String stateId) {
- PortletViewState state;
+ PortletViewState state = null;
+ if (null != stateId) {
state = (PortletViewState) states.get(stateId);
+ }
return state;
}
@@ -189,9 +193,9 @@
if (request instanceof HttpServletRequest) {
HttpServletRequest servletRequest = (HttpServletRequest) request;
stateId = servletRequest.getParameter(STATE_ID_PARAMETER);
- if (null == stateId) {
- throw new FacesException("No portlet stateId parameter for AJAX request");
- }
+// if (null == stateId) {
+// throw new FacesException("No portlet stateId parameter for AJAX
request");
+// }
} else if (request instanceof PortletRequest) {
PortletRequest portletRequest = (PortletRequest) request;
PortletSession portletSession = portletRequest
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -24,12 +24,26 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.portlet.context.AbstractExternalContext;
import org.ajax4jsf.portlet.context.PortalActionURL;
+import org.ajax4jsf.portlet.seam.ConversationIdRetriver;
+import org.ajax4jsf.renderkit.AjaxContainerRenderer;
/**
* @author asmirnov
*
*/
public class PortletViewState implements Serializable {
+
+ private static ConversationIdRetriver conversationIdRetriver;
+
+ static {
+ try {
+ conversationIdRetriver = new ConversationIdRetriver();
+ } catch(NoClassDefFoundError e){
+ // Do nothing, no seam classes available.
+ String message = e.getMessage();
+ conversationIdRetriver = null;
+ }
+ }
/**
*
@@ -86,7 +100,12 @@
private final String stateId;
private String windowId;
+
+ private String conversationIdParameter="conversationId";
+
+ private String conversationId;
+
/**
* @param stateId
*/
@@ -254,7 +273,8 @@
*/
public void saveBeans(FacesContext facesContext) {
beans = null;
- Map<String, Object> requestMap = facesContext.getExternalContext()
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Map<String, Object> requestMap = externalContext
.getRequestMap();
List existingAttributes = (List) requestMap
.get(AbstractExternalContext.EXCLUDED_PARAMETERS_ATTRIBUTE);
@@ -286,8 +306,22 @@
beans.put(attributeName, entry.getValue());
}
}
- requestParameters = new HashMap<String, String[]>(facesContext
- .getExternalContext().getRequestParameterValuesMap());
+ // Save request parameters ( all or a View state only ) restored as requered
+ // in the JSR 301 PLT 5.1
+ String preserveActionParamAttr =
externalContext.getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX+Bridge.PRESERVE_ACTION_PARAMS);
+ if(null != preserveActionParamAttr &&
"true".equalsIgnoreCase(preserveActionParamAttr)){
+ requestParameters = new HashMap<String,
String[]>(externalContext.getRequestParameterValuesMap());
+ requestParameters.remove(AjaxContainerRenderer.AJAX_PARAMETER_NAME);
+ } else {
+ requestParameters = new HashMap<String, String[]>();
+ String[] viewStateParam = externalContext
+ .getRequestParameterValuesMap().get(
+ ResponseStateManager.VIEW_STATE_PARAM);
+ if (null != viewStateParam && viewStateParam.length > 0) {
+ requestParameters.put(ResponseStateManager.VIEW_STATE_PARAM,
+ viewStateParam);
+ }
+ }
saveSeamConversationId(facesContext);
}
@@ -296,25 +330,8 @@
*/
public void saveSeamConversationId(FacesContext facesContext) {
// Seam hack - save conversation Id for a request parameter.
- try {
- Application application = facesContext.getApplication();
- Object isLongRunningConversation = application
- .evaluateExpressionGet(facesContext, "#{conversation.longRunning}",
- Boolean.class);
- if (Boolean.TRUE.equals(isLongRunningConversation)) {
- Object conversationId = application.evaluateExpressionGet(
- facesContext, "#{conversation.id}", Object.class);
- if (null != conversationId) {
- requestParameters.put(
- AbstractExternalContext.CONVERSATION_ID_PARAMETER,
- new String[] { conversationId.toString() });
- }
-
- } else {
- requestParameters.remove(AbstractExternalContext.CONVERSATION_ID_PARAMETER);
- }
- } catch (Exception e) {
- // Do nothing - no seam conversation found !
+ if(null != conversationIdRetriver) {
+ conversationIdRetriver.setConversationIdParameter(this);
}
}
@@ -324,9 +341,16 @@
if (null != beans) {
requestMap.putAll(beans);
}
+ HashMap<String, String[]> parameters;
if (null != requestParameters) {
- requestMap.put(REQUEST_PARAMETERS_ATTRIBUTE, requestParameters);
+ parameters = new HashMap<String, String[]>(requestParameters);
+ } else {
+ parameters = new HashMap<String, String[]>();
}
+ if(null != conversationId){
+ parameters.put(conversationIdParameter, new String[]{conversationId});
+ }
+ requestMap.put(REQUEST_PARAMETERS_ATTRIBUTE, parameters);
}
public void restoreRequest(FacesContext facesContext, boolean b) {
@@ -421,6 +445,35 @@
this.treeStructure=null;
this.viewRoot=null;
this.viewId=null;
+ this.conversationId=null;
}
+
+ /**
+ * @return the conversationIdParameter
+ */
+ public String getConversationIdParameter() {
+ return conversationIdParameter;
+ }
+ /**
+ * @param conversationIdParameter the conversationIdParameter to set
+ */
+ public void setConversationIdParameter(String conversationIdParameter) {
+ this.conversationIdParameter = conversationIdParameter;
+ }
+
+ /**
+ * @return the conversationId
+ */
+ public String getConversationId() {
+ return conversationId;
+ }
+
+ /**
+ * @param conversationId the conversationId to set
+ */
+ public void setConversationId(String conversationId) {
+ this.conversationId = conversationId;
+ }
+
}
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/RenderPortletExternalContextImpl.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/RenderPortletExternalContextImpl.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/RenderPortletExternalContextImpl.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -143,31 +143,7 @@
if (null == _requestParameters) {
// Get parameters ( all or a View state only ) restored as requered
// in the JSR 301 PLT 5.1
- Object preserveRequestAttr = Boolean.FALSE;
- PortletConfig portletConfig = (PortletConfig)
getRequestAttribute(PORTLET_CONFIG_ATTRIBUTE);
- if (null != portletConfig) {
- String portletPreserveParamName = Bridge.PORTLET_ATTR_PREFIX
- + portletConfig.getPortletName()
- + Bridge.PRESERVE_ACTION_PARAM_ATTR_SUFFIX;
- preserveRequestAttr = getContextAttribute(portletPreserveParamName);
- }
- Map<String, String[]> parameters = (Map<String, String[]>)
getRequestAttribute(PortletViewState.REQUEST_PARAMETERS_ATTRIBUTE);
- if (Boolean.TRUE.equals(preserveRequestAttr)) {
- _requestParameters = parameters;
- } else if (null != parameters) {
- _requestParameters = new HashMap<String, String[]>();
- String[] viewState = parameters
- .get(ResponseStateManager.VIEW_STATE_PARAM);
- if (null != viewState) {
- _requestParameters.put(
- ResponseStateManager.VIEW_STATE_PARAM, viewState);
-
- }
- String[] conversationId = parameters.get(CONVERSATION_ID_PARAMETER);
- if(null != conversationId){
- _requestParameters.put(CONVERSATION_ID_PARAMETER, conversationId);
- }
- }
+ _requestParameters = (Map<String, String[]>)
getRequestAttribute(PortletViewState.REQUEST_PARAMETERS_ATTRIBUTE);
}
return _requestParameters;
}
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/ServletExternalContextImpl.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/ServletExternalContextImpl.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/ServletExternalContextImpl.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -58,6 +58,8 @@
ArrayList excludedAttributes = Collections.list(request
.getAttributeNames());
request.setAttribute(EXCLUDED_PARAMETERS_ATTRIBUTE, excludedAttributes);
+ namespace="";
+ sessionPrefix="";
PortletStateHolder portletStateHolder = (PortletStateHolder) context
.getAttribute(PortletStateHolder.STATE_HOLDER);
if (null != portletStateHolder) {
@@ -71,9 +73,6 @@
+ windowState.getWindowId() + '?';
portalActionUrl = windowState.getPortalActionURL();
}
- } else {
- namespace="";
- sessionPrefix="";
}
}
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -37,8 +37,8 @@
public void afterPhase(PhaseEvent event) {
PhaseId phaseId = event.getPhaseId();
FacesContext context = event.getFacesContext();
- Object portletPhase = context.getExternalContext().getRequestMap()
- .get(Bridge.PORTLET_LIFECYCLE_PHASE);
+ Object portletPhase = context.getExternalContext().getRequestMap().get(
+ Bridge.PORTLET_LIFECYCLE_PHASE);
if (phaseId.equals(PhaseId.RESTORE_VIEW)) {
if (Bridge.PortletPhase.RenderPhase.equals(portletPhase)) {
context.renderResponse();
@@ -46,14 +46,24 @@
} else if (phaseId.equals(PhaseId.RENDER_RESPONSE)) {
// save Seam conversation Id.
PortletViewState windowState = PortletStateHolder.getInstance(
- context).getWindowState(context);
- windowState.saveSeamConversationId(context);
- } else if (null == portletPhase && (phaseId.equals(PhaseId.INVOKE_APPLICATION)
- && context.getRenderResponse())) {
- // save request scope variables and Faces Messages for a Servlet request.
+ context).getWindowState(context);
+ if (null != windowState) {
+ windowState.saveSeamConversationId(context);
+ }
+ } else if (phaseId.equals(PhaseId.INVOKE_APPLICATION)
+ || context.getRenderResponse() || context.getResponseComplete()) {
+ // save request scope variables and Faces Messages for a Servlet
+ // request.
PortletViewState windowState = PortletStateHolder.getInstance(
context).getWindowState(context);
- windowState.saveRequest(context);
+ if (null != windowState) {
+ if (null == portletPhase) {
+ windowState.saveRequest(context);
+ } else if (Bridge.PortletPhase.ActionPhase.equals(portletPhase)) {
+ windowState.saveSeamConversationId(context);
+ }
+
+ }
}
}
@@ -77,8 +87,10 @@
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
Map commonAjaxParameters = ajaxContext.getCommonAjaxParameters();
- PortletStateHolder portletStateHolder = PortletStateHolder.getInstance(context);
- String stateId = requestParameters.get(PortletStateHolder.STATE_ID_PARAMETER);
+ PortletStateHolder portletStateHolder = PortletStateHolder
+ .getInstance(context);
+ String stateId = requestParameters
+ .get(PortletStateHolder.STATE_ID_PARAMETER);
// Change viewId parameter in the portal action URL.
PortletViewState windowState = portletStateHolder
.getWindowState(stateId);
Deleted:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -1,134 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.portlet.lifecycle;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseListener;
-import javax.faces.lifecycle.Lifecycle;
-import javax.portlet.PortletRequest;
-
-import org.ajax4jsf.portlet.application.PortletStateHolder;
-import org.ajax4jsf.portlet.application.PortletViewState;
-
-/**
- * @author asmirnov
- *
- */
-public class PortletLifecycle extends Lifecycle {
-
- //List<PhaseListener>
- private final List _phaseListeners = new ArrayList();
-
- private final LifecyclePhase executePhase = new RestoreViewPhase(this);
-
- private final LifecyclePhase renderPhase = new RenderResponsePhase(this);
-
- private PhaseListener[] _phaseListenersArray = null;
-
- public PortletLifecycle() {
- }
-
- /**
- * @param listener
- * @see
javax.faces.lifecycle.Lifecycle#addPhaseListener(javax.faces.event.PhaseListener)
- */
- public void addPhaseListener(PhaseListener listener) {
- if(null == listener){
- throw new NullPointerException("PhaseListener for add to Lifecycle can't be
null");
- }
- synchronized (_phaseListeners) {
- _phaseListeners.add(listener);
- _phaseListenersArray = null;
- }
- }
-
-
- /**
- * @param listener
- * @see
javax.faces.lifecycle.Lifecycle#removePhaseListener(javax.faces.event.PhaseListener)
- */
- public void removePhaseListener(PhaseListener listener) {
- if(null == listener){
- throw new NullPointerException("PhaseListener for remove from Lifecycle can't
be null");
- }
- synchronized (_phaseListeners) {
- _phaseListeners.remove(listener);
- _phaseListenersArray = null;
- }
- }
-
- /**
- * @return
- * @see javax.faces.lifecycle.Lifecycle#getPhaseListeners()
- */
- public PhaseListener[] getPhaseListeners() {
- if (_phaseListenersArray == null) {
- // Lazy creation of a working copy listeners Array.
- synchronized (_phaseListeners) {
- _phaseListenersArray = (PhaseListener[]) _phaseListeners.toArray(new
PhaseListener[_phaseListeners.size()]);
- }
- }
-
- return _phaseListenersArray;
- }
-
- /**
- * @param context
- * @throws FacesException
- * @see javax.faces.lifecycle.Lifecycle#execute(javax.faces.context.FacesContext)
- */
- public void execute(FacesContext context) throws FacesException {
- executePhase.execute(context);
- // TODO - in the portlet mode, save state
-// Object request = context.getExternalContext().getRequest();
-// if(request instanceof PortletRequest){
-// context.getApplication().getStateManager().saveSerializedView(context);
-// }
-// // TODO - save request scope variables and Faces Messages.
-// PortletViewState windowState =
PortletStateHolder.getInstance(context).getWindowState(context);
-// windowState.saveMessages(context);
-// HashMap requestScopeBeans = new HashMap();
-// for (Iterator iterator =
context.getExternalContext().getRequestMap().entrySet().iterator(); iterator.hasNext();)
{
-// Entry entry = (Entry) iterator.next();
-// String paramName = entry.getKey().toString();
-// Object bean = entry.getValue();
-// if(!paramName.contains(".") && bean instanceof Serializable){
-// requestScopeBeans.put(paramName, bean);
-// }
-// }
-// if(requestScopeBeans.size()>0){
-// windowState.setRequestScopeBeans(requestScopeBeans);
-// }
- }
-
- /**
- * @param context
- * @throws FacesException
- * @see javax.faces.lifecycle.Lifecycle#render(javax.faces.context.FacesContext)
- */
- public void render(FacesContext context) throws FacesException {
- // TODO - in the portlet mode, restore state, request scope variables and Faces
Messages.
-// Object request = context.getExternalContext().getRequest();
-// if(request instanceof PortletRequest){
-// executePhase.executePhase(context);
-// PortletViewState windowState =
PortletStateHolder.getInstance(context).getWindowState(context);
-// windowState.restoreMessages(context);
-// Map requestScopeBeans = windowState.getRequestScopeBeans();
-// if(null != requestScopeBeans){
-// context.getExternalContext().getRequestMap().putAll(requestScopeBeans);
-// }
-// }
- renderPhase.execute(context);
- }
-
-}
Added:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java
(rev 0)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -0,0 +1,147 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet.lifecycle;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+import javax.portlet.PortletRequest;
+
+import org.ajax4jsf.portlet.application.PortletStateHolder;
+import org.ajax4jsf.portlet.application.PortletViewState;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class PortletLifecycle extends Lifecycle {
+
+ //List<PhaseListener>
+ private final List<PhaseListener> _phaseListeners = new
ArrayList<PhaseListener>();
+
+ private final LifecyclePhase executePhase = new RestoreViewPhase(this);
+
+ private final LifecyclePhase renderPhase = new RenderResponsePhase(this);
+
+ private PhaseListener[] _phaseListenersArray = null;
+
+ public PortletLifecycle() {
+ }
+
+ /**
+ * @param listener
+ * @see
javax.faces.lifecycle.Lifecycle#addPhaseListener(javax.faces.event.PhaseListener)
+ */
+ public void addPhaseListener(PhaseListener listener) {
+ if(null == listener){
+ throw new NullPointerException("PhaseListener for add to Lifecycle can't be
null");
+ }
+ synchronized (_phaseListeners) {
+ _phaseListeners.add(listener);
+ _phaseListenersArray = null;
+ }
+ }
+
+ /**
+ * @param listener
+ * @see
javax.faces.lifecycle.Lifecycle#addPhaseListener(javax.faces.event.PhaseListener)
+ */
+ protected void addPhaseListener(int index, PhaseListener listener) {
+ if(null == listener){
+ throw new NullPointerException("PhaseListener for add to Lifecycle can't be
null");
+ }
+ synchronized (_phaseListeners) {
+ _phaseListeners.add(index, listener);
+ _phaseListenersArray = null;
+ }
+ }
+
+ /**
+ * @param listener
+ * @see
javax.faces.lifecycle.Lifecycle#removePhaseListener(javax.faces.event.PhaseListener)
+ */
+ public void removePhaseListener(PhaseListener listener) {
+ if(null == listener){
+ throw new NullPointerException("PhaseListener for remove from Lifecycle can't
be null");
+ }
+ synchronized (_phaseListeners) {
+ _phaseListeners.remove(listener);
+ _phaseListenersArray = null;
+ }
+ }
+
+ /**
+ * @return
+ * @see javax.faces.lifecycle.Lifecycle#getPhaseListeners()
+ */
+ public PhaseListener[] getPhaseListeners() {
+ if (_phaseListenersArray == null) {
+ // Lazy creation of a working copy listeners Array.
+ synchronized (_phaseListeners) {
+ _phaseListenersArray = (PhaseListener[]) _phaseListeners.toArray(new
PhaseListener[_phaseListeners.size()]);
+ }
+ }
+
+ return _phaseListenersArray;
+ }
+
+ /**
+ * @param context
+ * @throws FacesException
+ * @see javax.faces.lifecycle.Lifecycle#execute(javax.faces.context.FacesContext)
+ */
+ public void execute(FacesContext context) throws FacesException {
+ executePhase.execute(context);
+ // TODO - in the portlet mode, save state
+// Object request = context.getExternalContext().getRequest();
+// if(request instanceof PortletRequest){
+// context.getApplication().getStateManager().saveSerializedView(context);
+// }
+// // TODO - save request scope variables and Faces Messages.
+// PortletViewState windowState =
PortletStateHolder.getInstance(context).getWindowState(context);
+// windowState.saveMessages(context);
+// HashMap requestScopeBeans = new HashMap();
+// for (Iterator iterator =
context.getExternalContext().getRequestMap().entrySet().iterator(); iterator.hasNext();)
{
+// Entry entry = (Entry) iterator.next();
+// String paramName = entry.getKey().toString();
+// Object bean = entry.getValue();
+// if(!paramName.contains(".") && bean instanceof Serializable){
+// requestScopeBeans.put(paramName, bean);
+// }
+// }
+// if(requestScopeBeans.size()>0){
+// windowState.setRequestScopeBeans(requestScopeBeans);
+// }
+ }
+
+ /**
+ * @param context
+ * @throws FacesException
+ * @see javax.faces.lifecycle.Lifecycle#render(javax.faces.context.FacesContext)
+ */
+ public void render(FacesContext context) throws FacesException {
+ // TODO - in the portlet mode, restore state, request scope variables and Faces
Messages.
+// Object request = context.getExternalContext().getRequest();
+// if(request instanceof PortletRequest){
+// executePhase.executePhase(context);
+// PortletViewState windowState =
PortletStateHolder.getInstance(context).getWindowState(context);
+// windowState.restoreMessages(context);
+// Map requestScopeBeans = windowState.getRequestScopeBeans();
+// if(null != requestScopeBeans){
+// context.getExternalContext().getRequestMap().putAll(requestScopeBeans);
+// }
+// }
+ renderPhase.execute(context);
+ }
+
+}
Property changes on:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycleFactory.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycleFactory.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycleFactory.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -37,8 +37,6 @@
private LifecycleFactory _defaultFactory;
- //Map<String, Lifecycle>
- private final Map _lifecycles = new HashMap(1);
// private Map _lifecycles = new HashMap();
@@ -49,34 +47,39 @@
public PortletLifecycleFactory(LifecycleFactory defaultFactory) {
super();
this._defaultFactory = defaultFactory;
- this._lifecycles.put(DEFAULT_LIFECYCLE, new PortletLifecycle());
+ this._defaultFactory.addLifecycle(
+ SeamPortletLifecycle.SEAM_PORTLET_LIFECYCLE,
+ new SeamPortletLifecycle());
}
- /* (non-Javadoc)
+
+ /**
+ * @param lifecycleId
+ * @param lifecycle
* @see javax.faces.lifecycle.LifecycleFactory#addLifecycle(java.lang.String,
javax.faces.lifecycle.Lifecycle)
*/
public void addLifecycle(String lifecycleId, Lifecycle lifecycle) {
- if(null == lifecycleId || null == lifecycle){
- throw new NullPointerException("arguments for a addLifecycle method can't be
null");
- }
- _lifecycles.put(lifecycleId, lifecycle);
+ _defaultFactory.addLifecycle(lifecycleId, lifecycle);
}
- /* (non-Javadoc)
+
+ /**
+ * @param lifecycleId
+ * @return
* @see javax.faces.lifecycle.LifecycleFactory#getLifecycle(java.lang.String)
*/
public Lifecycle getLifecycle(String lifecycleId) {
- if(null == lifecycleId ){
- throw new NullPointerException("argument for a removeLifecycle method can't
be null");
- }
- return (Lifecycle) _lifecycles.get(lifecycleId);
+ return _defaultFactory.getLifecycle(lifecycleId);
}
- /* (non-Javadoc)
+
+ /**
+ * @return
* @see javax.faces.lifecycle.LifecycleFactory#getLifecycleIds()
*/
- public Iterator getLifecycleIds() {
- return _lifecycles.keySet().iterator();
+ public Iterator<String> getLifecycleIds() {
+ return _defaultFactory.getLifecycleIds();
}
+
}
Copied:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/SeamPortletLifecycle.java
(from rev 5602,
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortletLifecycle.java)
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/SeamPortletLifecycle.java
(rev 0)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/SeamPortletLifecycle.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet.lifecycle;
+
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+
+import org.jboss.seam.jsf.SeamPhaseListenerWrapper;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class SeamPortletLifecycle extends PortletLifecycle {
+
+ public static final String SEAM_PORTLET_LIFECYCLE = "SEAM_PORTLET";
+ public static final String SEAM_PHASE_LISTENER_CLASS =
"org.jboss.seam.jsf.SeamPhaseListener";
+
+
+ private PhaseListener seamListener;
+
+ private SeamPhaseListenerWrapper seamListenerWrapper;
+
+
+ /**
+ * @param listener
+ * @see
javax.faces.lifecycle.Lifecycle#addPhaseListener(javax.faces.event.PhaseListener)
+ */
+ public void addPhaseListener(PhaseListener listener) {
+ // Existing Seam 2.0 releases hack - replace SeamPhaseListener by our
bridge-compatible version.
+ if(SEAM_PHASE_LISTENER_CLASS.equals(listener.getClass().getName())){
+ if(null == seamListener){
+ seamListener = listener;
+ seamListenerWrapper = new SeamPhaseListenerWrapper(listener);
+ addPhaseListener(0, seamListenerWrapper);
+ } else {
+ throw new FacesException("Attempt to register second SeamPhaseListener");
+ }
+ } else {
+ super.addPhaseListener(listener);
+ }
+ }
+
+
+
+
+
+ /**
+ * @param listener
+ * @see
javax.faces.lifecycle.Lifecycle#removePhaseListener(javax.faces.event.PhaseListener)
+ */
+ public void removePhaseListener(PhaseListener listener) {
+ if(listener == this.seamListener){
+ listener = seamListenerWrapper;
+ seamListener = seamListenerWrapper = null;
+ }
+ super.removePhaseListener(listener);
+ }
+
+
+
+
+}
Added:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/seam/ConversationIdRetriver.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/seam/ConversationIdRetriver.java
(rev 0)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/seam/ConversationIdRetriver.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -0,0 +1,36 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet.seam;
+
+import java.util.Map;
+
+import org.ajax4jsf.portlet.application.PortletViewState;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Manager;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class ConversationIdRetriver {
+
+ public ConversationIdRetriver() {
+ // Attempt to load Manager class.
+ Manager.class.getName();
+ }
+
+ public void setConversationIdParameter(PortletViewState state) {
+ if (Contexts.isEventContextActive()) {
+ Manager manager = Manager.instance();
+ if (manager.isLongRunningConversation()) {
+ state.setConversationIdParameter(manager.getConversationIdParameter());
+ state.setConversationId( manager.getCurrentConversationId() );
+ } else {
+ state.setConversationIdParameter(null);
+ state.setConversationId(null);
+ }
+ }
+ }
+
+}
Property changes on:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/seam/ConversationIdRetriver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/seam/SeamPhaseListener.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/seam/SeamPhaseListener.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/seam/SeamPhaseListener.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -57,7 +57,7 @@
*/
public class SeamPhaseListener implements PhaseListener
{
- private static final long serialVersionUID = -9127555729455066493L;
+ private static final long serialVersionUID = -91275557294550234L;
private static final LogProvider log =
Logging.getLogProvider(SeamPhaseListener.class);
Added:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/jboss/seam/jsf/SeamPhaseListenerWrapper.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/jboss/seam/jsf/SeamPhaseListenerWrapper.java
(rev 0)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/jboss/seam/jsf/SeamPhaseListenerWrapper.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -0,0 +1,188 @@
+/**
+ *
+ */
+package org.jboss.seam.jsf;
+
+import static javax.faces.event.PhaseId.INVOKE_APPLICATION;
+import static javax.faces.event.PhaseId.PROCESS_VALIDATIONS;
+import static javax.faces.event.PhaseId.RENDER_RESPONSE;
+import static javax.faces.event.PhaseId.RESTORE_VIEW;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.portlet.faces.Bridge;
+import javax.portlet.faces.Bridge.PortletPhase;
+
+import org.ajax4jsf.portlet.application.PortletStateHolder;
+import org.ajax4jsf.portlet.application.PortletViewState;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.contexts.FacesLifecycle;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.exception.Exceptions;
+import org.jboss.seam.faces.FacesMessages;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class SeamPhaseListenerWrapper implements PhaseListener {
+
+ private final SeamPhaseListener _defaultListener;
+
+ private static final Log log = LogFactory
+ .getLog(SeamPhaseListenerWrapper.class);
+
+ /**
+ * @param defaultListener
+ */
+ public SeamPhaseListenerWrapper(PhaseListener defaultListener) {
+ _defaultListener = (SeamPhaseListener) defaultListener;
+ }
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8465467659533393697L;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
+ */
+ public void afterPhase(PhaseEvent event) {
+ FacesContext facesContext = event.getFacesContext();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Bridge.PortletPhase portletPhase = (PortletPhase) externalContext
+ .getRequestMap().get(Bridge.PORTLET_LIFECYCLE_PHASE);
+ if (null != portletPhase) {
+ try {
+ _defaultListener.raiseEventsAfterPhase(event);
+ afterPortletPhase(event, facesContext, portletPhase);
+ } catch (Exception e) {
+ log.debug("uncaught exception, try to recovery", e);
+ try {
+ Exceptions.instance().handle(e);
+ // A redirect occurred inside the error handler, and we are
+ // in after
+ // phase, so we need to clean up now as there are no more
+ // after
+ // phases to be run
+ if (facesContext.getResponseComplete()) {
+ _defaultListener.afterResponseComplete(facesContext);
+ }
+ } catch (Exception ehe) {
+ log.error("swallowing exception", e);
+ }
+ }
+ FacesLifecycle.clearPhaseId();
+
+ } else {
+ _defaultListener.afterPhase(event);
+ }
+ }
+
+ private void afterPortletPhase(PhaseEvent event, FacesContext facesContext,
+ PortletPhase portletPhase) {
+
+ PhaseId phaseId = event.getPhaseId();
+ if (phaseId == RESTORE_VIEW) {
+ _defaultListener.afterRestoreView(facesContext);
+ } else if (phaseId == INVOKE_APPLICATION) {
+ _defaultListener.afterInvokeApplication();
+ } else if (phaseId == PROCESS_VALIDATIONS) {
+ _defaultListener.afterProcessValidations(facesContext);
+ }
+
+ FacesMessages.afterPhase();
+
+ // delegate to subclass:
+ _defaultListener.handleTransactionsAfterPhase(event);
+
+ if (phaseId == RENDER_RESPONSE) {
+ // writeConversationIdToResponse(
+ // facesContext.getExternalContext().getResponse() );
+ _defaultListener.afterRenderResponse(facesContext);
+ } else if (Bridge.PortletPhase.ActionPhase.equals(portletPhase)
+ && (phaseId == INVOKE_APPLICATION
+ || facesContext.getRenderResponse() || facesContext
+ .getResponseComplete())) {
+ Manager manager = Manager.instance();
+ manager.beforeRedirect();
+ // save Seam conversation Id.
+ PortletViewState windowState = PortletStateHolder.getInstance(
+ facesContext).getWindowState(facesContext);
+ windowState.saveSeamConversationId(facesContext);
+ _defaultListener.afterResponseComplete(facesContext);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.PhaseListener#beforePhase(javax.faces.event.PhaseEvent)
+ */
+ public void beforePhase(PhaseEvent event) {
+ FacesContext facesContext = event.getFacesContext();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Bridge.PortletPhase portletPhase = (PortletPhase) externalContext
+ .getRequestMap().get(Bridge.PORTLET_LIFECYCLE_PHASE);
+ if (null != portletPhase) {
+ log.trace("before phase: " + event.getPhaseId());
+
+ FacesLifecycle.setPhaseId(event.getPhaseId());
+
+ try {
+ beforePortletPhase(event, facesContext, portletPhase);
+ _defaultListener.raiseEventsBeforePhase(event);
+ } catch (Exception e) {
+ log.debug("uncaught exception, try to recovery", e);
+ try {
+ Exceptions.instance().handle(e);
+ } catch (Exception ehe) {
+ log.error("swallowing exception", e);
+ }
+ }
+ } else {
+ _defaultListener.beforePhase(event);
+ }
+ }
+
+ private void beforePortletPhase(PhaseEvent event,
+ FacesContext facesContext, PortletPhase portletPhase) {
+
+ boolean notInitialised=false;
+ if (event.getPhaseId() == RESTORE_VIEW ) {
+ _defaultListener.beforeRestoreView(facesContext);
+ }
+
+ if (event.getPhaseId() == RENDER_RESPONSE &&
!Contexts.isApplicationContextActive()) {
+ _defaultListener.beforeRestoreView(facesContext);
+ notInitialised = true;
+ }
+ // delegate to subclass:
+ _defaultListener.handleTransactionsBeforePhase(event);
+
+ if (event.getPhaseId() == RENDER_RESPONSE) {
+ if(notInitialised){
+ _defaultListener.afterRestoreView(facesContext);
+ }
+ _defaultListener.beforeRenderResponse(facesContext);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.PhaseListener#getPhaseId()
+ */
+ public PhaseId getPhaseId() {
+ return _defaultListener.getPhaseId();
+ }
+
+}
Property changes on:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/jboss/seam/jsf/SeamPhaseListenerWrapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Revision Author
Added:
trunk/extensions/portletbridge/portletbridge-impl/src/main/resources/META-INF/.faces-config.xml.jsfdia
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/resources/META-INF/.faces-config.xml.jsfdia
(rev 0)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/resources/META-INF/.faces-config.xml.jsfdia 2008-01-26
00:38:11 UTC (rev 5656)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS ENTITY="JSFProcess"/>
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/resources/META-INF/faces-config.xml
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/resources/META-INF/faces-config.xml 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/resources/META-INF/faces-config.xml 2008-01-26
00:38:11 UTC (rev 5656)
@@ -10,6 +10,9 @@
<faces-context-factory>
org.ajax4jsf.portlet.context.FacesContextFactoryImpl
</faces-context-factory>
+ <lifecycle-factory>
+ org.ajax4jsf.portlet.lifecycle.PortletLifecycleFactory
+ </lifecycle-factory>
</factory>
<lifecycle>
<phase-listener>
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -260,7 +260,7 @@
protected SerializedView buildSerializedView(FacesContext context) {
SerializedView serializedView = null;
UIViewRoot viewRoot = context.getViewRoot();
- if (!viewRoot.isTransient()) {
+ if (null !=viewRoot && !viewRoot.isTransient()) {
TreeStrutureNode treeStructure = (TreeStrutureNode) getTreeStructureToSave(context);
Object state = getComponentStateToSave(context);
if (isSavingStateInClient(context)) {
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-01-26
00:38:11 UTC (rev 5656)
@@ -34,6 +34,7 @@
import java.util.Set;
import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
import javax.faces.application.Application;
import javax.faces.application.StateManager;
import javax.faces.application.ViewHandler;
@@ -46,6 +47,7 @@
import javax.faces.context.ResponseWriter;
import javax.faces.event.AbortProcessingException;
import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@@ -493,22 +495,40 @@
StateManager stateManager = context.getApplication().getStateManager();
SerializedView serializedView = stateManager
.saveSerializedView(context);
- if (null != serializedView) {
+ if (null != serializedView && null != writer) {
StringWriter bufWriter = new StringWriter();
- ResponseWriter cloneWithWriter = writer.cloneWithWriter(bufWriter);
- context.setResponseWriter(cloneWithWriter);
+ ResponseWriter tempWriter;
+// if(null != writer) {
+ tempWriter = writer.cloneWithWriter(bufWriter);
+// } else {
+// tempWriter = getRenderKit(context).createResponseWriter(bufWriter, null, null);
+// }
+ context.setResponseWriter(tempWriter);
stateManager.writeState(context, serializedView);
- cloneWithWriter.flush();
+ tempWriter.flush();
if (bufWriter.getBuffer().length() > 0) {
context.getExternalContext().getRequestMap().put(
AjaxViewHandler.SERIALIZED_STATE_KEY,
bufWriter.toString());
}
// Restore original writer.
- context.setResponseWriter(writer);
+// if (null != writer) {
+ context.setResponseWriter(writer);
+// }
}
}
+ protected RenderKit getRenderKit(FacesContext context) {
+ RenderKit renderKit = context.getRenderKit();
+ if (null == renderKit) {
+ String renderKitId =
context.getApplication().getViewHandler().calculateRenderKitId(context);
+ RenderKitFactory factory = (RenderKitFactory) FactoryFinder
+ .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ renderKit = factory.getRenderKit(context, renderKitId);
+ }
+ return renderKit;
+ }
+
/**
* @return Returns the ajaxRequest.
*/
Modified:
trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/ajaxrepeaterportlet-object.xml
===================================================================
---
trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/ajaxrepeaterportlet-object.xml 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/ajaxrepeaterportlet-object.xml 2008-01-26
00:38:11 UTC (rev 5656)
@@ -43,7 +43,9 @@
</deployment>
<deployment>
<if-exists>overwrite</if-exists>
- <parent-ref>default.default</parent-ref>
+ <parent-ref>default</parent-ref>
+ <page>
+ <page-name>ajaxRepeaterPortlet</page-name>
<window>
<window-name>richfacesPortletWindow</window-name>
<instance-ref>RichfacesPortletInstance</instance-ref>
@@ -51,6 +53,7 @@
<region>center</region>
<height>0</height>
</window>
+ </page>
</deployment>
<!--
<deployment>
Modified:
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/jboss-portlet.xml
===================================================================
---
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/jboss-portlet.xml 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/jboss-portlet.xml 2008-01-26
00:38:11 UTC (rev 5656)
@@ -6,7 +6,10 @@
<portlet>
<portlet-name>seamBookingPortlet</portlet-name>
<header-content>
- <link rel="stylesheet" type="text/css"
href="/css/screen.css" media="screen"/>
+ <script src="/faces/rfRes/org/ajax4jsf/framework.pack.js"
type="text/javascript" ></script>
+ <script src="/faces/rfRes/org/richfaces/ui.pack.js"
type="text/javascript" ></script>
+ <link rel="stylesheet" type="text/css"
href="/faces/rfRes/org/richfaces/skin.xcss" />
+ <link rel="stylesheet" type="text/css"
href="/css/screen.css" media="screen"/>
</header-content>
</portlet>
</portlet-app>
\ No newline at end of file
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml
===================================================================
---
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml 2008-01-26
00:37:14 UTC (rev 5655)
+++
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml 2008-01-26
00:38:11 UTC (rev 5656)
@@ -19,10 +19,25 @@
</context-param>
<context-param>
<param-name>javax.portlet.faces.renderPolicy</param-name>
- <param-value>
- ALWAYS_DELEGATE
- </param-value>
+ <param-value>ALWAYS_DELEGATE</param-value>
</context-param>
+ <context-param>
+ <param-name>javax.faces.LIFECYCLE_ID</param-name>
+ <param-value>SEAM_PORTLET</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
+ <param-value>rfRes</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.LoadStyleStrategy</param-name>
+ <param-value>NONE</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.LoadScriptStrategy</param-name>
+ <param-value>NONE</param-value>
+ </context-param>
+
<!-- Seam -->
<listener>
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/hotel.xhtml
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/hotel.xhtml 2008-01-26
00:37:14 UTC (rev 5655)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/hotel.xhtml 2008-01-26
00:38:11 UTC (rev 5656)
@@ -19,7 +19,7 @@
<div class="buttonBox">
<h:form id="hotel">
- <a:commandButton id="bookHotel"
action="#{hotelBooking.bookHotel}" value="Book Hotel"/>
+ <h:commandButton id="bookHotel"
action="#{hotelBooking.bookHotel}" value="Book Hotel"/>
 
<a:commandButton id="cancel" action="#{hotelBooking.cancel}"
value="Back to Search"/>
</h:form>