Author: alexsmirnov
Date: 2008-01-23 20:01:33 -0500 (Wed, 23 Jan 2008)
New Revision: 5573
Added:
trunk/ui/virtualEarth/src/main/java/META-INF/
trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF
Modified:
trunk/extensions/portletbridge/portletbridge-api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
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/PortletViewHandler.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/PortletExternalContextImpl.java
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/edit.xhtml
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/template.xhtml
Log:
Fix some Seam issues.
Modified:
trunk/extensions/portletbridge/portletbridge-api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2008-01-23
19:37:34 UTC (rev 5572)
+++
trunk/extensions/portletbridge/portletbridge-api/src/main/java/javax/portlet/faces/GenericFacesPortlet.java 2008-01-24
01:01:33 UTC (rev 5573)
@@ -83,7 +83,7 @@
config.getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX +
Bridge.RENDER_POLICY);
if (renderPolicy != null)
portletContext.setAttribute(Bridge.BRIDGE_PACKAGE_PREFIX +
- this.getPortletName() + "." +
Bridge.RENDER_POLICY,
+ this.getPortletName() +
Bridge.RENDER_POLICY_PARAM_ATTR_SUFFIX,
Bridge.BridgeRenderPolicy.valueOf(renderPolicy));
String preserveActionParams =
config.getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX +
Bridge.PRESERVE_ACTION_PARAMS);
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-23
19:37:34 UTC (rev 5572)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/AjaxPortletBridge.java 2008-01-24
01:01:33 UTC (rev 5573)
@@ -187,6 +187,8 @@
if(null != redirectViewId){
windowState.reset();
windowState.setViewId(redirectViewId);
+ // release old FacesContext.
+ facesContext.release();
// Reset attributes to initial state
ArrayList initialAttributes = (ArrayList)
request.getAttribute(AbstractExternalContext.EXCLUDED_PARAMETERS_ATTRIBUTE);
ArrayList currentAttributes = Collections.list(request.getAttributeNames());
@@ -194,8 +196,8 @@
for (Object newAttribute : currentAttributes) {
request.removeAttribute((String) newAttribute);
}
- // Re-create FacesContext.
- facesContext.release();
+ request.setAttribute(AbstractExternalContext.VIEW_ID_PARAMETER, redirectViewId);
+ // Create new FacesContext
facesContext = getFacesContext(request, response);
renderResponse(facesContext, windowState);
}
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java 2008-01-23
19:37:34 UTC (rev 5572)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java 2008-01-24
01:01:33 UTC (rev 5573)
@@ -82,17 +82,18 @@
public void renderView(FacesContext context, UIViewRoot viewToRender) throws
IOException,
FacesException
{
- // Get the renderPolicy from the requestScope
- Bridge.BridgeRenderPolicy renderPolicy = (Bridge.BridgeRenderPolicy) context
-
.getExternalContext()
-
.getRequestMap()
- .get(
-
AbstractExternalContext.RENDER_POLICY_ATTRIBUTE);
+ // Get the renderPolicy from the init parameters
+ String renderPolicyParam = context
+ .getExternalContext()
+ .getInitParameter(Bridge.BRIDGE_PACKAGE_PREFIX+Bridge.RENDER_POLICY);
- if (renderPolicy == null)
+ Bridge.BridgeRenderPolicy renderPolicy ;
+ if (renderPolicyParam == null)
{
- renderPolicy = Bridge.BridgeRenderPolicy.valueOf("DEFAULT");
- }
+ renderPolicy = Bridge.BridgeRenderPolicy.DEFAULT;
+ } else {
+ renderPolicy = Bridge.BridgeRenderPolicy.valueOf(renderPolicyParam);
+ }
if (context.getExternalContext().getContext() instanceof ServletContext
|| renderPolicy == Bridge.BridgeRenderPolicy.ALWAYS_DELEGATE)
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-23
19:37:34 UTC (rev 5572)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2008-01-24
01:01:33 UTC (rev 5573)
@@ -12,6 +12,7 @@
import java.util.Map;
import java.util.Map.Entry;
+import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
@@ -287,13 +288,30 @@
}
requestParameters = new HashMap<String, String[]>(facesContext
.getExternalContext().getRequestParameterValuesMap());
+ saveSeamConversationId(facesContext);
+ }
+
+ /**
+ * @param facesContext
+ */
+ public void saveSeamConversationId(FacesContext facesContext) {
// Seam hack - save conversation Id for a request parameter.
try {
- Object conversationId = facesContext.getApplication()
- .evaluateExpressionGet(facesContext, "#{conversation.id}",
- Object.class);
- if(null != conversationId){
- requestParameters.put(AbstractExternalContext.CONVERSATION_ID_PARAMETER, new
String[]{conversationId.toString()});
+ 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 !
Modified:
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/PortletExternalContextImpl.java
===================================================================
---
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/PortletExternalContextImpl.java 2008-01-23
19:37:34 UTC (rev 5572)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/context/PortletExternalContextImpl.java 2008-01-24
01:01:33 UTC (rev 5573)
@@ -289,10 +289,10 @@
private String _pathInfo = null;
public String getRequestPathInfo() {
- String pathInfo = (String) getRequestParameter(VIEW_ID_PARAMETER);
- if (null == pathInfo) {
- pathInfo = (String) getRequestAttribute(VIEW_ID_PARAMETER);
- }
+// String pathInfo = (String) getRequestParameter(VIEW_ID_PARAMETER);
+// if (null == pathInfo) {
+ String pathInfo = (String) getRequestAttribute(VIEW_ID_PARAMETER);
+// }
return pathInfo;
}
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-23
19:37:34 UTC (rev 5572)
+++
trunk/extensions/portletbridge/portletbridge-impl/src/main/java/org/ajax4jsf/portlet/lifecycle/PortalPhaseListener.java 2008-01-24
01:01:33 UTC (rev 5573)
@@ -43,9 +43,13 @@
if (Bridge.PortletPhase.RenderPhase.equals(portletPhase)) {
context.renderResponse();
}
+ } 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)
- || (!phaseId.equals(PhaseId.RENDER_RESPONSE) && context
- .getRenderResponse()))) {
+ && context.getRenderResponse())) {
// save request scope variables and Faces Messages for a Servlet request.
PortletViewState windowState = PortletStateHolder.getInstance(
context).getWindowState(context);
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-23
19:37:34 UTC (rev 5572)
+++
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/WEB-INF/web.xml 2008-01-24
01:01:33 UTC (rev 5573)
@@ -17,6 +17,12 @@
org.ajax4jsf.portlet.SeamExceptionHandlerImpl
</param-value>
</context-param>
+ <context-param>
+ <param-name>javax.portlet.faces.renderPolicy</param-name>
+ <param-value>
+ ALWAYS_DELEGATE
+ </param-value>
+ </context-param>
<!-- Seam -->
<listener>
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/edit.xhtml
===================================================================
--- trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/edit.xhtml 2008-01-23
19:37:34 UTC (rev 5572)
+++ trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/edit.xhtml 2008-01-24
01:01:33 UTC (rev 5573)
@@ -3,6 +3,7 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a="http://richfaces.org/a4j"
xmlns:s="http://jboss.com/products/seam/taglib">
<div class="entry">
@@ -15,7 +16,9 @@
<ui:insert/>
</s:validateAll>
</span>
+ <a:outputPanel ajaxRendered="true">
<s:message styleClass="error errors"/>
+ </a:outputPanel>
</div>
</ui:composition>
\ No newline at end of file
Modified: trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/template.xhtml
===================================================================
---
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/template.xhtml 2008-01-23
19:37:34 UTC (rev 5572)
+++
trunk/samples/seamPortletEar/seamBookingPortlet/src/main/webapp/template.xhtml 2008-01-24
01:01:33 UTC (rev 5573)
@@ -26,6 +26,6 @@
</div>
</div>
<div id="footer">Created with JBoss Seam 2.0, JBoss EJB 3.0, JSF 1.2,
Hibernate 3 and Facelets</div>
- <!-- a:log hotkey="M" /-->
+ <a:log hotkey="M" rendered="#{!ajaxContext.ajaxRequest}" />
</div>
</f:view>
Added: trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF
===================================================================
--- trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF (rev
0)
+++ trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF 2008-01-24 01:01:33 UTC (rev
5573)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: trunk/ui/virtualEarth/src/main/java/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain