[richfaces-svn-commits] JBoss Rich Faces SVN: r2260 - in trunk: extensions/portlet/src/main/java/org/ajax4jsf/portlet/context and 3 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Tue Aug 14 18:17:21 EDT 2007
Author: alexsmirnov
Date: 2007-08-14 18:17:21 -0400 (Tue, 14 Aug 2007)
New Revision: 2260
Added:
trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
Modified:
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/FacesContextFactoryImpl.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/PortletContextImpl.java
trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ServletContextImpl.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
trunk/samples/ajaxPortlet/pom.xml
trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/faces-config.xml
Log:
Continue progress on the http://jira.jboss.com/jira/browse/RF-596 bug. Fix state saving.
Start progress to restore portal library.
Modified: trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
===================================================================
--- trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2007-08-14 19:32:25 UTC (rev 2259)
+++ trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2007-08-14 22:17:21 UTC (rev 2260)
@@ -231,7 +231,7 @@
Entry element = (Entry) i.next();
UIComponent facet = ((TreeStrutureNode) element.getValue())
.restore(loader);
- component.getFacets().put(element.getKey(), facet);
+ component.getFacets().put((String) element.getKey(), facet);
}
for (Iterator i = children.iterator(); i.hasNext();) {
TreeStrutureNode node = (TreeStrutureNode) i.next();
Modified: trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/FacesContextFactoryImpl.java
===================================================================
--- trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/FacesContextFactoryImpl.java 2007-08-14 19:32:25 UTC (rev 2259)
+++ trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/FacesContextFactoryImpl.java 2007-08-14 22:17:21 UTC (rev 2260)
@@ -65,6 +65,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
/**
*
* @author shura Implementation of <code>FacesContextFactory</code> for
@@ -87,6 +91,7 @@
*/
// private FacesContextFactory defaultFacesContextFactory;
+ private static final Log _log = LogFactory.getLog(FacesContextFactoryImpl.class);
/**
*
@@ -102,6 +107,9 @@
// if (this.defaultFacesContextFactory == null) {
// this.defaultFacesContextFactory = defaultFactory;
// }
+ if(_log.isDebugEnabled()){
+ _log.debug("Portal - specific FacesContextFactory has initialised");
+ }
}
/*
@@ -127,10 +135,16 @@
&& (request instanceof PortletRequest)
&& (response instanceof PortletResponse)) {
externalContext = new PortletContextImpl((PortletContext)context, (PortletRequest)request, (PortletResponse)response);
+ if(_log.isDebugEnabled()){
+ _log.debug("Portal request - create portal version of the ExternalContext");
+ }
} else if ((context instanceof ServletContext)
&& (request instanceof HttpServletRequest)
&& (response instanceof HttpServletResponse)) {
externalContext = new ServletContextImpl((ServletContext)context, (HttpServletRequest)request, (HttpServletResponse)response);
+ if(_log.isDebugEnabled()){
+ _log.debug("Servlet request - create HttpServlet version of the ExternalContext");
+ }
} else {
throw new FacesException(
"Unsupported environment. Only servlet or portlet is allowed");
Modified: trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/PortletContextImpl.java
===================================================================
--- trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/PortletContextImpl.java 2007-08-14 19:32:25 UTC (rev 2259)
+++ trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/PortletContextImpl.java 2007-08-14 22:17:21 UTC (rev 2260)
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.Principal;
@@ -41,7 +42,56 @@
PortletResponse response) {
super(context, request, response);
}
+
+ public void setResponseCharacterEncoding(String encoding) {
+ // Do nothing
+ }
+
+ public String getResponseCharacterEncoding() {
+ PortletResponse portletResponse = getPortletResponse();
+ if (portletResponse instanceof RenderResponse) {
+ RenderResponse renderResponse = (RenderResponse) portletResponse;
+ return renderResponse.getCharacterEncoding();
+ }else {
+ return null;
+ }
+ }
+
+
+ public String getResponseContentType() {
+ PortletResponse portletResponse = getPortletResponse();
+ if (portletResponse instanceof RenderResponse) {
+ RenderResponse renderResponse = (RenderResponse) portletResponse;
+ return renderResponse.getContentType();
+ }else {
+ return null;
+ }
+ }
+ public void setRequestCharacterEncoding(String encoding)
+ throws UnsupportedEncodingException {
+ PortletRequest portletRequest = getPortletRequest();
+ if (portletRequest instanceof ActionRequest) {
+ ActionRequest actionRequest = (ActionRequest) portletRequest;
+ actionRequest.setCharacterEncoding(encoding);
+ }
+ }
+
+ public String getRequestCharacterEncoding() {
+ PortletRequest portletRequest = getPortletRequest();
+ if (portletRequest instanceof ActionRequest) {
+ ActionRequest actionRequest = (ActionRequest) portletRequest;
+ return actionRequest.getCharacterEncoding();
+ } else {
+ return null;
+ }
+ }
+
+
+ public String getRequestContentType() {
+ return null;
+ }
+
private PortletContext getPortletContext() {
return (PortletContext) getContext();
}
Modified: trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ServletContextImpl.java
===================================================================
--- trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ServletContextImpl.java 2007-08-14 19:32:25 UTC (rev 2259)
+++ trunk/extensions/portlet/src/main/java/org/ajax4jsf/portlet/context/ServletContextImpl.java 2007-08-14 22:17:21 UTC (rev 2260)
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.Principal;
@@ -48,7 +49,35 @@
public ServletContextImpl(ServletContext context, HttpServletRequest request, HttpServletResponse response) {
super(context, request, response);
}
+
+ public void setResponseCharacterEncoding(String encoding) {
+
+ getHttpResponse().setCharacterEncoding(encoding);
+ }
+
+ public String getResponseCharacterEncoding() {
+ return getHttpResponse().getCharacterEncoding();
+ }
+
+
+ public String getResponseContentType() {
+ return getHttpResponse().getContentType();
+ }
+ public void setRequestCharacterEncoding(String encoding)
+ throws UnsupportedEncodingException {
+ getHttpRequest().setCharacterEncoding(encoding);
+ }
+
+ public String getRequestCharacterEncoding() {
+ return getHttpRequest().getCharacterEncoding();
+ }
+
+
+ public String getRequestContentType() {
+ return getHttpRequest().getContentType();
+ }
+
private HttpServletRequest getHttpRequest() {
return (HttpServletRequest) getRequest();
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2007-08-14 19:32:25 UTC (rev 2259)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2007-08-14 22:17:21 UTC (rev 2260)
@@ -974,7 +974,7 @@
public void processUpdates(FacesContext faces) {
processUpdates(faces, null);
- resetComponent(faces);
+// resetComponent(faces);
}
protected void processValidators(FacesContext faces, Object argument) {
@@ -989,9 +989,9 @@
public void encodeBegin(FacesContext context) throws IOException {
resetDataModel();
- // if(!keepSaved(context)){
- // childState.remove(getBaseClientId(context));
- // }
+ if(!keepSaved(context)){
+ childState.remove(getBaseClientId(context));
+ }
// Mark component as used, if parent UIData change own range states not
// accessed at
// encode phase must be unsaved.
@@ -1287,6 +1287,8 @@
this._statesMap.put(key, compState);
this._modelsMap.put(key, idState.model);
}
+ this._currentState = (DataComponentState) _statesMap.get(getBaseClientId(faces));
+ this._currentModel = (ExtendedDataModel) _modelsMap.get(getBaseClientId(faces));
}
public Object saveState(FacesContext faces) {
@@ -1299,6 +1301,8 @@
Set encodedIds = getEncodedIds();
// Save all states of component and data model for all valies of
// clientId, encoded in this request.
+ this._statesMap.put(getBaseClientId(faces), this._currentState);
+ this._modelsMap.put(getBaseClientId(faces), this._currentModel);
for (Iterator iter = this._statesMap.entrySet().iterator(); iter
.hasNext();) {
Map.Entry stateEntry = (Map.Entry) iter.next();
Modified: trunk/samples/ajaxPortlet/pom.xml
===================================================================
--- trunk/samples/ajaxPortlet/pom.xml 2007-08-14 19:32:25 UTC (rev 2259)
+++ trunk/samples/ajaxPortlet/pom.xml 2007-08-14 22:17:21 UTC (rev 2260)
@@ -39,6 +39,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
Added: trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
--- trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia (rev 0)
+++ trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2007-08-14 22:17:21 UTC (rev 2260)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS ENTITY="JSFProcess">
+ <PROCESS-ITEM ENTITY="JSFProcessGroup" NAME="rules:#jsf#start.xhtml"
+ PATH="/jsf/start.xhtml" SHAPE="32,17,0,0">
+ <PROCESS-ITEM ENTITY="JSFProcessItem" ID="rules:#jsf#start.xhtml:0"
+ NAME="item" PATH="/jsf/start.xhtml">
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="repeater::#jsf#repeater.xhtml" NAME="output"
+ PATH="/jsf/repeater.xhtml" TARGET="rules:#jsf#repeater.xhtml" TITLE="repeater"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM ENTITY="JSFProcessGroup" NAME="rules:#jsf#repeater.xhtml"
+ PATH="/jsf/repeater.xhtml" SHAPE="240,33,0,0">
+ <PROCESS-ITEM ENTITY="JSFProcessItem" ID="rules:#jsf#repeater.xhtml:0"
+ NAME="item" PATH="/jsf/repeater.xhtml">
+ <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
+ ID="start::#jsf#start.xhtml" NAME="output" PATH="/jsf/start.xhtml"
+ TARGET="rules:#jsf#start.xhtml" TITLE="start"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+</PROCESS>
Modified: trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/faces-config.xml 2007-08-14 19:32:25 UTC (rev 2259)
+++ trunk/samples/ajaxPortlet/src/main/webapp/WEB-INF/faces-config.xml 2007-08-14 22:17:21 UTC (rev 2260)
@@ -2,38 +2,58 @@
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
- <managed-bean>
- <managed-bean-name>bean</managed-bean-name>
- <managed-bean-class>portal.Bean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- </managed-bean>
- <navigation-rule>
- <from-view-id>/jsf/start.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>repeater</from-outcome>
- <to-view-id>/jsf/repeater.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/repeater.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>start</from-outcome>
- <to-view-id>/jsf/start.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <render-kit>
- <renderer>
- <description>override the viewroot</description>
- <component-family>javax.faces.ViewRoot</component-family>
- <renderer-type>javax.faces.ViewRoot</renderer-type>
- <renderer-class>org.ajax4jsf.portlet.renderkit.portlet.PortletAjaxViewRootRenderer</renderer-class>
- </renderer>
- </render-kit>
- <application>
- <view-handler>org.ajax4jsf.portlet.application.PortletViewHandler</view-handler>
- <state-manager>org.ajax4jsf.portlet.application.PortalStateManager</state-manager>
- <!--
- <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
- -->
- </application>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>portal.Bean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <navigation-rule>
+ <from-view-id>/jsf/start.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>repeater</from-outcome>
+ <to-view-id>/jsf/repeater.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/repeater.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>start</from-outcome>
+ <to-view-id>/jsf/start.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <render-kit>
+ <renderer>
+ <description>override the viewroot</description>
+ <component-family>javax.faces.ViewRoot</component-family>
+ <renderer-type>javax.faces.ViewRoot</renderer-type>
+ <renderer-class>
+ org.ajax4jsf.portlet.renderkit.portlet.PortletAjaxViewRootRenderer
+ </renderer-class>
+ </renderer>
+ </render-kit>
+ <application>
+ <view-handler>
+ org.ajax4jsf.portlet.application.PortletViewHandler
+ </view-handler>
+ <state-manager>
+ org.ajax4jsf.portlet.application.PortalStateManager
+ </state-manager>
+ <!--
+ <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
+ -->
+ </application>
+ <factory>
+ <faces-context-factory>
+ org.ajax4jsf.portlet.context.FacesContextFactoryImpl
+ </faces-context-factory>
+ </factory>
+
+ <managed-bean>
+ <managed-bean-name>ajaxContext</managed-bean-name>
+ <managed-bean-class>
+ org.ajax4jsf.portlet.PortletAjaxContext
+ </managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
</faces-config>
More information about the richfaces-svn-commits
mailing list