JBoss Rich Faces SVN: r14754 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/modules.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2009-06-30 11:42:23 -0400 (Tue, 30 Jun 2009)
New Revision: 14754
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
Log:
Corrected a mistake
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2009-06-30 12:31:00 UTC (rev 14753)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/modules/RFCarchitectover.xml 2009-06-30 15:42:23 UTC (rev 14754)
@@ -544,12 +544,12 @@
<programlisting role="XML"><![CDATA[...
<a4j:queue name="sampleQueue"/>
<h:inputText value="#{bean.inputValue}" >
- <a4j:support id="inputSupport" event="onkeyup" eventsQueue="sample"/>
+ <a4j:support id="inputSupport" event="onkeyup" eventsQueue="sampleQueue"/>
</h:inputText>
-<rich:comboBox value="#{bean.state}" suggestionValues="#{bean.suggestions}" eventsQueue="sample" />
+<rich:comboBox value="#{bean.state}" suggestionValues="#{bean.suggestions}" eventsQueue="sampleQueue" />
...]]></programlisting>
<para>In this example, two components(<a4j:queue>,
- <rich:comboBox>,) reference the named queue via the
+ <rich:comboBox>,) reference the named ( "sampleQueue") queue via the
"eventsQueue" attribute. </para>
</section>
<section>
15 years, 3 months
JBoss Rich Faces SVN: r14753 - branches/community/3.3.X/samples/panelmenu-sample/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-06-30 08:31:00 -0400 (Tue, 30 Jun 2009)
New Revision: 14753
Added:
branches/community/3.3.X/samples/panelmenu-sample/src/main/webapp/pages/RF-7390.jsp
Log:
https://jira.jboss.org/jira/browse/RF-7390
panelMenu: There are some problems with icons
Added: branches/community/3.3.X/samples/panelmenu-sample/src/main/webapp/pages/RF-7390.jsp
===================================================================
--- branches/community/3.3.X/samples/panelmenu-sample/src/main/webapp/pages/RF-7390.jsp (rev 0)
+++ branches/community/3.3.X/samples/panelmenu-sample/src/main/webapp/pages/RF-7390.jsp 2009-06-30 12:31:00 UTC (rev 14753)
@@ -0,0 +1,28 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/panelmenu" prefix="pm"%>
+
+<html>
+<body>
+<f:view>
+ <h:form id="f">
+ <pm:panelMenu>
+ <pm:panelMenuItem label="CheckBox">
+ <h:selectBooleanCheckbox value="false"></h:selectBooleanCheckbox>
+ </pm:panelMenuItem>
+ <pm:panelMenuItem>
+ <h:outputText value="CheckBox 2"></h:outputText>
+ <h:selectBooleanCheckbox value="false"></h:selectBooleanCheckbox>
+ </pm:panelMenuItem>
+ <pm:panelMenuItem label="Action" onmousedown="alert('OnMouseDown');" />
+ <pm:panelMenuGroup label="Group 1(expanded=true)" expanded="true" id="pmg">
+ <pm:panelMenuItem label="Item 1" disabled="true" />
+ <pm:panelMenuItem label="Item 1 (action)" onmousedown="alert('OnMouseDown');" />
+ <pm:panelMenuItem label="Item 2" />
+ </pm:panelMenuGroup>
+ </pm:panelMenu>
+ </h:form>
+</f:view>
+</body>
+</html>
15 years, 3 months
JBoss Rich Faces SVN: r14752 - in branches/jsf2.0/framework: impl/src/main/java/org/ajax4jsf/cache and 10 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-30 08:30:09 -0400 (Tue, 30 Jun 2009)
New Revision: 14752
Added:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/AbstractCacheFactory.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodec.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodecAware.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/BaseResource.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceHandlerImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceWrapper.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource2.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/RequestStateManager.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/Util.java
branches/jsf2.0/framework/impl/src/main/resources/META-INF/resource-handler.faces-config.xml
Modified:
branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/LRUMapCache.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/ServletContextInitMap.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/config/WebXMLParser.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CachedResourceContext.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/FacesResourceContext.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/UIRangedNumberInput.java
branches/jsf2.0/framework/impl/src/main/resources/META-INF/faces-config.xml
branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/a-faces-config.xml
branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/b-faces-config.xml
branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/faces-config.xml
branches/jsf2.0/framework/jsf-test/
Log:
Resources: first draft check-in
Modified: branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java
===================================================================
--- branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/api/src/main/java/org/ajax4jsf/resource/ResourceContext.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -24,7 +24,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.PrintWriter;
+import java.io.Writer;
/**
* Abstraction context class for rendering resource ( image, script, style )
@@ -68,16 +68,19 @@
/**
* @return
*/
+ @Deprecated
public abstract String getQueryString();
/**
* @return
*/
+ @Deprecated
public abstract String getPathInfo();
/**
* @return
*/
+ @Deprecated
public abstract String getServletPath();
/**
@@ -114,7 +117,8 @@
* get output writer for send response.
* @return
*/
- public abstract PrintWriter getWriter() throws IOException;
+ //TODO method signature changed
+ public abstract Writer getWriter() throws IOException;
/**
* Setup response content type as {@see javax.servlet.ServletResponse#setContentType(java.lang.String)}
Added: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/AbstractCacheFactory.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/AbstractCacheFactory.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/AbstractCacheFactory.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,30 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.cache;
+
+/**
+ * @author Nick Bealevski
+ * @since 4.0
+ */
+public abstract class AbstractCacheFactory implements CacheFactory {
+
+}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/LRUMapCache.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/LRUMapCache.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/LRUMapCache.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -61,7 +61,8 @@
private Map<Object, LRUMapFuture> futures = new HashMap<Object, LRUMapFuture>();
- public synchronized Object get(Object key, Object context) throws CacheException {
+ //TODO review
+ public Object get(Object key, Object context) throws CacheException {
try {
LRUMapFuture activeFuture = null;
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/ServletContextInitMap.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/ServletContextInitMap.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/cache/ServletContextInitMap.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -35,6 +35,7 @@
* created 02.05.2007
*
*/
+@Deprecated
public class ServletContextInitMap extends AbstractMap<String, String> {
private ServletContext servletContext;
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/config/WebXMLParser.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/config/WebXMLParser.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/config/WebXMLParser.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -22,6 +22,7 @@
* @author asmirnov
*
*/
+@Deprecated
public class WebXMLParser {
public static final String WEB_XML = "/WEB-INF/web.xml";
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CachedResourceContext.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CachedResourceContext.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/CachedResourceContext.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -114,7 +114,7 @@
/**
* @return Returns the content.
*/
- CacheContent getContent() {
+ public CacheContent getContent() {
return this.content;
}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/FacesResourceContext.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/FacesResourceContext.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/FacesResourceContext.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -24,16 +24,12 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.lang.reflect.Method;
+import java.io.Writer;
-import javax.faces.FacesException;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.ajax4jsf.resource.ResourceContext;
+import org.richfaces.util.Util;
/**
* @author asmirnov(a)exadel.com (latest modification by $Author: nick_belaevski $)
@@ -42,187 +38,137 @@
*/
public class FacesResourceContext extends ResourceContext {
- FacesContext facesContext;
+ private FacesContext facesContext;
- ExternalContext externalContext;
+ private ExternalContext externalContext;
- HttpServletResponse response;
+ /**
+ * @param facesContext
+ */
+ public FacesResourceContext(FacesContext facesContext) {
- /**
- * @param facesContext
- */
- public FacesResourceContext(FacesContext facesContext) {
+ this.facesContext = facesContext;
+ this.externalContext = facesContext.getExternalContext();
+ }
- this.facesContext = facesContext;
- this.externalContext = facesContext.getExternalContext();
- Object facesResponse = externalContext.getResponse();
- if (facesResponse instanceof HttpServletResponse) {
- this.response = (HttpServletResponse) facesResponse;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceContext#setHeader(java.lang.String,
+ * java.lang.String)
+ */
+ public void setHeader(String name, String value) {
+ externalContext.setResponseHeader(name, value);
}
- }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceContext#setHeader(java.lang.String,
- * java.lang.String)
- */
- public void setHeader(String name, String value) {
- if (null != response) {
- response.setHeader(name, value);
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceContext#setIntHeader(java.lang.String,
+ * int)
+ */
+ public void setIntHeader(String name, int value) {
+ externalContext.setResponseHeader(name, String.valueOf(value));
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceContext#setDateHeader(java.lang.String,
+ * long)
+ */
+ public void setDateHeader(String name, long value) {
+ externalContext.setResponseHeader(name, Util.formatHttpDate(value));
}
- }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceContext#setIntHeader(java.lang.String,
- * int)
- */
- public void setIntHeader(String name, int value) {
- if (null != response) {
- response.setIntHeader(name, value);
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceContext#getOutputStream()
+ */
+ public OutputStream getOutputStream() throws IOException {
+ return externalContext.getResponseOutputStream();
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceContext#getWriter()
+ */
+ public Writer getWriter() throws IOException {
+ return externalContext.getResponseOutputWriter();
}
- }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceContext#setDateHeader(java.lang.String,
- * long)
- */
- public void setDateHeader(String name, long value) {
- if (null != response) {
- response.setDateHeader(name, value);
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceContext#getQueryString()
+ */
+ public String getQueryString() {
+ throw new UnsupportedOperationException();
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceContext#getPathInfo()
+ */
+ public String getPathInfo() {
+ return externalContext.getRequestPathInfo();
}
- }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceContext#getOutputStream()
- */
- public OutputStream getOutputStream() throws IOException {
- if (null != response) {
- return response.getOutputStream();
-
- } else {
- // May be non-servlet (Portlet?) environment. Try to use reflection
- OutputStream stream = null;
- Object response = externalContext.getResponse();
- try {
- Method gW = response.getClass()
- .getMethod("getOutputStream", new Class[0]);
- stream = (OutputStream) gW.invoke(response, new Object[0]);
- } catch (Exception e) {
- throw new FacesException(e);
- }
- return stream;
-
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.resource.ResourceContext#getSessionAttribute(java.lang.String)
+ */
+ public Object getSessionAttribute(String name) {
+ return externalContext.getSessionMap().get(name);
}
- }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceContext#getWriter()
- */
- public PrintWriter getWriter() throws IOException {
- if (null != response) {
- return response.getWriter();
+ public InputStream getResourceAsStream(String path) {
- } else {
- // May be non-servlet (Portlet?) environment. Try to use reflection
- PrintWriter writer = null;
- Object response = externalContext.getResponse();
- try {
- Method gW = response.getClass()
- .getMethod("getWriter", new Class[0]);
- writer = (PrintWriter) gW.invoke(response, new Object[0]);
- } catch (Exception e) {
- throw new FacesException(e);
- }
- return writer;
-
+ return externalContext.getResourceAsStream(path);
}
- }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceContext#getQueryString()
- */
- public String getQueryString() {
- return ((HttpServletRequest) externalContext.getRequest())
- .getQueryString();
- }
+ public String getRequestParameter(String data_parameter) {
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceContext#getPathInfo()
- */
- public String getPathInfo() {
- return externalContext.getRequestPathInfo();
- }
+ return (String) externalContext.getRequestParameterMap().get(
+ data_parameter);
+ }
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.resource.ResourceContext#getSessionAttribute(java.lang.String)
- */
- public Object getSessionAttribute(String name) {
- return externalContext.getSessionMap().get(name);
- }
+ public void setContentType(String contentType) {
+ externalContext.setResponseContentType(contentType);
+ }
- public InputStream getResourceAsStream(String path) {
- return externalContext.getResourceAsStream(path);
- }
+ public void setContentLength(int contentLength) {
+ externalContext.setResponseContentLength(contentLength);
+ }
- public String getRequestParameter(String data_parameter) {
+ public String getInitParameter(String name) {
+ // TODO Auto-generated method stub
+ return externalContext.getInitParameter(name);
+ }
- return (String) externalContext.getRequestParameterMap().get(
- data_parameter);
- }
+ public String getServletPath() {
+ // TODO Auto-generated method stub
+ return externalContext.getRequestServletPath();
+ }
- public void setContentType(String contentType) {
- response.setContentType(contentType);
+ public void release() {
+ super.release();
+ externalContext = null;
+ facesContext = null;
+ }
- }
-
+ // added by nick 11.01.2007 - getters for contexts added
+ public FacesContext getFacesContext() {
+ return facesContext;
+ }
- public void setContentLength(int contentLength) {
- response.setContentLength(contentLength);
- }
-
- public String getInitParameter(String name) {
- // TODO Auto-generated method stub
- return externalContext.getInitParameter(name);
- }
-
- public String getServletPath() {
- // TODO Auto-generated method stub
- return externalContext.getRequestServletPath();
- }
-
- public void release() {
- super.release();
- externalContext = null;
- response = null;
- facesContext.release();
- }
-
- // added by nick 11.01.2007 - getters for contexts added
- public FacesContext getFacesContext() {
- return facesContext;
- }
-
- public ExternalContext getExternalContext() {
- return externalContext;
- }
- // by nick
+ public ExternalContext getExternalContext() {
+ return externalContext;
+ }
+ // by nick
}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/InternetResourceBase.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -32,6 +32,7 @@
import org.ajax4jsf.Messages;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.richfaces.util.Util;
/**
* Base class for all Html page resources - images, scripts, styles etc. Realise
@@ -400,7 +401,8 @@
context.setContentType(getContentType(context));
Date lastModified = getLastModified(context);
if (lastModified != null) {
- context.setDateHeader("Last-Modified", lastModified.getTime());
+ context.setHeader("Last-Modified", Util.formatHttpDate(lastModified.getTime()));
+ //context.setDateHeader("Last-Modified", lastModified.getTime());
}
int contentLength = getContentLength(context);
if (cached) {
@@ -411,17 +413,18 @@
if (expired < 0 ) {
expired = DEFAULT_EXPIRE;
}
- context.setDateHeader("Expires", System.currentTimeMillis()
- + expired);
- context.setHeader("Cache-control", "max-age="
- + (expired / 1000L));
+ context.setHeader("Expires", Util.formatHttpDate(System.currentTimeMillis()
+ + expired));
+// context.setDateHeader("Expires", System.currentTimeMillis()
+// + expired);
+ context.setHeader("Cache-Control", "max-age=" + (expired / 1000L));
} else {
if (contentLength > 0) {
context.setContentLength(contentLength);
// } else {
// context.setHeader("Transfer-Encoding", "chunked");
}
- context.setHeader("Cache-control", "max-age=0, no-store, no-cache");
+ context.setHeader("Cache-Control", "max-age=0, no-store, no-cache");
context.setHeader("Pragma", "no-cache");
context.setIntHeader("Expires", 0);
}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -21,25 +21,15 @@
package org.ajax4jsf.resource;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.StreamCorruptedException;
import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.zip.Deflater;
-import java.util.zip.Inflater;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
@@ -48,11 +38,12 @@
import org.ajax4jsf.Messages;
import org.ajax4jsf.resource.util.URLToStreamHelper;
-import org.ajax4jsf.util.base64.Codec;
import org.ajax4jsf.webapp.WebXml;
import org.apache.commons.digester.Digester;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.richfaces.resource.LegacyResourceHandlerImpl;
+import org.richfaces.util.Util;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -70,12 +61,6 @@
private static final Log log = LogFactory.getLog(ResourceBuilderImpl.class);
- private static final String DATA_SEPARATOR = "/DATA/";
- private static final String DATA_BYTES_SEPARATOR = "/DATB/";
-
- private static final Pattern DATA_SEPARATOR_PATTERN = Pattern
- .compile("/DAT(A|B)/");
-
private static Map<String, ResourceRenderer> renderers;
private static ResourceRenderer defaultRenderer = new MimeRenderer(null);
@@ -88,8 +73,6 @@
private long _startTime;
- private Codec codec;
-
private static final ResourceRenderer scriptRenderer = new ScriptRenderer();
private static final ResourceRenderer styleRenderer = new StyleRenderer();
@@ -128,7 +111,6 @@
public ResourceBuilderImpl() {
super();
_startTime = System.currentTimeMillis();
- codec = new Codec();
}
/**
@@ -274,55 +256,8 @@
public String getUri(InternetResource resource, FacesContext context,
Object storeData) {
- StringBuffer uri = new StringBuffer();// ResourceServlet.DEFAULT_SERVLET_PATH).append("/");
- uri.append(resource.getKey());
- // append serialized data as Base-64 encoded request string.
- if (storeData != null) {
- try {
- byte[] objectData;
- if (storeData instanceof byte[]) {
- objectData = (byte[]) storeData;
- uri.append(DATA_BYTES_SEPARATOR);
- } else {
- ByteArrayOutputStream dataSteram = new ByteArrayOutputStream(
- 1024);
- ObjectOutputStream objStream = new ObjectOutputStream(
- dataSteram);
- objStream.writeObject(storeData);
- objStream.flush();
- objStream.close();
- dataSteram.close();
- objectData = dataSteram.toByteArray();
- uri.append(DATA_SEPARATOR);
- }
- byte[] dataArray = encrypt(objectData);
- uri.append(new String(dataArray, "ISO-8859-1"));
- // / byte[] objectData = dataSteram.toByteArray();
- // / uri.append("?").append(new
- // String(Base64.encodeBase64(objectData),
- // / "ISO-8859-1"));
- } catch (Exception e) {
- // Ignore errors, log it
- log.error(Messages
- .getMessage(Messages.QUERY_STRING_BUILDING_ERROR), e);
- }
- }
-
- boolean isGlobal = !resource.isSessionAware();
-
- String resourceURL = getWebXml(context).getFacesResourceURL(context,
- uri.toString(), isGlobal);// context.getApplication().getViewHandler().getResourceURL(context,uri.toString());
- if (!isGlobal) {
- resourceURL = context.getExternalContext().encodeResourceURL(
- resourceURL);
- }
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(Messages.BUILD_RESOURCE_URI_INFO,
- resource.getKey(), resourceURL));
- }
- return resourceURL;// context.getExternalContext().encodeResourceURL(resourceURL);
-
+ return Util.encodeResourceData(resource.getKey(), storeData);
}
/**
@@ -332,60 +267,11 @@
public InternetResource getResourceForKey(String key)
throws ResourceNotFoundException {
- Matcher matcher = DATA_SEPARATOR_PATTERN.matcher(key);
- if (matcher.find()) {
- int data = matcher.start();
- key = key.substring(0, data);
- }
-
- return getResource(key);
+ return getResource(Util.getResourceName(key));
}
public Object getResourceDataForKey(String key) {
- Object data = null;
- String dataString = null;
- Matcher matcher = DATA_SEPARATOR_PATTERN.matcher(key);
- if (matcher.find()) {
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(
- Messages.RESTORE_DATA_FROM_RESOURCE_URI_INFO, key,
- dataString));
- }
- int dataStart = matcher.end();
- dataString = key.substring(dataStart);
- byte[] objectArray = null;
- byte[] dataArray;
- try {
- dataArray = dataString.getBytes("ISO-8859-1");
- objectArray = decrypt(dataArray);
- } catch (UnsupportedEncodingException e1) {
- // default encoding always presented.
- }
- if ("B".equals(matcher.group(1))) {
- data = objectArray;
- } else {
- try {
- ObjectInputStream in = new ObjectInputStream(
- new ByteArrayInputStream(objectArray));
- data = in.readObject();
- } catch (StreamCorruptedException e) {
- log.error(Messages
- .getMessage(Messages.STREAM_CORRUPTED_ERROR), e);
- } catch (IOException e) {
- log.error(Messages
- .getMessage(Messages.DESERIALIZE_DATA_INPUT_ERROR),
- e);
- } catch (ClassNotFoundException e) {
- log
- .error(
- Messages
- .getMessage(Messages.DATA_CLASS_NOT_FOUND_ERROR),
- e);
- }
- }
- }
-
- return data;
+ return Util.getResourceData(key);
}
public InternetResource getResource(String path)
@@ -419,8 +305,9 @@
// return getWebXml(context).getFacesResourceKey(request);
// }
- public String getFacesResourceURL(FacesContext context, String Url, boolean isGlobal) {
- return getWebXml(context).getFacesResourceURL(context, Url, isGlobal);
+ public String getFacesResourceURL(FacesContext context, String url, boolean isGlobal) {
+ return Util.encodeResourceURL(context, LegacyResourceHandlerImpl.LEGACY_RESOURCE_IDENTIFIER + url);
+ //return getWebXml(context).getFacesResourceURL(context, Url, isGlobal);
}
/**
@@ -579,38 +466,6 @@
return _startTime;
}
- protected byte[] encrypt(byte[] src) {
- try {
- Deflater compressor = new Deflater(Deflater.BEST_SPEED);
- byte[] compressed = new byte[src.length + 100];
- compressor.setInput(src);
- compressor.finish();
- int totalOut = compressor.deflate(compressed);
- byte[] zipsrc = new byte[totalOut];
- System.arraycopy(compressed, 0, zipsrc, 0, totalOut);
- compressor.end();
- return codec.encode(zipsrc);
- } catch (Exception e) {
- throw new FacesException("Error encode resource data", e);
- }
- }
-
- protected byte[] decrypt(byte[] src) {
- try {
- byte[] zipsrc = codec.decode(src);
- Inflater decompressor = new Inflater();
- byte[] uncompressed = new byte[zipsrc.length * 5];
- decompressor.setInput(zipsrc);
- int totalOut = decompressor.inflate(uncompressed);
- byte[] out = new byte[totalOut];
- System.arraycopy(uncompressed, 0, out, 0, totalOut);
- decompressor.end();
- return out;
- } catch (Exception e) {
- throw new FacesException("Error decode resource data", e);
- }
- }
-
@Override
public ResourceRenderer getScriptRenderer() {
return scriptRenderer;
Added: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodec.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodec.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodec.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package org.ajax4jsf.resource;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public interface ResourceCodec {
+
+ public String encodeResource(String resourceName, Object resourceData);
+
+ public String decodeResourceName(String resourceKey);
+
+ public Object decodeResourceData(String resourceKey);
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodecAware.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodecAware.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceCodecAware.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,14 @@
+/**
+ *
+ */
+package org.ajax4jsf.resource;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public interface ResourceCodecAware {
+
+ public void setResourceCodec(ResourceCodec codec);
+
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceImpl.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceImpl.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceImpl.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,326 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.faces.FacesException;
+import javax.faces.application.Resource;
+import javax.faces.component.StateHolder;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.resource.ResourceHandlerImpl;
+import org.richfaces.util.Util;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public abstract class ResourceImpl extends Resource implements ResourceCodecAware {
+
+ public static final String URL_PROTOCOL = "jsfResource";
+
+ private boolean cacheable = true;
+
+ private Date lastModified = null;
+
+ private boolean useLocalLastModified = false;
+
+ private ResourceCodec resourceCodec;
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the contentLength.
+ */
+ protected int getContentLength(FacesContext context) {
+ return -1;
+ }
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the expired.
+ */
+ protected long getExpired(FacesContext context) {
+ return 0;
+ }
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the lastModified.
+ */
+ protected Date getLastModified(FacesContext context) {
+ if (lastModified == null && !useLocalLastModified) {
+ useLocalLastModified = true;
+
+ Class<? extends ResourceImpl> thisClass = getClass();
+ ClassLoader classLoader = thisClass.getClassLoader();
+ if (classLoader == null) {
+ classLoader = ClassLoader.getSystemClassLoader();
+ }
+
+ if (classLoader != null) {
+ URL classResource = classLoader.getResource(thisClass.getName().replace('.', '/') + ".class");
+ URLConnection connection;
+ try {
+ connection = classResource.openConnection();
+ long classLastModifiedDate = connection.getLastModified();
+ if (classLastModifiedDate > 0) {
+ lastModified = new Date(classLastModifiedDate);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ return lastModified;
+ }
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the cacheable.
+ */
+ public boolean isCacheable(FacesContext context) {
+ return cacheable;
+ }
+
+ /**
+ * @param resourceContext current {@link ResourceContext}
+ * @return Returns the mimeType.
+ */
+ public abstract String getContentType(FacesContext context);
+
+ public String getEntityTag(FacesContext context) {
+ int contentLength = getContentLength(context);
+ Date lastModified = getLastModified(context);
+
+ if (contentLength != -1 && lastModified != null) {
+ return contentLength + "-" + lastModified.getTime();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public abstract InputStream getInputStream();
+
+ public String getVersion() {
+ return null;
+ }
+
+ @Override
+ public String getRequestPath() {
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ Object resourceData = null;
+ if (this instanceof StateHolder) {
+ StateHolder stateHolder = (StateHolder) this;
+ if (!stateHolder.isTransient()) {
+ resourceData = stateHolder.saveState(context);
+ }
+ }
+
+ String resourceUri = ResourceHandlerImpl.RICHFACES_RESOURCE_IDENTIFIER +
+ resourceCodec.encodeResource(getResourceName(), resourceData);
+
+ String url = Util.encodeResourceURL(context, resourceUri);
+
+ String version = getVersion();
+ if (version != null && version.length() > 0) {
+ url += "?v=" + version;
+ }
+
+ return url;
+ }
+
+ private boolean isResourceRequest() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return (facesContext.getApplication().getResourceHandler().isResourceRequest(facesContext));
+ }
+
+ @Override
+ public Map<String, String> getResponseHeaders() {
+ Map<String, String> headers = new HashMap<String, String>();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ if (isResourceRequest()) {
+ int contentLength = getContentLength(facesContext);
+ if (contentLength != -1) {
+ headers.put("Content-Length", String.valueOf(contentLength));
+ }
+
+ String contentType = getContentType();
+ if (contentType != null) {
+ //TODO add content-encoding?
+ headers.put("Content-Type", contentType);
+ }
+
+ Date lastModified = getLastModified(facesContext);
+ if (lastModified != null) {
+ headers.put("Last-Modified", Util.formatHttpDate(lastModified));
+ }
+
+ boolean cacheable = isCacheable(facesContext);
+
+ if (cacheable) {
+ long expires = getExpired(facesContext);
+ if (expires <= 0) {
+ expires = InternetResource.DEFAULT_EXPIRE;
+ }
+
+ String entityTag = getEntityTag(facesContext);
+ if (entityTag != null) {
+ headers.put("ETag", "W/\"" + entityTag + "\"");
+ }
+
+ headers.put("Expires", Util.formatHttpDate(expires + System.currentTimeMillis()));
+ headers.put("Cache-Control", "max-age=" + expires / 1000L);
+ } else {
+ headers.put("Expires", "0");
+ headers.put("Cache-Control", "max-age=0, no-store, no-cache");
+ headers.put("Pragma", "no-cache");
+ }
+ }
+
+ return headers;
+ }
+
+ @Override
+ public URL getURL() {
+ // TODO Auto-generated method stub
+ try {
+ return new URL(URL_PROTOCOL, null, -1, getResourceName(), new URLStreamHandler() {
+
+ @Override
+ protected URLConnection openConnection(URL u) throws IOException {
+ final FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ return new URLConnection(u) {
+
+ @Override
+ public void connect() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getContentLength() {
+ return ResourceImpl.this.getContentLength(facesContext);
+ }
+
+ @Override
+ public String getContentType() {
+ return ResourceImpl.this.getContentType(facesContext);
+ }
+
+ @Override
+ public long getExpiration() {
+ return ResourceImpl.this.getExpired(facesContext);
+ }
+
+ @Override
+ public long getLastModified() {
+ Date date = ResourceImpl.this.getLastModified(facesContext);
+ if (date != null) {
+ return date.getTime();
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException {
+ return ResourceImpl.this.getInputStream();
+ }
+ };
+ }
+ });
+ } catch (MalformedURLException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
+ }
+ }
+
+ private static final Pattern ETAG_PATTERN = Pattern.compile("(?:W/)?\"([^\"]+)\"(?:,\\s*)?");
+
+ private boolean userCopyIsStale(FacesContext context) {
+ Date serverLastModified = getLastModified(context);
+ if (serverLastModified == null) {
+ return true;
+ }
+
+ String headerValue = context.getExternalContext().getRequestHeaderMap().get("If-Modified-Since");
+ Date clientLastModified = Util.parseHttpDate(headerValue);
+ if (clientLastModified == null) {
+ return true;
+ }
+
+ // 1000 ms due to round
+ // modification
+ // time to seconds.
+ long serverLastModifiedTime = serverLastModified.getTime() - 1000;
+
+ return serverLastModifiedTime > clientLastModified.getTime();
+ }
+
+ @Override
+ public boolean userAgentNeedsUpdate(FacesContext context) {
+ if (!isCacheable(context)) {
+ return true;
+ }
+
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, String> requestHeaderMap = externalContext.getRequestHeaderMap();
+
+ String ifNoneMatch = requestHeaderMap.get("If-None-Match");
+ if (ifNoneMatch != null) {
+ Matcher eTagMatcher = ETAG_PATTERN.matcher(ifNoneMatch);
+ while (eTagMatcher.find()) {
+ String eTag = eTagMatcher.group(1);
+
+ if (eTag.equals(getEntityTag(context))) {
+ return userCopyIsStale(context);
+ }
+ }
+
+ return true;
+ }
+
+ return userCopyIsStale(context);
+ }
+
+ public void setResourceCodec(ResourceCodec codec) {
+ this.resourceCodec = codec;
+ }
+}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/CacheContent.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -31,6 +31,7 @@
import java.util.Map;
import java.util.Map.Entry;
+import javax.faces.context.ExternalContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@@ -38,6 +39,7 @@
import org.ajax4jsf.io.FastBufferWriter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.richfaces.util.Util;
/**
* @author shura (latest modification by $Author: alexsmirnov $)
@@ -76,15 +78,20 @@
private Integer contentLength;
+ @Deprecated
+ public void send(HttpServletResponse response) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
/**
* Send saved content to http responce
*
* @param response
* @throws IOException
*/
- public void send(HttpServletResponse response) throws IOException {
+ public void send(ExternalContext externalContext) throws IOException {
if (filledOutputStream) {
- OutputStream out = response.getOutputStream();
+ OutputStream out = externalContext.getResponseOutputStream();
if (content != null) {
out.write(content);
} else {
@@ -93,7 +100,7 @@
// out.flush();
// out.close();
} else if (filledOutputWriter) {
- Writer out = response.getWriter();
+ Writer out = externalContext.getResponseOutputWriter();
if (null != writerContent) {
out.write(writerContent);
} else {
@@ -103,13 +110,13 @@
// out.close();
}
}
-
- /**
+
+ /**
* Send saved headers to http responce.
*
* @param response
*/
- public void sendHeaders(HttpServletResponse response) {
+ public void sendHeaders(ExternalContext externalContext) {
// set real content-length.
// / if (null != content) {
int realContentLength = 0;
@@ -133,7 +140,8 @@
try {
if (headerValue instanceof Long) {
Long time = (Long) headerValue;
- response.setDateHeader(header, time.longValue());
+ String formattedDate = Util.formatHttpDate(time);
+ externalContext.setResponseHeader(header, formattedDate);
} else if (headerValue instanceof Integer) {
Integer value = (Integer) headerValue;
// Check real content length.
@@ -144,14 +152,14 @@
//do nothing
}
} else {
- response.setIntHeader(header, value.intValue());
+ externalContext.setResponseHeader(header, value.toString());
}
} else {
// Don't send "chunked" transfer-encoding type with real content-length
if (!(realContentLength > 0
&& "Transfer-Encoding".equals(header) && "chunked"
.equals(headerValue))) {
- response.setHeader(header, (String) headerValue);
+ externalContext.setResponseHeader(header, (String) headerValue);
}
}
@@ -160,14 +168,19 @@
+ headerValue, e);
}
if(realContentLength > 0){
- response.setContentLength(realContentLength);
+ externalContext.setResponseContentLength(realContentLength);
}
if (null != contentType) {
- response.setContentType(this.contentType);
+ externalContext.setResponseContentType(this.contentType);
}
}
}
+ @Deprecated
+ public void sendHeaders(HttpServletResponse response) {
+ throw new UnsupportedOperationException();
+ }
+
public void setDateHeader(String name, long value) {
// Expires not stored in cache - must be re-calculated for every
// response.
@@ -305,17 +318,22 @@
s.defaultWriteObject();
}
+ @Deprecated
+ public void flush(HttpServletResponse response) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
/**
* Flush used output writer/stream, to fix https://jira.jboss.org/jira/browse/RF-4017
* @param response
* @throws IOException
*/
- public void flush(HttpServletResponse response) throws IOException {
+ public void flush(ExternalContext externalContext) throws IOException {
if (filledOutputStream) {
- OutputStream out = response.getOutputStream();
+ OutputStream out = externalContext.getResponseOutputStream();
out.flush();
} else if (filledOutputWriter) {
- Writer out = response.getWriter();
+ Writer out = externalContext.getResponseOutputWriter();
out.flush();
}
}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/UIRangedNumberInput.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/UIRangedNumberInput.java 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/component/UIRangedNumberInput.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -102,16 +102,4 @@
return new Double(object.toString());
}
- private boolean isEmpty(Object newValue) {
- if (newValue == null) {
- return true;
- }
-
- if (newValue instanceof String) {
- return ((String) newValue).length() == 0;
- }
-
- return false;
- }
-
}
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/BaseResource.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/BaseResource.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/BaseResource.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,10 @@
+package org.richfaces.resource;
+
+public abstract class BaseResource {
+
+ public abstract String getVersion();
+
+ public abstract boolean isCryptable();
+
+ public abstract String getContentType();
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,22 @@
+/**
+ *
+ */
+package org.richfaces.resource;
+
+import org.ajax4jsf.resource.ResourceCodec;
+import org.richfaces.util.Util;
+
+class DefaultResourceCodec implements ResourceCodec {
+
+ public String encodeResource(String resourceName, Object resourceData) {
+ return Util.encodeResourceData(resourceName, resourceData);
+ }
+
+ public String decodeResourceName(String resourceKey) {
+ return Util.getResourceName(resourceKey);
+ }
+
+ public Object decodeResourceData(String resourceKey) {
+ return Util.getResourceData(resourceKey);
+ }
+}
\ No newline at end of file
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceHandlerImpl.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceHandlerImpl.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceHandlerImpl.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,281 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2009 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.faces.FacesException;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ajax4jsf.cache.Cache;
+import org.ajax4jsf.cache.CacheConfigurationLoader;
+import org.ajax4jsf.cache.CacheException;
+import org.ajax4jsf.cache.CacheFactory;
+import org.ajax4jsf.cache.CacheLoader;
+import org.ajax4jsf.cache.CacheManager;
+import org.ajax4jsf.resource.CacheContext;
+import org.ajax4jsf.resource.CachedResourceContext;
+import org.ajax4jsf.resource.FacesResourceContext;
+import org.ajax4jsf.resource.InternetResource;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.ResourceNotFoundException;
+import org.ajax4jsf.resource.util.URLToStreamHelper;
+import org.ajax4jsf.webapp.BaseFilter;
+import org.ajax4jsf.webapp.CacheContent;
+import org.richfaces.util.Util;
+import org.richfaces.util.RequestStateManager.BooleanRequestStateVariable;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class LegacyResourceHandlerImpl extends ResourceHandler implements CacheLoader, CacheConfigurationLoader {
+
+ public static final String LEGACY_RESOURCE_IDENTIFIER = "/rfResLegacy/";
+
+ private ResourceHandler defaultHandler;
+
+ private Cache cache;
+
+ public LegacyResourceHandlerImpl(ResourceHandler defaultHandler) {
+ super();
+ this.defaultHandler = defaultHandler;
+
+ initializeCache();
+ }
+
+ private void initializeCache() {
+ try {
+ CacheManager cacheManager = CacheManager.getInstance();
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
+
+ CacheFactory cacheFactory = cacheManager.getCacheFactory(applicationMap);
+ this.cache = cacheFactory.createCache(applicationMap, this, this);
+ } catch (CacheException e) {
+ throw new FacesException(e.getMessage(), e);
+ }
+ }
+
+ //TODO copied code - move to superclass
+ protected String getResourceKey(FacesContext context) {
+ String resourceName = Util.decodeResourceURL(context);
+ if (resourceName != null) {
+ if (resourceName.startsWith(LEGACY_RESOURCE_IDENTIFIER)) {
+ return resourceName.substring(LEGACY_RESOURCE_IDENTIFIER.length());
+ } else {
+ return null;
+ }
+ } else {
+ //TODO log
+ return null;
+ }
+ }
+
+ public boolean isResourceRequest(FacesContext context) {
+ if (defaultHandler.isResourceRequest(context)) {
+ return true;
+ } else {
+ Boolean resourceRequest = BooleanRequestStateVariable.LEGACY_RESOURCE_REQUEST.get(context);
+ if (resourceRequest == null) {
+ String resourceName = getResourceKey(context);
+ //TODO handle exclusions
+ resourceRequest = resourceName != null ? Boolean.TRUE : Boolean.FALSE;
+ BooleanRequestStateVariable.LEGACY_RESOURCE_REQUEST.set(context, resourceRequest);
+ }
+
+ return resourceRequest.booleanValue();
+ }
+ }
+
+
+ private Date getIfModifiedSince(ExternalContext externalContext) {
+ String ifModifiedSince = externalContext.getRequestHeaderMap().get("If-Modified-Since");
+ return Util.parseHttpDate(ifModifiedSince);
+ }
+
+ private boolean needsUpdate(Date serverLastModified, Date clientLastModified) {
+ if (clientLastModified == null) {
+ return true;
+ } else {
+ // 1000 ms due to round
+ // modification
+ // time to seconds.
+ long serverLastModifiedTime = serverLastModified.getTime() - 1000;
+
+ return serverLastModifiedTime > clientLastModified.getTime();
+ }
+ }
+
+ public void handleResourceRequest(FacesContext context) throws IOException {
+ if (defaultHandler.isResourceRequest(context)) {
+ defaultHandler.handleResourceRequest(context);
+ } else {
+
+ String resourceKey = getResourceKey(context);
+ InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+
+ InternetResource internetResource = null;// getInternetResource(request);
+ try {
+ internetResource = resourceBuilder.getResourceForKey(resourceKey);
+ Object resourceDataForKey = resourceBuilder.getResourceDataForKey(
+ resourceKey);
+
+ //TODO release resource context
+ ExternalContext externalContext = context.getExternalContext();
+ FacesResourceContext resourceContext = new FacesResourceContext(context);
+ try {
+ resourceContext.setResourceData(resourceDataForKey);
+ if (internetResource.isCacheable(resourceContext)) {
+ Date clientDate = getIfModifiedSince(externalContext);
+ Date serverDate = internetResource.getLastModified(resourceContext);
+
+ if (needsUpdate(serverDate, clientDate)) {
+ CachedResourceContext cachedResourceContext = new CachedResourceContext(resourceContext);
+ try {
+ CacheContext cacheLoaderContext = new CacheContext(cachedResourceContext, internetResource);
+ CacheContent cacheContent = (CacheContent) cache.get(resourceKey, cacheLoaderContext);
+
+ cacheContent.sendHeaders(externalContext);
+
+ long expired = internetResource.getExpired(resourceContext);
+ if (expired < 0 ) {
+ expired = InternetResource.DEFAULT_EXPIRE;
+ }
+
+ externalContext.setResponseHeader("Expires",
+ Util.formatHttpDate(System.currentTimeMillis() + expired));
+// response.addHeader("Cache-control", "max-age="
+// + (expired / 1000L));
+
+ //TODO where from to get method?
+ //if (request.getMethod().equals("HEAD")) {
+ cacheContent.send(externalContext);
+ //}
+
+ cacheContent.flush(externalContext);
+
+ } catch (CacheException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ cachedResourceContext.release();
+ }
+ } else {
+ externalContext.setResponseStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ }
+ } else {
+ internetResource.sendHeaders(resourceContext);
+ internetResource.send(resourceContext);
+ }
+ } finally {
+ resourceContext.release();
+ }
+ } catch (ResourceNotFoundException e) {
+ //TODO
+ context.getExternalContext().setResponseStatus(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+ }
+
+ public Resource createResource(String resourceName, String libraryName,
+ String contentType) {
+
+ Resource resource = null;
+
+ if (libraryName == null || libraryName.length() == 0) {
+ InternetResourceBuilder builder = InternetResourceBuilder.getInstance();
+ try {
+ InternetResource legacyResource = builder.getResource(resourceName);
+ resource = new LegacyResourceWrapper(legacyResource);
+ } catch (ResourceNotFoundException e) {
+ // TODO log
+ }
+ }
+
+ if (resource == null) {
+ resource = defaultHandler.createResource(resourceName, libraryName, contentType);
+ }
+
+ return resource;
+ }
+
+ public Resource createResource(String resourceName, String libraryName) {
+ return createResource(resourceName, libraryName, null);
+ }
+
+ public Resource createResource(String resourceName) {
+ return createResource(resourceName, null, null);
+ }
+
+ public String getRendererTypeForResourceName(String resourceName) {
+ return defaultHandler.getRendererTypeForResourceName(resourceName);
+ }
+
+ public boolean libraryExists(String libraryName) {
+ return defaultHandler.libraryExists(libraryName);
+ }
+
+ public Object load(Object key, Object context) throws CacheException {
+ CacheContext cacheKey = (CacheContext) context;
+ CachedResourceContext resourceContext = cacheKey.getResourceContext();
+ try {
+ InternetResource resource = cacheKey.getResource();
+ resource.sendHeaders(resourceContext);
+ resource.send(resourceContext);
+ } catch (IOException e) {
+ throw new CacheException(e.getMessage(), e);
+ }
+ // TODO - set refresh interval ?
+ // cache.put(cacheKey, resourceContext.getContent());
+ return resourceContext.getContent();
+ }
+
+ public Properties loadProperties(String name) {
+ Properties properties = new Properties();
+ InputStream props = URLToStreamHelper.urlToStreamSafe(BaseFilter.class.getResource(name));
+ if (null != props) {
+ try {
+ properties.load(props);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ } finally {
+ try {
+ props.close();
+ } catch (IOException e) {
+ // Can be ignored
+ }
+ }
+ }
+ return properties;
+ }
+
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceWrapper.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceWrapper.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/LegacyResourceWrapper.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,99 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2009 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Map;
+
+import javax.faces.application.Resource;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.InternetResource;
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+class LegacyResourceWrapper extends Resource {
+
+ private InternetResource resource;
+
+ public LegacyResourceWrapper(InternetResource resource) {
+ this.resource = resource;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Resource#getInputStream()
+ */
+ @Override
+ public InputStream getInputStream() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Resource#getRequestPath()
+ */
+ @Override
+ public String getRequestPath() {
+ //TODO pass resource data
+ return this.resource.getUri(FacesContext.getCurrentInstance(), null);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Resource#getResponseHeaders()
+ */
+ @Override
+ public Map<String, String> getResponseHeaders() {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Resource#getURL()
+ */
+ @Override
+ public URL getURL() {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.Resource#userAgentNeedsUpdate(javax.faces.context.FacesContext)
+ */
+ @Override
+ public boolean userAgentNeedsUpdate(FacesContext context) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void sendHeaders(ResourceContext context) throws IOException {
+ this.resource.sendHeaders(context);
+ }
+
+ public void send(ResourceContext context) throws IOException {
+ this.resource.send(context);
+ }
+
+ public boolean isCacheable(ResourceContext context) {
+ return this.resource.isCacheable(context);
+ }
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,235 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2009 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.component.StateHolder;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ajax4jsf.resource.ResourceCodec;
+import org.ajax4jsf.resource.ResourceCodecAware;
+import org.richfaces.util.Util;
+import org.richfaces.util.RequestStateManager.BooleanRequestStateVariable;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class ResourceHandlerImpl extends ResourceHandler {
+
+ public static final String RICHFACES_RESOURCE_IDENTIFIER = "/rfRes/";
+
+ private ResourceHandler defaultHandler;
+
+ private ResourceCodec codec;
+
+ public ResourceHandlerImpl(ResourceHandler defaultHandler) {
+ this(defaultHandler, new DefaultResourceCodec());
+ }
+
+ public ResourceHandlerImpl(ResourceHandler defaultHandler, ResourceCodec resourceCodec) {
+ super();
+
+ this.defaultHandler = defaultHandler;
+ this.codec = resourceCodec;
+ }
+
+ protected String getResourceKey(FacesContext context) {
+ String resourceName = Util.decodeResourceURL(context);
+ if (resourceName != null) {
+ if (resourceName.startsWith(RICHFACES_RESOURCE_IDENTIFIER)) {
+ return resourceName.substring(RICHFACES_RESOURCE_IDENTIFIER.length());
+ } else {
+ return null;
+ }
+ } else {
+ //TODO log
+ return null;
+ }
+ }
+
+ public boolean isResourceRequest(FacesContext context) {
+ if (defaultHandler.isResourceRequest(context)) {
+ return true;
+ } else {
+ Boolean resourceRequest = BooleanRequestStateVariable.RESOURCE_REQUEST.get(context);
+ if (resourceRequest == null) {
+ String resourceName = getResourceKey(context);
+ //TODO handle exclusions
+ resourceRequest = resourceName != null ? Boolean.TRUE : Boolean.FALSE;
+ BooleanRequestStateVariable.RESOURCE_REQUEST.set(context, resourceRequest);
+ }
+
+ return resourceRequest.booleanValue();
+ }
+ }
+
+ private void sendNotModified(FacesContext context) {
+ context.getExternalContext().setResponseStatus(HttpServletResponse.SC_NOT_MODIFIED);
+ }
+
+ private void sendNotFound(FacesContext context) {
+ context.getExternalContext().setResponseStatus(HttpServletResponse.SC_NOT_FOUND);
+ }
+
+ public void handleResourceRequest(FacesContext context) throws IOException {
+ if (defaultHandler.isResourceRequest(context)) {
+ defaultHandler.handleResourceRequest(context);
+ } else {
+ String resourceKey = getResourceKey(context);
+
+ if (resourceKey == null) {
+ sendNotFound(context);
+ return;
+ }
+
+ ResourceCodec resourceCodec = getResourceCodec();
+ String resourceName = resourceCodec.decodeResourceName(resourceKey);
+ if (resourceName == null) {
+ sendNotFound(context);
+ return;
+ }
+
+ Resource resource = createHandlerDepenendentResource(resourceName, null, null);
+ if (resource == null) {
+ sendNotFound(context);
+ return;
+ }
+
+ ExternalContext externalContext = context.getExternalContext();
+
+ if (resource instanceof StateHolder) {
+ StateHolder stateHolder = (StateHolder) resource;
+ stateHolder.restoreState(context, resourceCodec.decodeResourceData(resourceKey));
+ }
+
+ Map<String, String> headers = resource.getResponseHeaders();
+
+ if (resource.userAgentNeedsUpdate(context)) {
+ for (Entry<String, String> headerEntry : headers.entrySet()) {
+ externalContext.setResponseHeader(headerEntry.getKey(), headerEntry.getValue());
+ }
+
+ InputStream is = resource.getInputStream();
+ OutputStream os = externalContext.getResponseOutputStream();
+
+ try {
+ byte[] bs = new byte[8192];
+ int read;
+
+ while ((read = is.read(bs)) > 0) {
+ os.write(bs, 0, read);
+ }
+
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // TODO: handle exception
+ }
+ }
+
+ //TODO dispose resource
+ }
+
+ } else {
+ sendNotModified(context);
+ }
+ }
+ }
+
+ protected Resource createHandlerDepenendentResource(String resourceName, String libraryName,
+ String contentType) {
+
+ Resource resource = null;
+
+ if (libraryName == null || libraryName.length() == 0) {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ if (contextClassLoader != null) {
+ try {
+ Class<?> resourceClass = contextClassLoader.loadClass(resourceName);
+ if (Resource.class.isAssignableFrom(resourceClass)) {
+ resource = (Resource) resourceClass.newInstance();
+ resource.setResourceName(resourceName);
+ }
+
+ if (resource instanceof ResourceCodecAware) {
+ ((ResourceCodecAware) resource).setResourceCodec(getResourceCodec());
+ }
+ } catch (ClassNotFoundException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (InstantiationException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IllegalAccessException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ return resource;
+ }
+
+ public Resource createResource(String resourceName, String libraryName,
+ String contentType) {
+
+ Resource resource = createHandlerDepenendentResource(resourceName, libraryName, contentType);
+ if (resource == null) {
+ resource = defaultHandler.createResource(resourceName, libraryName, contentType);
+ }
+
+ return resource;
+ }
+
+ public Resource createResource(String resourceName, String libraryName) {
+ return createResource(resourceName, libraryName, null);
+ }
+
+ public Resource createResource(String resourceName) {
+ return createResource(resourceName, null, null);
+ }
+
+ public String getRendererTypeForResourceName(String resourceName) {
+ //TODO add support for dynamic resources
+ return defaultHandler.getRendererTypeForResourceName(resourceName);
+ }
+
+ public boolean libraryExists(String libraryName) {
+ return defaultHandler.libraryExists(libraryName);
+ }
+
+ protected ResourceCodec getResourceCodec() {
+ return codec;
+ }
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,87 @@
+package org.richfaces.resource;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+
+import javax.faces.FacesException;
+import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.ResourceImpl;
+import org.richfaces.VersionBean;
+import org.richfaces.VersionBean.Version;
+
+public class TestResource extends ResourceImpl implements StateHolder {
+
+ private String filePath;
+
+ @Override
+ public String getContentType(FacesContext context) {
+ return "image/png";
+ }
+
+ @Override
+ protected int getContentLength(FacesContext context) {
+ return (int) new File(filePath).length();
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ try {
+ return new FileInputStream(filePath);
+ } catch (FileNotFoundException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
+ }
+ }
+
+ @Override
+ public String getVersion() {
+ Version version = new VersionBean().getVersion();
+ return version.getMajor() + "." + version.getMinor() + "." + version.getRevision();
+ }
+
+ protected void writeState(ByteArrayOutputStream baos) {
+ try {
+ baos.write("c:\\tmp\\test.png".getBytes(Charset.forName("US-ASCII")));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ protected void readState(ByteArrayInputStream bais) {
+ int available = bais.available();
+ byte[] bs = new byte[available];
+ try {
+ bais.read(bs);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ filePath = new String(bs, Charset.forName("US-ASCII"));
+ }
+
+ public Object saveState(FacesContext context) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ writeState(baos);
+ return baos.toByteArray();
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) state);
+ readState(bais);
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ }
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource2.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource2.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/resource/TestResource2.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,91 @@
+package org.richfaces.resource;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.faces.component.StateHolder;
+import javax.faces.context.FacesContext;
+import javax.imageio.ImageIO;
+
+import org.ajax4jsf.resource.ResourceImpl;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+public class TestResource2 extends ResourceImpl implements StateHolder {
+
+ private Color color;
+
+ public TestResource2() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+ Object parameter = skin.getParameter(context, Skin.headerGradientColor);
+ this.color = HtmlColor.decode(parameter.toString());
+ }
+
+ @Override
+ public String getContentType(FacesContext context) {
+ return "image/png";
+ }
+
+ private Dimension dimension = new Dimension(200, 150);
+
+ @Override
+ public InputStream getInputStream() {
+ GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ BufferedImage image = new BufferedImage(dimension.width, dimension.height, ColorSpace.TYPE_RGB);
+ Graphics2D g2d = environment.createGraphics(image);
+
+ try {
+ g2d.setPaint(new GradientPaint(0, 0, Color.WHITE, dimension.width, dimension.height, color));
+ g2d.fillRect(0, 0, dimension.width, dimension.height);
+ } finally {
+ g2d.dispose();
+ }
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try {
+ ImageIO.write(image, "png", baos);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return new ByteArrayInputStream(baos.toByteArray());
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ byte[] bytes = (byte[]) state;
+ this.color = new Zipper2(bytes).nextColor();
+ }
+
+ public Object saveState(FacesContext context) {
+ byte[] bytes = new byte[3];
+ Zipper2 zipper2 = new Zipper2(bytes);
+
+ zipper2.addColor(color);
+ return bytes;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ }
+
+ @Override
+ public String getEntityTag(FacesContext context) {
+ return Integer.toHexString(color.getRGB() & 0xFFFFFF);
+ }
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/RequestStateManager.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/RequestStateManager.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/RequestStateManager.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,128 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2009 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public final class RequestStateManager {
+
+ private static final String CONTEXT_ATTRIBUTE_NAME = RequestStateManager.class.getName();
+
+ private RequestStateManager() {}
+
+ //TODO remove this stuff
+ public static enum BooleanRequestStateVariable {
+
+ LEGACY_RESOURCE_REQUEST("org.richfaces.LEGACY_RESOURCE_REQUEST"),
+
+ RESOURCE_REQUEST("org.richfaces.RESOURCE_REQUEST");
+
+ private String attributeName;
+
+ private BooleanRequestStateVariable(String attributeName) {
+ this.attributeName = attributeName;
+ }
+
+ public Boolean get(FacesContext context) {
+ return (Boolean) RequestStateManager.get(context, this.attributeName);
+ }
+
+ public void set(FacesContext context, Boolean value) {
+ RequestStateManager.set(context, this.attributeName, value);
+ }
+ };
+
+
+ @SuppressWarnings("unchecked")
+ private static Map<String, Object> getStateMap(FacesContext context, boolean create) {
+ Map<Object, Object> attributesMap = context.getAttributes();
+
+ Map<String, Object> result = (Map<String, Object>) attributesMap.get(CONTEXT_ATTRIBUTE_NAME);
+ if (create && result == null) {
+ result = new HashMap<String, Object>();
+ attributesMap.put(CONTEXT_ATTRIBUTE_NAME, result);
+ }
+
+ return result;
+ }
+
+ public static boolean containsKey(FacesContext context, String key) {
+ if (context == null) {
+ throw new NullPointerException("context");
+ }
+
+ if (key == null) {
+ throw new NullPointerException("key");
+ }
+
+ Map<String, Object> stateMap = getStateMap(context, false);
+ if (stateMap != null) {
+ return stateMap.containsKey(key);
+ } else {
+ return false;
+ }
+ }
+
+ public static Object get(FacesContext context, String key) {
+ if (context == null) {
+ throw new NullPointerException("context");
+ }
+
+ if (key == null) {
+ throw new NullPointerException("key");
+ }
+
+ Map<String, Object> stateMap = getStateMap(context, false);
+ if (stateMap != null) {
+ return stateMap.get(key);
+ } else {
+ return null;
+ }
+ }
+
+ public static void set(FacesContext context, String key, Object value) {
+ if (context == null) {
+ throw new NullPointerException("context");
+ }
+
+ if (key == null) {
+ throw new NullPointerException("key");
+ }
+
+ if (value != null) {
+ Map<String, Object> stateMap = getStateMap(context, true);
+ stateMap.put(key, value);
+ } else {
+ Map<String, Object> stateMap = getStateMap(context, false);
+ if (stateMap != null) {
+ stateMap.remove(key);
+ }
+ }
+ }
+}
Added: branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/Util.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/Util.java (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/java/org/richfaces/util/Util.java 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,321 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ *
+ * Portions Copyrighted 2009 Exadel, Inc.
+ *
+ * Exadel. Inc, elects to include this software in this distribution under the
+ * GPL Version 2 license.
+ */
+
+package org.richfaces.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.StreamCorruptedException;
+import java.io.UnsupportedEncodingException;
+import java.text.Format;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.zip.Deflater;
+import java.util.zip.Inflater;
+
+import javax.faces.FacesException;
+import javax.faces.application.ViewHandler;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.util.base64.Codec;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class Util {
+
+ private Util() {}
+
+ /* HTTP Date format required by the HTTP/1.1 RFC */
+ private static final String RFC1123_DATE_PATTERN = "EEE, dd MMM yyyy HH:mm:ss zzz";
+
+ private static final SimpleDateFormat RFC1123_DATE_FORMATTER =
+ new SimpleDateFormat(RFC1123_DATE_PATTERN, Locale.US);
+
+ static {
+ RFC1123_DATE_FORMATTER.setTimeZone(TimeZone.getTimeZone("GMT"));
+ }
+
+ public static String getMappingForRequest(FacesContext context) {
+ ExternalContext externalContext = context.getExternalContext();
+
+ String servletPath = externalContext.getRequestServletPath();
+
+ if (servletPath == null) {
+ return null;
+ }
+
+ if (servletPath.length() == 0) {
+ return "/";
+ }
+
+ String pathInfo = externalContext.getRequestPathInfo();
+ if (pathInfo != null) {
+ return servletPath;
+ }
+
+ int idx = servletPath.lastIndexOf('.');
+ if (idx < 0) {
+ return servletPath;
+ } else {
+ return servletPath.substring(idx);
+ }
+ }
+
+ public static Date parseHttpDate(String s) {
+ Date result = null;
+
+ if (s != null) {
+ try {
+ result = (Date) ((Format) RFC1123_DATE_FORMATTER.clone()).parseObject(s);
+ } catch (ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ return result;
+ }
+
+ public static String formatHttpDate(Object object) {
+ if (object != null) {
+ return ((Format) RFC1123_DATE_FORMATTER.clone()).format(object);
+ } else {
+ return null;
+ }
+ }
+
+ //TODO codec have settings
+ private static final Codec CODEC = new Codec();
+
+ private static final String DATA_SEPARATOR = "/DATA/";
+ private static final String DATA_BYTES_SEPARATOR = "/DATB/";
+
+ private static final Pattern DATA_SEPARATOR_PATTERN = Pattern
+ .compile("/DAT(A|B)/");
+
+ protected static byte[] encrypt(byte[] src) {
+ try {
+ Deflater compressor = new Deflater(Deflater.BEST_SPEED);
+ byte[] compressed = new byte[src.length + 100];
+ compressor.setInput(src);
+ compressor.finish();
+ int totalOut = compressor.deflate(compressed);
+ byte[] zipsrc = new byte[totalOut];
+ System.arraycopy(compressed, 0, zipsrc, 0, totalOut);
+ compressor.end();
+ return CODEC.encode(zipsrc);
+ } catch (Exception e) {
+ throw new FacesException("Error encode resource data", e);
+ }
+ }
+
+ protected static byte[] decrypt(byte[] src) {
+ try {
+ byte[] zipsrc = CODEC.decode(src);
+ Inflater decompressor = new Inflater();
+ byte[] uncompressed = new byte[zipsrc.length * 5];
+ decompressor.setInput(zipsrc);
+ int totalOut = decompressor.inflate(uncompressed);
+ byte[] out = new byte[totalOut];
+ System.arraycopy(uncompressed, 0, out, 0, totalOut);
+ decompressor.end();
+ return out;
+ } catch (Exception e) {
+ throw new FacesException("Error decode resource data", e);
+ }
+ }
+
+ public static String encodeResourceData(String resourceName, Object storeData) {
+ StringBuffer uri = new StringBuffer();// ResourceServlet.DEFAULT_SERVLET_PATH).append("/");
+ uri.append(resourceName);
+ // append serialized data as Base-64 encoded request string.
+ if (storeData != null) {
+ try {
+ byte[] objectData;
+ if (storeData instanceof byte[]) {
+ objectData = (byte[]) storeData;
+ uri.append(DATA_BYTES_SEPARATOR);
+ } else {
+ ByteArrayOutputStream dataSteram = new ByteArrayOutputStream(
+ 1024);
+ ObjectOutputStream objStream = new ObjectOutputStream(
+ dataSteram);
+ objStream.writeObject(storeData);
+ objStream.flush();
+ objStream.close();
+ dataSteram.close();
+ objectData = dataSteram.toByteArray();
+ uri.append(DATA_SEPARATOR);
+ }
+ byte[] dataArray = encrypt(objectData);
+ uri.append(new String(dataArray, "ISO-8859-1"));
+
+ // / byte[] objectData = dataSteram.toByteArray();
+ // / uri.append("?").append(new
+ // String(Base64.encodeBase64(objectData),
+ // / "ISO-8859-1"));
+ } catch (Exception e) {
+ // Ignore errors, log it
+// log.error(Messages
+// .getMessage(Messages.QUERY_STRING_BUILDING_ERROR), e);
+ }
+ }
+
+ //boolean isGlobal = !resource.isSessionAware();
+
+// String resourceURL = getFacesResourceURL(context,
+// uri.toString(), false /*isGlobal*/);// context.getApplication().getViewHandler().getResourceURL(context,uri.toString());
+ //if (!isGlobal) {
+ // resourceURL = context.getExternalContext().encodeResourceURL(
+ // resourceURL);
+ //}
+// if (log.isDebugEnabled()) {
+// log.debug(Messages.getMessage(Messages.BUILD_RESOURCE_URI_INFO,
+// resource.getKey(), resourceURL));
+// }
+ return uri.toString();// context.getExternalContext().encodeResourceURL(resourceURL);
+ }
+
+ public static String getResourceName(String resourceUri) {
+ String resourceName = resourceUri;
+ Matcher matcher = DATA_SEPARATOR_PATTERN.matcher(resourceName);
+ if (matcher.find()) {
+ int data = matcher.start();
+ resourceName = resourceName.substring(0, data);
+ }
+
+ return resourceName;
+ }
+
+
+ public static Object getResourceData(String resourceUri) {
+ Object data = null;
+ String dataString = null;
+ Matcher matcher = DATA_SEPARATOR_PATTERN.matcher(resourceUri);
+ if (matcher.find()) {
+// if (log.isDebugEnabled()) {
+// log.debug(Messages.getMessage(
+// Messages.RESTORE_DATA_FROM_RESOURCE_URI_INFO, resourceUri,
+// dataString));
+// }
+ int dataStart = matcher.end();
+ dataString = resourceUri.substring(dataStart);
+ byte[] objectArray = null;
+ byte[] dataArray;
+ try {
+ dataArray = dataString.getBytes("ISO-8859-1");
+ objectArray = decrypt(dataArray);
+ } catch (UnsupportedEncodingException e1) {
+ // default encoding always presented.
+ }
+ if ("B".equals(matcher.group(1))) {
+ data = objectArray;
+ } else {
+ try {
+ ObjectInputStream in = new ObjectInputStream(
+ new ByteArrayInputStream(objectArray));
+ data = in.readObject();
+ } catch (StreamCorruptedException e) {
+// log.error(Messages
+// .getMessage(Messages.STREAM_CORRUPTED_ERROR), e);
+ } catch (IOException e) {
+// log.error(Messages
+// .getMessage(Messages.DESERIALIZE_DATA_INPUT_ERROR),
+// e);
+ } catch (ClassNotFoundException e) {
+// log
+// .error(
+// Messages
+// .getMessage(Messages.DATA_CLASS_NOT_FOUND_ERROR),
+// e);
+ }
+ }
+ }
+
+ return data;
+ }
+
+ public static String encodeResourceURL(FacesContext context, String url) {
+ String mapping = Util.getMappingForRequest(context);
+
+ String resourcePath = url;
+ if (mapping.startsWith("/")) {
+ if (mapping.length() != 1) {
+ resourcePath = mapping + url;
+ }
+ } else {
+ resourcePath += mapping;
+ }
+
+ ViewHandler viewHandler = context.getApplication().getViewHandler();
+ return viewHandler.getResourceURL(context, resourcePath);
+ }
+
+ public static String decodeResourceURL(FacesContext context) {
+ ExternalContext externalContext = context.getExternalContext();
+ String resourceName = null;
+
+ String facesMapping = Util.getMappingForRequest(context);
+ if (facesMapping != null) {
+ if (facesMapping.startsWith("/")) {
+ //prefix mapping
+ resourceName = externalContext.getRequestPathInfo();
+ } else {
+ String requestServletPath = externalContext.getRequestServletPath();
+ resourceName = requestServletPath.substring(0,
+ requestServletPath.length() - facesMapping.length());
+ }
+ }
+
+ return resourceName;
+ }
+}
Modified: branches/jsf2.0/framework/impl/src/main/resources/META-INF/faces-config.xml
===================================================================
--- branches/jsf2.0/framework/impl/src/main/resources/META-INF/faces-config.xml 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/main/resources/META-INF/faces-config.xml 2009-06-30 12:30:09 UTC (rev 14752)
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
- version="1.2">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
<factory>
<render-kit-factory>org.ajax4jsf.renderkit.ChameleonRenderKitFactory</render-kit-factory>
<!--
@@ -15,12 +15,12 @@
<property-resolver>org.richfaces.skin.SkinPropertyResolver</property-resolver>
<view-handler>org.ajax4jsf.application.AjaxViewHandler</view-handler>
-->
- <state-manager>org.ajax4jsf.application.AjaxStateManager</state-manager>
+ <!-- state-manager>org.ajax4jsf.application.AjaxStateManager</state-manager -->
</application>
- <lifecycle>
+ <!-- lifecycle>
<phase-listener>org.ajax4jsf.event.AjaxPhaseListener</phase-listener>
<phase-listener>org.ajax4jsf.event.InitPhaseListener</phase-listener>
- </lifecycle>
+ </lifecycle -->
<managed-bean>
<managed-bean-name>a4j</managed-bean-name>
<managed-bean-class>org.richfaces.VersionBean</managed-bean-class>
@@ -43,16 +43,16 @@
</managed-bean>
<component>
- <component-type>javax.faces.ViewRoot</component-type>
+ <!-- component-type>javax.faces.ViewRoot</component-type>
<component-class>org.ajax4jsf.component.AjaxViewRoot</component-class>
<component-extension>
<component-family>javax.faces.ViewRoot</component-family>
- </component-extension>
+ </component-extension -->
</component>
- <render-kit>
+ <!-- render-kit>
<renderer>
<description>
@@ -61,7 +61,7 @@
<component-family>javax.faces.ViewRoot</component-family>
<renderer-type>javax.faces.ViewRoot</renderer-type>
<renderer-class>org.ajax4jsf.renderkit.AjaxViewRootRenderer</renderer-class>
- </renderer>
+ </renderer -->
<!--
<renderer>
<component-family>javax.faces.Form</component-family>
@@ -74,5 +74,6 @@
<renderer-class>org.ajax4jsf.renderkit.html.HtmlCommandLinkRenderer</renderer-class>
</renderer>
-->
- </render-kit>
+ <!-- /render-kit -->
+
</faces-config>
Added: branches/jsf2.0/framework/impl/src/main/resources/META-INF/resource-handler.faces-config.xml
===================================================================
--- branches/jsf2.0/framework/impl/src/main/resources/META-INF/resource-handler.faces-config.xml (rev 0)
+++ branches/jsf2.0/framework/impl/src/main/resources/META-INF/resource-handler.faces-config.xml 2009-06-30 12:30:09 UTC (rev 14752)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
+ <application>
+ <resource-handler>org.richfaces.resource.ResourceHandlerImpl</resource-handler>
+ </application>
+</faces-config>
Modified: branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/a-faces-config.xml
===================================================================
--- branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/a-faces-config.xml 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/a-faces-config.xml 2009-06-30 12:30:09 UTC (rev 14752)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="windows-1252"?>
-<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:bridge="http://www.apache.org/myfaces/xml/ns/bridge/bridge-extension">
<application>
<application-extension>
Modified: branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/b-faces-config.xml
===================================================================
--- branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/b-faces-config.xml 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/b-faces-config.xml 2009-06-30 12:30:09 UTC (rev 14752)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="windows-1252"?>
-<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:bridge="http://www.apache.org/myfaces/xml/ns/bridge/bridge-extension">
<application>
<application-extension>
Modified: branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/faces-config.xml
===================================================================
--- branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/faces-config.xml 2009-06-30 12:21:06 UTC (rev 14751)
+++ branches/jsf2.0/framework/impl/src/test/resources/WEB-INF/faces-config.xml 2009-06-30 12:30:09 UTC (rev 14752)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="windows-1252"?>
-<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:bridge="http://www.apache.org/myfaces/xml/ns/bridge/bridge-extension">
<application>
<application-extension>
Property changes on: branches/jsf2.0/framework/jsf-test
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
15 years, 3 months
JBoss Rich Faces SVN: r14751 - in branches/jsf2.0/framework: test and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-30 08:21:06 -0400 (Tue, 30 Jun 2009)
New Revision: 14751
Modified:
branches/jsf2.0/framework/impl/pom.xml
branches/jsf2.0/framework/test/pom.xml
Log:
pom files updated
Modified: branches/jsf2.0/framework/impl/pom.xml
===================================================================
--- branches/jsf2.0/framework/impl/pom.xml 2009-06-30 12:17:50 UTC (rev 14750)
+++ branches/jsf2.0/framework/impl/pom.xml 2009-06-30 12:21:06 UTC (rev 14751)
@@ -162,5 +162,10 @@
<artifactId>richfaces-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: branches/jsf2.0/framework/test/pom.xml
===================================================================
--- branches/jsf2.0/framework/test/pom.xml 2009-06-30 12:17:50 UTC (rev 14750)
+++ branches/jsf2.0/framework/test/pom.xml 2009-06-30 12:21:06 UTC (rev 14751)
@@ -46,7 +46,7 @@
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
- <artifactId>mojarra-jsf-impl</artifactId>
+ <artifactId>jsf-impl</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
15 years, 3 months
JBoss Rich Faces SVN: r14750 - branches/jsf2.0.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-30 08:17:50 -0400 (Tue, 30 Jun 2009)
New Revision: 14750
Modified:
branches/jsf2.0/pom.xml
Log:
Added dev.java.net Maven 2 repository
Modified: branches/jsf2.0/pom.xml
===================================================================
--- branches/jsf2.0/pom.xml 2009-06-30 12:09:03 UTC (rev 14749)
+++ branches/jsf2.0/pom.xml 2009-06-30 12:17:50 UTC (rev 14750)
@@ -77,7 +77,18 @@
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout>
</repository>
+
<repository>
+ <releases />
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>maven-repository2.dev.java.net</id>
+ <name>Java.net Repository for Maven 2</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+
+ <repository>
<releases>
<enabled>true</enabled>
</releases>
15 years, 3 months
JBoss Rich Faces SVN: r14749 - branches/jsf2.0.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-30 08:09:03 -0400 (Tue, 30 Jun 2009)
New Revision: 14749
Modified:
branches/jsf2.0/pom.xml
Log:
Added settings for maven-compiler-plugin
Modified: branches/jsf2.0/pom.xml
===================================================================
--- branches/jsf2.0/pom.xml 2009-06-30 12:06:39 UTC (rev 14748)
+++ branches/jsf2.0/pom.xml 2009-06-30 12:09:03 UTC (rev 14749)
@@ -14,6 +14,15 @@
</properties>
<dependencies />
<build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
15 years, 3 months
JBoss Rich Faces SVN: r14748 - branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-06-30 08:06:39 -0400 (Tue, 30 Jun 2009)
New Revision: 14748
Modified:
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxActionsRule.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxComponentHandler.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxContainerBaseRule.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxReRendrRule.java
branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java
Log:
Facelets tag handlers updated to compile with JSF 2.0
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxActionsRule.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxActionsRule.java 2009-06-30 11:46:11 UTC (rev 14747)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxActionsRule.java 2009-06-30 12:06:39 UTC (rev 14748)
@@ -22,15 +22,15 @@
package org.ajax4jsf.webapp.taglib;
import javax.faces.component.ActionSource;
+import javax.faces.component.ActionSource2;
import javax.faces.event.ActionEvent;
+import javax.faces.event.MethodExpressionActionListener;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.el.LegacyMethodBinding;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:21 $
@@ -51,9 +51,9 @@
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ActionSource) instance).setAction(new LegacyMethodBinding(
- this.attr.getMethodExpression(ctx, String.class,
- AjaxActionsRule.ACTION_SIG)));
+ ((ActionSource2) instance).setActionExpression(
+ this.attr.getMethodExpression(ctx, String.class,
+ AjaxActionsRule.ACTION_SIG));
}
}
@@ -66,10 +66,9 @@
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((ActionSource) instance)
- .setActionListener(new LegacyMethodBinding(this.attr
- .getMethodExpression(ctx, null,
- AjaxActionsRule.ACTION_LISTENER_SIG)));
+ ((ActionSource) instance).addActionListener(new MethodExpressionActionListener(this.attr
+ .getMethodExpression(ctx, null,
+ AjaxActionsRule.ACTION_LISTENER_SIG)));
}
}
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxComponentHandler.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxComponentHandler.java 2009-06-30 11:46:11 UTC (rev 14747)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxComponentHandler.java 2009-06-30 12:06:39 UTC (rev 14748)
@@ -22,13 +22,12 @@
package org.ajax4jsf.webapp.taglib;
import javax.faces.component.ActionSource;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.MetaRuleset;
import org.ajax4jsf.component.AjaxContainerBase;
-import com.sun.facelets.tag.MetaRuleset;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-import com.sun.facelets.tag.jsf.ComponentHandler;
-
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:23 $
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxContainerBaseRule.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxContainerBaseRule.java 2009-06-30 11:46:11 UTC (rev 14747)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxContainerBaseRule.java 2009-06-30 12:06:39 UTC (rev 14748)
@@ -21,15 +21,15 @@
package org.ajax4jsf.webapp.taglib;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
import org.ajax4jsf.component.AjaxContainerBase;
import org.ajax4jsf.event.AjaxEvent;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:21 $
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxReRendrRule.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxReRendrRule.java 2009-06-30 11:46:11 UTC (rev 14747)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/AjaxReRendrRule.java 2009-06-30 12:06:39 UTC (rev 14748)
@@ -23,15 +23,15 @@
import java.util.Set;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-
/**
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.1.2.1 $ $Date: 2007/02/01 15:31:22 $
Modified: branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java
===================================================================
--- branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java 2009-06-30 11:46:11 UTC (rev 14747)
+++ branches/jsf2.0/framework/impl/src/main/java/org/ajax4jsf/webapp/taglib/EmptyHandler.java 2009-06-30 12:06:39 UTC (rev 14748)
@@ -8,12 +8,11 @@
import javax.el.ELException;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.tag.TagConfig;
-import com.sun.facelets.tag.TagHandler;
-
/**
* This if "empty" facelets tag handler stub. This handler used to ignore tags on a page.
* At most, it used to bypass <jsp:root> and other tags, so we can use same markup for an facelets an jsp pages.
15 years, 3 months
JBoss Rich Faces SVN: r14747 - branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2009-06-30 07:46:11 -0400 (Tue, 30 Jun 2009)
New Revision: 14747
Modified:
branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/WEB-INF/faces-config.xml
Log:
Modified: branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/WEB-INF/faces-config.xml 2009-06-30 11:45:41 UTC (rev 14746)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/WEB-INF/faces-config.xml 2009-06-30 11:46:11 UTC (rev 14747)
@@ -152,13 +152,12 @@
<managed-bean-class>org.docs.richfaces.tree.TreeBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
-
-
-
- <application>
- <view-handler>
- com.sun.facelets.FaceletViewHandler
- </view-handler>
- </application>
-
+ <managed-bean>
+ <managed-bean-name>caledar</managed-bean-name>
+ <managed-bean-class>org.docs.richfaces.Caledar</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
</faces-config>
15 years, 3 months
JBoss Rich Faces SVN: r14746 - branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/rich.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2009-06-30 07:45:41 -0400 (Tue, 30 Jun 2009)
New Revision: 14746
Modified:
branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/rich/richPage.xhtml
Log:
Modified: branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/rich/richPage.xhtml
===================================================================
--- branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/rich/richPage.xhtml 2009-06-29 18:55:35 UTC (rev 14745)
+++ branches/community/3.3.X/test-applications/richfaces-docs/src/main/webapp/rich/richPage.xhtml 2009-06-30 11:45:41 UTC (rev 14746)
@@ -6,27 +6,23 @@
<rich:page sidebarPosition="left" sidebarWidth="300" title="advisory" pageTitle="Page Title"
-theme="simple"
+theme="brewedcoffee"
>
- <f:facet name="pageHeader" >
- </f:facet>
+
<f:facet name="header" >
- <ui:include src="layout/menu.xhtml">
- <ui:param name="projectName" value="RichFaces Docs"/>
+header
+
<!--Header-->
- </ui:include>
+
</f:facet>
- <f:facet name="subheader" >
- <!--Subheader-->
-
- </f:facet>
+
<f:facet name="sidebar">
-<ui:include src="layout/mainMenu.xhtml" />
+side bar
<!--Side panel-->
</f:facet>
@@ -35,37 +31,37 @@
<rich:layoutPanel position="top">
- <!--Top-->
+ Top
</rich:layoutPanel>
<rich:layoutPanel position="left">
- <!--Left-->
+ Left
</rich:layoutPanel>
<rich:layoutPanel position="center">
- <!--Center-->
+ Center
</rich:layoutPanel>
<rich:layoutPanel position="right">
- <!--Right-->
+ Right
</rich:layoutPanel>
<rich:layoutPanel position="bottom">
- <!--Bottom-->
+ Bottom
</rich:layoutPanel>
</rich:layout>
<f:facet name="footer">
- <!--Footer-->
+ <!--Footer-->footer
</f:facet>
</rich:page>
15 years, 3 months
JBoss Rich Faces SVN: r14745 - in branches/sandbox/rf4_build: cdk/trunk and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-06-29 14:55:35 -0400 (Mon, 29 Jun 2009)
New Revision: 14745
Added:
branches/sandbox/rf4_build/framework/trunk/version-matrix/
branches/sandbox/rf4_build/framework/trunk/version-matrix/pom.xml
branches/sandbox/rf4_build/ui/trunk/version-matrix/
branches/sandbox/rf4_build/ui/trunk/version-matrix/pom.xml
Removed:
branches/sandbox/rf4_build/version-matrix/
Modified:
branches/sandbox/rf4_build/cdk/trunk/pom.xml
branches/sandbox/rf4_build/examples/trunk/components/pom.xml
branches/sandbox/rf4_build/examples/trunk/components/tree-demo/pom.xml
branches/sandbox/rf4_build/examples/trunk/pom.xml
branches/sandbox/rf4_build/framework/trunk/pom.xml
branches/sandbox/rf4_build/make.sh
branches/sandbox/rf4_build/ui/trunk/components/panel/pom.xml
branches/sandbox/rf4_build/ui/trunk/components/pom.xml
branches/sandbox/rf4_build/ui/trunk/pom.xml
Log:
new build system
Modified: branches/sandbox/rf4_build/cdk/trunk/pom.xml
===================================================================
--- branches/sandbox/rf4_build/cdk/trunk/pom.xml 2009-06-29 15:19:54 UTC (rev 14744)
+++ branches/sandbox/rf4_build/cdk/trunk/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -4,20 +4,35 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.richfaces</groupId>
- <artifactId>version-matrix</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </parent>
-
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces</groupId>
<artifactId>cdk</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>plugins</module>
<module>archetypes</module>
</modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <version>1.0-beta-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.0-alpha-4</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Modified: branches/sandbox/rf4_build/examples/trunk/components/pom.xml
===================================================================
--- branches/sandbox/rf4_build/examples/trunk/components/pom.xml 2009-06-29 15:19:54 UTC (rev 14744)
+++ branches/sandbox/rf4_build/examples/trunk/components/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -28,6 +28,11 @@
<artifactId>${example.componentName}-ui</artifactId>
<version>${ui.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.components</groupId>
+ <artifactId>${example.componentName}Model-ui</artifactId>
+ <version>${ui.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Modified: branches/sandbox/rf4_build/examples/trunk/components/tree-demo/pom.xml
===================================================================
--- branches/sandbox/rf4_build/examples/trunk/components/tree-demo/pom.xml 2009-06-29 15:19:54 UTC (rev 14744)
+++ branches/sandbox/rf4_build/examples/trunk/components/tree-demo/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -20,6 +20,10 @@
<groupId>org.richfaces.ui.components</groupId>
<artifactId>${example.componentName}-ui</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.components</groupId>
+ <artifactId>${example.componentName}Model-ui</artifactId>
+ </dependency>
</dependencies>
<properties>
Modified: branches/sandbox/rf4_build/examples/trunk/pom.xml
===================================================================
--- branches/sandbox/rf4_build/examples/trunk/pom.xml 2009-06-29 15:19:54 UTC (rev 14744)
+++ branches/sandbox/rf4_build/examples/trunk/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -4,17 +4,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.richfaces</groupId>
- <artifactId>version-matrix</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </parent>
-
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces</groupId>
<artifactId>examples</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
+
<properties>
<jsf.version>2.0.0-PR2_3</jsf.version>
<framework.version>${project.version}</framework.version>
@@ -24,11 +20,6 @@
<dependencies>
<dependency>
<groupId>org.richfaces.framework</groupId>
- <artifactId>richfaces-api</artifactId>
- <version>${framework.version}</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-impl</artifactId>
<version>${framework.version}</version>
</dependency>
Modified: branches/sandbox/rf4_build/framework/trunk/pom.xml
===================================================================
--- branches/sandbox/rf4_build/framework/trunk/pom.xml 2009-06-29 15:19:54 UTC (rev 14744)
+++ branches/sandbox/rf4_build/framework/trunk/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -5,8 +5,8 @@
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <groupId>org.richfaces</groupId>
- <artifactId>version-matrix</artifactId>
+ <groupId>org.richfaces</groupId>
+ <artifactId>framework-version-matrix</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
@@ -14,6 +14,27 @@
<groupId>org.richfaces</groupId>
<artifactId>framework</artifactId>
<packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-api</artifactId>
+ <version>${framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>${framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-test-base</artifactId>
+ <version>${framework.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<dependency>
Added: branches/sandbox/rf4_build/framework/trunk/version-matrix/pom.xml
===================================================================
--- branches/sandbox/rf4_build/framework/trunk/version-matrix/pom.xml (rev 0)
+++ branches/sandbox/rf4_build/framework/trunk/version-matrix/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <scm>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/</developerConnection>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/</connection>
+ <url>http://fisheye.jboss.org/browse/RichFaces</url>
+ </scm>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces</groupId>
+ <artifactId>framework-version-matrix</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <jsf.version>2.0.0-PR2_3</jsf.version>
+ <framework.version>${project.version}</framework.version>
+ <cdk.version>${project.version}</cdk.version>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>snapshots.jboss.org</id>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>${jsf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Dependencies of JSF 2.0 -->
+ <!-- Included because of http://jira.codehaus.org/browse/MNG-2205 -->
+ <!-- start -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- end -->
+
+ <!-- Archetypes dependency -->
+ <!-- start -->
+ <dependency>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-packaging</artifactId>
+ <version>2.0-alpha-4</version>
+ </dependency>
+ <!-- end -->
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <version>1.0-beta-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.0-alpha-4</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <executions>
+ <execution>
+ <id>enforce-versions</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireMavenVersion>
+ <version>2.1.0</version>
+ </requireMavenVersion>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <wtpversion>2.0</wtpversion>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
Modified: branches/sandbox/rf4_build/make.sh
===================================================================
--- branches/sandbox/rf4_build/make.sh 2009-06-29 15:19:54 UTC (rev 14744)
+++ branches/sandbox/rf4_build/make.sh 2009-06-29 18:55:35 UTC (rev 14745)
@@ -2,16 +2,38 @@
PROJECT_DIR=`pwd`
TAG_DIR='trunk'
+VERSION_MATRIX='version-matrix'
settings=$PROJECT_DIR/settings.xml
case "`uname`" in
CYGWIN*) settings=`cygpath -w $settings` ;;
esac
-for MODULE in 'version-matrix' 'cdk' 'framework' 'ui' 'docs' 'examples'
+
+for MODULE in 'framework' 'ui'
do
echo
+ echo -e "\033[40m\033[1;32m---------------------------------\033[0m"
+ echo -e "\033[40m\033[1;32mMaking $MODULE/$TAG_DIR/version-matrix \033[0m"
echo -e "\033[40m\033[1;32m---------------------------------\033[0m"
+ echo
+
+ cd $PROJECT_DIR/$MODULE/$TAG_DIR/$VERSION_MATRIX
+
+ if mvn -s $settings clean install; then
+ echo
+ else
+ exit $?
+ fi
+
+done
+
+
+for MODULE in 'cdk' 'framework' 'ui' 'docs' 'examples'
+
+do
+ echo
+ echo -e "\033[40m\033[1;32m---------------------------------\033[0m"
echo -e "\033[40m\033[1;32mMaking $MODULE/$TAG_DIR \033[0m"
echo -e "\033[40m\033[1;32m---------------------------------\033[0m"
echo
Modified: branches/sandbox/rf4_build/ui/trunk/components/panel/pom.xml
===================================================================
--- branches/sandbox/rf4_build/ui/trunk/components/panel/pom.xml 2009-06-29 15:19:54 UTC (rev 14744)
+++ branches/sandbox/rf4_build/ui/trunk/components/panel/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -6,9 +6,9 @@
<parent>
<groupId>org.richfaces.ui</groupId>
- <artifactId>components</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </parent>
+ <artifactId>components</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.ui.components</groupId>
Modified: branches/sandbox/rf4_build/ui/trunk/components/pom.xml
===================================================================
--- branches/sandbox/rf4_build/ui/trunk/components/pom.xml 2009-06-29 15:19:54 UTC (rev 14744)
+++ branches/sandbox/rf4_build/ui/trunk/components/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -12,9 +12,21 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-ui</artifactId>
+ <artifactId>components</artifactId>
<packaging>pom</packaging>
-
+ <!--dependencies>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-api</artifactId>
+ <version>${framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-test-base</artifactId>
+ <version>${framework.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies-->
<modules>
<module>panel</module>
<module>tree</module>
Modified: branches/sandbox/rf4_build/ui/trunk/pom.xml
===================================================================
--- branches/sandbox/rf4_build/ui/trunk/pom.xml 2009-06-29 15:19:54 UTC (rev 14744)
+++ branches/sandbox/rf4_build/ui/trunk/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -4,23 +4,22 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.richfaces</groupId>
- <artifactId>version-matrix</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>ui-version-matrix</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces</groupId>
<artifactId>ui</artifactId>
<packaging>pom</packaging>
-
- <build>
+
+ <build>
<plugins>
<plugin>
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
- <version>${cdk.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
@@ -72,11 +71,12 @@
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-test-base</artifactId>
+ <scope> test </scope>
</dependency>
</dependencies>
<modules>
- <module>components</module>
+ <module>components</module>
<module>skins</module>
<module>themes</module>
</modules>
Added: branches/sandbox/rf4_build/ui/trunk/version-matrix/pom.xml
===================================================================
--- branches/sandbox/rf4_build/ui/trunk/version-matrix/pom.xml (rev 0)
+++ branches/sandbox/rf4_build/ui/trunk/version-matrix/pom.xml 2009-06-29 18:55:35 UTC (rev 14745)
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <scm>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/</developerConnection>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/</connection>
+ <url>http://fisheye.jboss.org/browse/RichFaces</url>
+ </scm>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces</groupId>
+ <artifactId>ui-version-matrix</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <jsf.version>2.0.0-PR2_3</jsf.version>
+ <ui.version>${project.version}</ui.version>
+ <framework.version>${project.version}</framework.version>
+ <cdk.version>${project.version}</cdk.version>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repository.jboss.org</id>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <url>http://repository.jboss.org/maven2</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>snapshots.jboss.org</id>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <url>http://snapshots.jboss.org/maven2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-api</artifactId>
+ <version>${framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-test-base</artifactId>
+ <version>${framework.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Dependencies of JSF 2.0 -->
+ <!-- Included because of http://jira.codehaus.org/browse/MNG-2205 -->
+ <!-- start -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- end -->
+
+ <!-- Archetypes dependency -->
+ <!-- start -->
+ <dependency>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-packaging</artifactId>
+ <version>2.0-alpha-4</version>
+ </dependency>
+ <!-- end -->
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>${cdk.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>xml-maven-plugin</artifactId>
+ <version>1.0-beta-2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.0-alpha-4</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <wtpversion>2.0</wtpversion>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.0-beta-1</version>
+ <executions>
+ <execution>
+ <id>enforce-versions</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireMavenVersion>
+ <version>2.1.0</version>
+ </requireMavenVersion>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
15 years, 3 months