myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r499391 - in /myfaces: shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/ tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ to...
Date Wed, 24 Jan 2007 13:11:54 GMT
Author: imario
Date: Wed Jan 24 05:11:53 2007
New Revision: 499391

URL: http://svn.apache.org/viewvc?view=rev&rev=499391
Log:
allow stylesheet filtering, added example

framework enhancements to deliver resources: introduced ResourceProvider which allows to reuse the MyFacesResourceLoader by having custom resource repositories.

Added:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilter.java   (contents, props changed)
      - copied, changed from r499303, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetFilter.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilterProvider.java   (with props)
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultResourceProvider.java   (with props)
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceProvider.java   (with props)
    myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/EnvironmentInfo.java   (with props)
    myfaces/tomahawk/trunk/examples/simple/src/main/webapp/css/table.css   (with props)
    myfaces/tomahawk/trunk/examples/simple/src/main/webapp/filteredStylesheet.jsp   (with props)
Removed:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetFilter.java
Modified:
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetRenderer.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultAddResource.java
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/MyFacesResourceLoader.java
    myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_stylesheet_attributes.xml
    myfaces/tomahawk/trunk/core/src/main/tld/tomahawk.tld
    myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml
    myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java?view=diff&rev=499391&r1=499390&r2=499391
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java Wed Jan 24 05:11:53 2007
@@ -18,19 +18,11 @@
  */
 package org.apache.myfaces.shared.renderkit;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.shared.renderkit.html.util.FormInfo;
+import org.apache.myfaces.shared.util.HashMapUtils;
+import org.apache.myfaces.shared.util.SelectItemsIterator;
 
 import javax.faces.FacesException;
 import javax.faces.component.EditableValueHolder;
@@ -52,12 +44,19 @@
 import javax.faces.el.ValueBinding;
 import javax.faces.event.PhaseId;
 import javax.faces.model.SelectItem;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.shared.renderkit.html.util.FormInfo;
-import org.apache.myfaces.shared.util.HashMapUtils;
-import org.apache.myfaces.shared.util.SelectItemsIterator;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
 
 /**
  * @author Manfred Geiler (latest modification by $Author$)
@@ -194,7 +193,7 @@
         }
         return null;
     }
-    
+
     public static String getStringValue(FacesContext facesContext,
                                         UIComponent component) {
         try {
@@ -649,7 +648,7 @@
     /**
      * Find the enclosing form of a component
      * in the view-tree.
-     * All Subclasses of <code>UIForm</code> and all known 
+     * All Subclasses of <code>UIForm</code> and all known
      * form-families are searched for.
      * Currently those are the Trinidad form family,
      * and the (old) ADF Faces form family.
@@ -850,46 +849,54 @@
      * @param file name of the resource file (e.g. <code>foo.css</code>).
      * @return the content of the resource file, or <code>null</code> if no such file is available.
      */
-    public static Object loadResourceFile(FacesContext ctx, String file) {
+    public static String loadResourceFile(FacesContext ctx, String file) {
 
-        String href = ctx.getExternalContext().getRequestContextPath() + file;
-        if (log.isDebugEnabled())
-            log.debug("loadFile: " + href);
-
-
-        File resourceFile = new File(href);
-        String content;
-
-
-        if (resourceFile.canRead()) {
-            FileInputStream in;
-            try {
-                in = new FileInputStream(resourceFile);
-                byte[] fileBuffer = new byte[(int) resourceFile.length()];
-                in.read(fileBuffer);
-                in.close();
-                content = new String(fileBuffer);
-            }
-            catch (FileNotFoundException e) {
-                if (log.isWarnEnabled())
-                    log.warn("no such file", e);
-                content = null;
-            }
-            catch (IOException e) {
-                if (log.isWarnEnabled())
-                    log.warn("problems during writing file", e);
-                e.printStackTrace();
-                content = null;
-            }
+        ByteArrayOutputStream content = new ByteArrayOutputStream(10240);
 
-        }
-        else {
-            if (log.isErrorEnabled())
-                log.error("File not readable: " + href);
-            content = null;
-        }
+		InputStream in = null;
+		try {
+			in = ctx.getExternalContext().getResourceAsStream(file);
+			byte[] fileBuffer = new byte[10240];
+			int read;
+			while ((read = in.read(fileBuffer)) > -1)
+			{
+				content.write(fileBuffer, 0, read);
+			}
+		}
+		catch (FileNotFoundException e) {
+			if (log.isWarnEnabled())
+				log.warn("no such file " + file, e);
+			content = null;
+		}
+		catch (IOException e) {
+			if (log.isWarnEnabled())
+				log.warn("problems during processing resource " + file, e);
+			content = null;
+		}
+		finally
+		{
+			try
+			{
+				content.close();
+			}
+			catch (IOException e)
+			{
+				log.warn(e.getLocalizedMessage(), e);
+			}
+			if (in != null)
+			{
+				try
+				{
+					in.close();
+				}
+				catch (IOException e)
+				{
+					log.warn(e.getLocalizedMessage(), e);
+				}
+			}
+		}
 
-        return content;
+		return content.toString();
     }
 
     /**

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetRenderer.java?view=diff&rev=499391&r1=499390&r2=499391
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetRenderer.java Wed Jan 24 05:11:53 2007
@@ -20,6 +20,7 @@
 
 import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
 import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.renderkit.html.util.AddResourceFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -53,7 +54,16 @@
 				writer.writeAttribute("media", stylesheet.getMedia(), null);
 			}
 			//writer.writeText("<!--\n", null);
-			Object text = RendererUtils.loadResourceFile(context, stylesheet.getPath());
+
+			Object text;
+			if (stylesheet.isFiltered())
+			{
+				text = TextResourceFilter.getInstance(context).getOrCreateFilteredResource(context, stylesheet.getPath());
+			}
+			else
+			{
+				text = RendererUtils.loadResourceFile(context, stylesheet.getPath());
+			}
 			if (text != null)
 			{
 				writer.writeText(text, null);
@@ -72,10 +82,18 @@
 				writer.writeAttribute("media", stylesheet.getMedia(), null);
 			}
 
-			writer.writeURIAttribute
-				("href",
-					context.getApplication().getViewHandler().getResourceURL(context, stylesheet.getPath()),
-					"path");
+			String stylesheetPath;
+			if (stylesheet.isFiltered())
+			{
+				TextResourceFilter.getInstance(context).getOrCreateFilteredResource(context, stylesheet.getPath());
+				stylesheetPath = AddResourceFactory.getInstance(context).getResourceUri(context, TextResourceFilterProvider.class, stylesheet.getPath(), true);
+			}
+			else
+			{
+				stylesheetPath = context.getApplication().getViewHandler().getResourceURL(context, stylesheet.getPath());
+			}
+
+			writer.writeURIAttribute("href", stylesheetPath, "path");
 			writer.endElement("link");
 		}
 	}

Copied: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilter.java (from r499303, myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetFilter.java)
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilter.java?view=diff&rev=499391&p1=myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetFilter.java&r1=499303&p2=myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilter.java&r2=499391
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/StylesheetFilter.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilter.java Wed Jan 24 05:11:53 2007
@@ -18,6 +18,22 @@
  */
 package org.apache.myfaces.custom.stylesheet;
 
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.io.BufferedReader;
+import java.io.StringWriter;
+import java.io.PrintWriter;
+import java.io.IOException;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.Collections;
+
 /**
  * filters a stylesheet
  * <p/>
@@ -25,6 +41,168 @@
  *
  * @author imario
  */
-public class StylesheetFilter
+public class TextResourceFilter implements Serializable
 {
+	private static final Log log = LogFactory.getLog(TextResourceFilter.class);
+
+	private final static String CONTEXT_KEY = TextResourceFilter.class.getName() + ".INSTANCE";
+
+	private final Map filteredResources = Collections.synchronizedMap(new TreeMap());
+
+	public static class ResourceInfo
+	{
+		private final long lastModified;
+		private final String text;
+
+		protected ResourceInfo(long lastModified, String text)
+		{
+			this.lastModified = lastModified;
+			this.text = text;
+		}
+
+		public long getLastModified()
+		{
+			return lastModified;
+		}
+
+		public String getText()
+		{
+			return text;
+		}
+
+		public int getSize()
+		{
+			return text.length();
+		}
+	}
+
+	protected TextResourceFilter()
+	{
+	}
+
+	protected static TextResourceFilter create()
+	{
+		return new TextResourceFilter();
+	}
+
+	/**
+	 * get the application stylesheet filter
+	 */
+	public static TextResourceFilter getInstance(ServletContext context)
+	{
+		TextResourceFilter filterText = (TextResourceFilter) context.getAttribute(CONTEXT_KEY);
+		if (filterText == null)
+		{
+			filterText = create();
+			context.setAttribute(CONTEXT_KEY, filterText);
+		}
+
+		return filterText;
+	}
+
+	/**
+	 * get the application stylesheet filter
+	 */
+	public static TextResourceFilter getInstance(FacesContext context)
+	{
+		TextResourceFilter filterText = (TextResourceFilter) context.getExternalContext().getApplicationMap().get(CONTEXT_KEY);
+		if (filterText == null)
+		{
+			filterText = create();
+			context.getExternalContext().getApplicationMap().put(CONTEXT_KEY, filterText);
+		}
+
+		return filterText;
+	}
+
+	/**
+	 * gets the filtered content of the resource pointing to with <code>path</code>
+	 *
+	 * This will <b>not</b> filter the resource if its not already done before.
+	 */
+	public ResourceInfo getFilteredResource(String path)
+	{
+		ResourceInfo filteredResource = (ResourceInfo) filteredResources.get(path);
+		if (filteredResource == null)
+		{
+			return null;
+		}
+
+		return filteredResource;
+	}
+
+	/**
+	 * <p>
+	 * filteres the resource
+	 * </p>
+	 *
+	 * Notice: This method is not synchronized for performance reasons (the map is)
+	 * the worst case is that we filter a resource twice the first time wich is not
+	 * a problem
+	 */
+	public ResourceInfo getOrCreateFilteredResource(FacesContext context, String path) throws IOException
+	{
+		if (path.startsWith("/"))
+		{
+			// the resource loader do not use the leading "/", so strip it here
+			path = path.substring(1);
+		}
+
+		ResourceInfo filteredResource = getFilteredResource(path);
+		if (filteredResource != null)
+		{
+			return filteredResource;
+		}
+
+		String text = RendererUtils.loadResourceFile(context, path);
+		if (text == null)
+		{
+			// avoid loading the errorneous resource over and over again
+			text = "";
+		}
+
+		StringWriter stringWriter = new StringWriter();
+		PrintWriter writer = new PrintWriter(stringWriter);
+		BufferedReader reader = null;
+		try
+		{
+			reader = new BufferedReader(new StringReader(text.toString()));
+
+			String line;
+			while ((line = reader.readLine()) != null)
+			{
+				int pos = line.indexOf("#{");
+				if (pos > -1 && line.indexOf("}", pos) > -1)
+				{
+					line = RendererUtils.getStringValue(context, context.getApplication().createValueBinding(line));
+				}
+
+				if (line != null)
+				{
+					writer.println(line);
+				}
+			}
+		}
+		finally
+		{
+			if (reader != null)
+			{
+				try
+				{
+					reader.close();
+				}
+				catch (IOException e)
+				{
+					log.warn(e.getLocalizedMessage(), e);
+				}
+			}
+
+			writer.close();
+		}
+
+		filteredResource = new ResourceInfo(System.currentTimeMillis(), stringWriter.toString());
+		filteredResources.put(path, filteredResource);
+
+		return filteredResource;
+	}
 }

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilterProvider.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilterProvider.java?view=auto&rev=499391
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilterProvider.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilterProvider.java Wed Jan 24 05:11:53 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.custom.stylesheet;
+
+import org.apache.myfaces.renderkit.html.util.ResourceProvider;
+
+import javax.servlet.ServletContext;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * provdes a simple string as utf-8 encoded resource
+ */
+public class TextResourceFilterProvider implements ResourceProvider
+{
+	public boolean exists(ServletContext context, String resource)
+	{
+		return TextResourceFilter.getInstance(context).getFilteredResource(resource) != null;
+	}
+
+	public int getContentLength(ServletContext context, String resource) throws IOException
+	{
+		return TextResourceFilter.getInstance(context).getFilteredResource(resource).getSize();
+	}
+
+	public long getLastModified(ServletContext context, String resource) throws IOException
+	{
+		return TextResourceFilter.getInstance(context).getFilteredResource(resource).getLastModified();
+	}
+
+	public InputStream getInputStream(ServletContext context, String resource) throws IOException
+	{
+		return new ByteArrayInputStream(
+			TextResourceFilter.getInstance(context).getFilteredResource(resource).getText().getBytes(
+				getEncoding(context, resource)
+			));
+	}
+
+	public String getEncoding(ServletContext context, String resource) throws IOException
+	{
+		return "UTF-8";
+	}
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilterProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilterProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/stylesheet/TextResourceFilterProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultAddResource.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultAddResource.java?view=diff&rev=499391&r1=499390&r2=499391
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultAddResource.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultAddResource.java Wed Jan 24 05:11:53 2007
@@ -518,7 +518,7 @@
      */
     protected long getCacheKey(FacesContext context)
     {
-        // cache key is hold in application scope so it is recreated on redeploying the webapp.
+		// cache key is hold in application scope so it is recreated on redeploying the webapp.
         Map applicationMap = context.getExternalContext().getApplicationMap();
         Long cacheKey = (Long) applicationMap.get(RESOURCES_CACHE_KEY);
         if (cacheKey == null)

Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultResourceProvider.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultResourceProvider.java?view=auto&rev=499391
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultResourceProvider.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultResourceProvider.java Wed Jan 24 05:11:53 2007
@@ -0,0 +1,63 @@
+package org.apache.myfaces.renderkit.html.util;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * A class which provide the resource using the standard <code>class.getResource</code> lookup
+ * stuff.
+ *
+ * @author imario (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class DefaultResourceProvider implements ResourceProvider
+{
+	private final Class clazz;
+
+	public DefaultResourceProvider(Class clazz)
+	{
+		this.clazz = clazz;
+	}
+
+	protected URL getResource(String resource)
+	{
+		resource = "resource/" + resource;
+		return clazz.getResource(resource);
+	}
+
+	public boolean exists(ServletContext context, String resource)
+	{
+		return getResource(resource) != null;
+	}
+
+	public long getLastModified(ServletContext context, String resource) throws IOException
+	{
+		return getResource(resource).openConnection().getLastModified();
+	}
+
+	public int getContentLength(ServletContext context, String resource) throws IOException
+	{
+		return getResource(resource).openConnection().getContentLength();
+	}
+
+	public InputStream getInputStream(ServletContext context, String resource) throws IOException
+	{
+		return getResource(resource).openConnection().getInputStream();
+	}
+
+	public String getEncoding(ServletContext context, String resource) throws IOException
+	{
+		// cant be determined ... use default
+		try
+		{
+			return System.getProperty("file.encoding");
+		}
+		catch (SecurityException e)
+		{
+			// not allowed
+			return null;
+		}
+	}
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultResourceProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultResourceProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/DefaultResourceProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/MyFacesResourceLoader.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/MyFacesResourceLoader.java?view=diff&rev=499391&r1=499390&r2=499391
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/MyFacesResourceLoader.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/MyFacesResourceLoader.java Wed Jan 24 05:11:53 2007
@@ -33,13 +33,12 @@
 import java.util.Calendar;
 import java.util.Date;
 import java.util.ResourceBundle;
-import java.net.URL;
-import java.net.URLConnection;
+import java.net.HttpURLConnection;
 
 /**
  * A ResourceLoader capable of fetching resources from the classpath,
  * but only for classes under package org.apache.myfaces.custom.
- * 
+ *
  * @author Mathias Broekelmann (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
@@ -106,7 +105,7 @@
     public void serveResource(ServletContext context, HttpServletRequest request,
             HttpServletResponse response, String resourceUri) throws IOException
     {
-        String[] uriParts = resourceUri.split("/", 2);
+		String[] uriParts = resourceUri.split("/", 2);
 
         String component = uriParts[0];
         if (component == null || component.trim().length() == 0)
@@ -135,7 +134,6 @@
             log.error("No resource defined component class " + className);
             return;
         }
-        resource = "resource/" + resource;
 
         InputStream is = null;
 
@@ -144,8 +142,34 @@
 			// is = componentClass.getResourceAsStream(resource);
 			//if (is == null)
 
-			URL url = componentClass.getResource(resource);
-			if (url == null)
+			ResourceProvider resourceProvider;
+			if (ResourceProvider.class.isAssignableFrom(componentClass))
+			{
+				try
+				{
+					resourceProvider = (ResourceProvider) componentClass.newInstance();
+				}
+				catch (InstantiationException e)
+				{
+					response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "Unable to instantiate resource provider for resource "
+							+ resource + " for component " + component);
+					log.error("Unable to instantiate resource provider for resource " + resource + " for component " + component, e);
+					return;
+				}
+				catch (IllegalAccessException e)
+				{
+					response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "Unable to instantiate resource provider for resource "
+							+ resource + " for component " + component);
+					log.error("Unable to instantiate resource provider for resource " + resource + " for component " + component, e);
+					return;
+				}
+			}
+			else
+			{
+				resourceProvider = new DefaultResourceProvider(componentClass);
+			}
+
+			if (!resourceProvider.exists(context, resource))
             {
                 response.sendError(HttpServletResponse.SC_NOT_FOUND, "Unable to find resource "
                         + resource + " for component " + component
@@ -157,20 +181,46 @@
             }
             else
             {
-				URLConnection con = url.openConnection();
-				int contentLength = con.getContentLength();
+				// URLConnection con = url.openConnection();
+
+				long lastModified = resourceProvider.getLastModified(context, resource);
+				if (lastModified < 1)
+				{
+					// fallback
+					lastModified = getLastModified();
+				}
+
+				long browserDate = request.getDateHeader("If-Modified-Since");
+				if (browserDate > -1)
+				{
+					// normalize to seconds - this should work with any os
+					lastModified = (lastModified / 1000) * 1000;
+					browserDate = (browserDate / 1000) * 1000;
+
+					if (lastModified == browserDate)
+					{
+						// the browser already has the correct version
+
+						response.setStatus(HttpURLConnection.HTTP_NOT_MODIFIED);
+						return;
+					}
+				}
+
+
+				int contentLength = resourceProvider.getContentLength(context, resource);
+				String contentEncoding = resourceProvider.getEncoding(context, resource);
 
-				is = con.getInputStream();
+				is = resourceProvider.getInputStream(context, resource);
 
-				defineContentHeaders(request, response, resource, contentLength);
-                defineCaching(request, response, resource);
+				defineContentHeaders(request, response, resource, contentLength, contentEncoding);
+                defineCaching(request, response, resource, lastModified);
                 writeResource(request, response, is);
             }
         }
         finally
         {
             if(is!=null)
-                is.close();            
+                is.close();
         }
     }
 
@@ -205,9 +255,9 @@
      * effectively reload files on webapp redeploy.
      */
     protected void defineCaching(HttpServletRequest request, HttpServletResponse response,
-            String resource)
+            String resource, long lastModified)
     {
-        response.setDateHeader("Last-Modified", getLastModified());
+        response.setDateHeader("Last-Modified", lastModified);
 
         Calendar expires = Calendar.getInstance();
         expires.add(Calendar.DAY_OF_YEAR, 7);
@@ -223,17 +273,24 @@
      * The mime-type output is determined by the resource filename suffix.
      */
     protected void defineContentHeaders(HttpServletRequest request, HttpServletResponse response,
-										String resource, int contentLength)
+										String resource, int contentLength, String contentEncoding)
     {
+		String charset = "";
+		if (contentEncoding != null)
+		{
+			charset = "; charset=" + contentEncoding;
+		}
 		if (contentLength > -1)
 		{
 			response.setContentLength(contentLength);
 		}
-		
+
 		if (resource.endsWith(".js"))
-            response.setContentType(org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT);
+            response.setContentType(
+				org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT + charset);
         else if (resource.endsWith(".css"))
-            response.setContentType(org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.STYLE_TYPE_TEXT_CSS);
+            response.setContentType(
+				org.apache.myfaces.shared_tomahawk.renderkit.html.HTML.STYLE_TYPE_TEXT_CSS + charset);
         else if (resource.endsWith(".gif"))
             response.setContentType("image/gif");
         else if (resource.endsWith(".png"))

Added: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceProvider.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceProvider.java?view=auto&rev=499391
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceProvider.java (added)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceProvider.java Wed Jan 24 05:11:53 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.renderkit.html.util;
+
+import javax.servlet.ServletContext;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A class which can provide the resource itself
+ *
+ * @author imario (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public interface ResourceProvider
+{
+	/**
+	 * check if the resource exists
+	 */
+	public boolean exists(ServletContext context, String resource);
+
+	/**
+	 * get the content length of the resource
+	 */
+	public int getContentLength(ServletContext context, String resource) throws IOException;
+
+	/**
+	 * get the last modified time of the resource
+	 */
+	public long getLastModified(ServletContext context, String resource) throws IOException;
+
+	/**
+	 * get the input stream of the resource
+	 */
+	public InputStream getInputStream(ServletContext context, String resource) throws IOException;
+
+	/**
+	 * get resource encoding
+	 */
+	public String getEncoding(ServletContext context, String resource) throws IOException;
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/util/ResourceProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_stylesheet_attributes.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_stylesheet_attributes.xml?view=diff&rev=499391&r1=499390&r2=499391
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_stylesheet_attributes.xml (original)
+++ myfaces/tomahawk/trunk/core/src/main/tld/tomahawk-entities/tomahawk_stylesheet_attributes.xml Wed Jan 24 05:11:53 2007
@@ -16,6 +16,19 @@
                 ]]>
             </description>
         </attribute>
+		<attribute>
+			<name>filtered</name>
+			<required>false</required>
+			<rtexprvalue>false</rtexprvalue>
+			<description><![CDATA[
+				true|false. When true, any EL expression in the stylesheet will be
+				evaluated and replaced by its string representation on the first
+				access.
+				The stylesheet will be processed only once. Every subsequent request
+				will get a cached view.
+				]]>
+			</description>
+		</attribute>
         <attribute>
             <name>media</name>
             <required>false</required>

Modified: myfaces/tomahawk/trunk/core/src/main/tld/tomahawk.tld
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/tld/tomahawk.tld?view=diff&rev=499391&r1=499390&r2=499391
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/tld/tomahawk.tld (original)
+++ myfaces/tomahawk/trunk/core/src/main/tld/tomahawk.tld Wed Jan 24 05:11:53 2007
@@ -217,7 +217,7 @@
       SYSTEM "tomahawk-entities/tomahawk_panel_group_attributes.xml">
 <!ENTITY tomahawk_dojo_intializer_attributes
       SYSTEM "tomahawk-entities/tomahawk_dojo_initializer_attributes.xml">
-<!ENTITY tomahawk_select_items_attributes 
+<!ENTITY tomahawk_select_items_attributes
       SYSTEM "tomahawk-entities/tomahawk_select_items_attributes.xml">
 
 ]>
@@ -1213,7 +1213,7 @@
             A tree data component.
 
             Unless otherwise specified, all attributes accept static values or EL expressions.
-        </description>
+h        </description>
 		&ui_component_attributes;
         &tomahawk_tree_attributes;
     </tag>
@@ -1592,7 +1592,7 @@
 		&ui_component_attributes;
 		&tomahawk_dojo_intializer_attributes;
 	</tag>
-	
+
 	<tag>
 		<name>selectItems</name>
 		<tag-class>org.apache.myfaces.custom.selectitems.SelectItemsTag</tag-class>

Added: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/EnvironmentInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/EnvironmentInfo.java?view=auto&rev=499391
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/EnvironmentInfo.java (added)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/EnvironmentInfo.java Wed Jan 24 05:11:53 2007
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.examples;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * provide access to some environmental infos
+ */
+public class EnvironmentInfo
+{
+	public String getRequestContextPath()
+	{
+		return FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
+	}
+}

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/EnvironmentInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/EnvironmentInfo.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/java/org/apache/myfaces/examples/EnvironmentInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml?view=diff&rev=499391&r1=499390&r2=499391
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/WEB-INF/examples-config.xml Wed Jan 24 05:11:53 2007
@@ -14,7 +14,14 @@
         <variable-resolver>org.apache.myfaces.examples.accessedbeans.AccessTrackingVariableResolver</variable-resolver>
     </application>
 
-    <!-- Accessed beans on the last request -->
+
+	<managed-bean>
+		<managed-bean-name>environmentInfo</managed-bean-name>
+		<managed-bean-class>org.apache.myfaces.examples.EnvironmentInfo</managed-bean-class>
+		<managed-bean-scope>application</managed-bean-scope>
+	</managed-bean>
+
+	<!-- Accessed beans on the last request -->
     <managed-bean>
         <managed-bean-name>accessedBeans</managed-bean-name>
         <managed-bean-class>org.apache.myfaces.examples.accessedbeans.AccessedBeans</managed-bean-class>
@@ -69,13 +76,13 @@
         <managed-bean-class>org.apache.myfaces.examples.aliasexample.AliasHolder</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
-    
+
     <managed-bean>
         <managed-bean-name>aliasTest3</managed-bean-name>
         <managed-bean-class>org.apache.myfaces.examples.aliasexample.AliasHolder</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
-    
+
     <managed-bean>
         <managed-bean-name>aliasTest4</managed-bean-name>
         <managed-bean-class>org.apache.myfaces.examples.aliasexample.AliasHolder</managed-bean-class>
@@ -185,7 +192,7 @@
         <managed-bean-class>org.apache.myfaces.examples.listexample.SimpleSortableCarList</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
-    
+
     <!-- Managed Beans for simpleAutoSortList.jsp -->
 
     <managed-bean>
@@ -215,7 +222,7 @@
         <managed-bean-class>org.apache.myfaces.examples.crosstable.DataBean</managed-bean-class>
         <managed-bean-scope>session</managed-bean-scope>
     </managed-bean>
-    
+
     <!-- Managed Beans for date.jsp -->
 
     <managed-bean>
@@ -223,7 +230,7 @@
         <managed-bean-class>java.util.Date</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
-    
+
     <managed-bean>
         <managed-bean-name>date2</managed-bean-name>
         <managed-bean-class>java.util.Date</managed-bean-class>
@@ -320,13 +327,13 @@
         <managed-bean-class>org.apache.myfaces.examples.misc.TabbedPaneBean</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
-    
+
     <managed-bean>
         <managed-bean-name>testCheckBox</managed-bean-name>
         <managed-bean-class>org.apache.myfaces.examples.misc.TestCheckBox</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
-    
+
 	<managed-bean>
         <managed-bean-name>testCheckList</managed-bean-name>
         <managed-bean-class>org.apache.myfaces.examples.misc.TestCheckBoxList</managed-bean-class>
@@ -377,7 +384,7 @@
     	<managed-bean-class>java.util.Date</managed-bean-class>
     	<managed-bean-scope>application</managed-bean-scope>
     </managed-bean>
-	
+
 	<!--  Managed bean for the selectItems component -->
 	<managed-bean>
 		<managed-bean-name>selectItemsBean</managed-bean-name>
@@ -541,7 +548,7 @@
     		</map-entry>
     	</map-entries>
     </managed-bean>
-    
+
     <managed-bean>
     	<managed-bean-name>randomColorEntryRenderer</managed-bean-name>
     	<managed-bean-class>org.apache.myfaces.examples.schedule.RandomColorScheduleEntryRenderer</managed-bean-class>
@@ -565,7 +572,7 @@
     </managed-bean>
 
     <!-- NAVIGATION RULES -->
-	
+
     <navigation-rule>
         <navigation-case>
             <from-outcome>go_home</from-outcome>
@@ -594,7 +601,7 @@
             <from-outcome>go_aliasBean</from-outcome>
             <to-view-id>/aliasBean.jsp</to-view-id>
         </navigation-case>
-        
+
         <navigation-case>
             <from-outcome>go_buffer</from-outcome>
             <to-view-id>/buffer.jsp</to-view-id>
@@ -654,12 +661,12 @@
             <from-outcome>go_tree</from-outcome>
             <to-view-id>/tree.jsp</to-view-id>
         </navigation-case>
-        
+
         <navigation-case>
             <from-outcome>go_tree2</from-outcome>
             <to-view-id>/tree2.jsp</to-view-id>
-        </navigation-case>        
-        
+        </navigation-case>
+
         <navigation-case>
             <from-outcome>go_treeTable</from-outcome>
             <to-view-id>/treeTable.jsp</to-view-id>
@@ -694,7 +701,7 @@
             <from-outcome>go_datascroller</from-outcome>
             <to-view-id>/dataScroller.jsp</to-view-id>
         </navigation-case>
-        
+
         <navigation-case>
             <from-outcome>go_panelstack</from-outcome>
             <to-view-id>/panelstack.jsp</to-view-id>
@@ -709,7 +716,7 @@
             <from-outcome>go_newspaperTable</from-outcome>
             <to-view-id>/newspaperTable.jsp</to-view-id>
         </navigation-case>
-		
+
 		<navigation-case>
             <from-outcome>go_forceId</from-outcome>
             <to-view-id>/forceId.jsp</to-view-id>
@@ -719,7 +726,7 @@
             <from-outcome>go_swapimage</from-outcome>
             <to-view-id>/swapimage.jsp</to-view-id>
         </navigation-case>
-        
+
         <navigation-case>
             <from-outcome>go_selectOneCountry</from-outcome>
             <to-view-id>/selectOneCountry.jsp</to-view-id>
@@ -804,7 +811,7 @@
 			<redirect />
 		</navigation-case>
 	</navigation-rule>
-	
+
 	<navigation-rule>
 		<from-view-id>/schedule_addentry.jsp</from-view-id>
 		<navigation-case>
@@ -823,7 +830,7 @@
 			<redirect />
 		</navigation-case>
 	</navigation-rule>
-	
+
 	<navigation-rule>
 		<from-view-id>/schedule3.jsp</from-view-id>
 		<navigation-case>

Added: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/css/table.css
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/css/table.css?view=auto&rev=499391
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/css/table.css (added)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/css/table.css Wed Jan 24 05:11:53 2007
@@ -0,0 +1,4 @@
+.tableBack
+{
+	background-image: url(#{environmentInfo.requestContextPath}/images/logo.jpg)
+}

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/css/table.css
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/css/table.css
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/css/table.css
------------------------------------------------------------------------------
    svn:mime-type = text/css

Added: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/filteredStylesheet.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/filteredStylesheet.jsp?view=auto&rev=499391
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/filteredStylesheet.jsp (added)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/filteredStylesheet.jsp Wed Jan 24 05:11:53 2007
@@ -0,0 +1,70 @@
+<%@ page session="false" contentType="text/html;charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<html>
+
+<%@include file="inc/head.inc" %>
+
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//-->
+
+<body>
+
+<f:view>
+	<t:stylesheet path="/css/table.css" filtered="true" />
+
+	<f:loadBundle basename="org.apache.myfaces.examples.resource.example_messages" var="example_messages"/>
+
+    <p>
+        This example demonstrates a filtered stylesheet.
+	</p>
+    <p>
+		You should see a table with an background image configured. The background image is configured in
+		the stylesheet as<br />
+
+		<pre>
+.tableBack
+{
+	background-image: url(#{environmentInfo.requestContextPath}/images/logo.jpg)
+}
+		</pre>
+	</p>
+
+	<h:panelGrid columns="3" styleClass="tableBack">
+		<h:outputText value="col1.1" />
+		<h:outputText value="col1.2" />
+		<h:outputText value="col1.3" />
+		<h:outputText value="col2.1" />
+		<h:outputText value="col2.2" />
+		<h:outputText value="col2.3" />
+		<h:outputText value="col3.1" />
+		<h:outputText value="col3.2" />
+		<h:outputText value="col3.3" />
+	</h:panelGrid>
+
+</f:view>
+
+<%@include file="inc/page_footer.jsp" %>
+
+</body>
+
+</html>

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/filteredStylesheet.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/filteredStylesheet.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/filteredStylesheet.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp?view=diff&rev=499391&r1=499390&r2=499391
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp (original)
+++ myfaces/tomahawk/trunk/examples/simple/src/main/webapp/home.jsp Wed Jan 24 05:11:53 2007
@@ -10,7 +10,7 @@
 
         <f:view>
         <h:form>
-    
+
             <f:loadBundle basename="org.apache.myfaces.examples.resource.example_messages" var="example_messages"/>
             <f:loadBundle basename="org.apache.myfaces.examples.resource.build" var="buildInfo"/>
 
@@ -31,6 +31,7 @@
                 <h:outputLink value="aliasBean.jsf" ><f:verbatim>Alias Bean</f:verbatim></h:outputLink>
                 <h:outputLink value="buffer.jsf" ><f:verbatim>Buffer</f:verbatim></h:outputLink>
                 <h:outputLink value="div.jsf" ><f:verbatim>Div</f:verbatim></h:outputLink>
+				<h:outputLink value="filteredStylesheet.jsf" ><f:verbatim>Filtered Stylesheet</f:verbatim></h:outputLink>
                 <h:outputText value="Data Table"/>
                 <h:panelGrid style="padding-left:25px">
                     <h:outputLink value="masterDetail.jsf" ><f:verbatim>Master-Detail</f:verbatim></h:outputLink>



Mime
View raw message