click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From take...@apache.org
Subject svn commit: r795870 - /incubator/click/trunk/tools/eclipse/org.apache.click.eclipse/src/org/apache/click/eclipse/core/facet/ClickFacetInstallDelegate.java
Date Mon, 20 Jul 2009 15:16:45 GMT
Author: takezoe
Date: Mon Jul 20 15:16:44 2009
New Revision: 795870

URL: http://svn.apache.org/viewvc?rev=795870&view=rev
Log:
[CLKE-31]Added "Use PerformanceFilter" option in the project creation wizard.

Modified:
    incubator/click/trunk/tools/eclipse/org.apache.click.eclipse/src/org/apache/click/eclipse/core/facet/ClickFacetInstallDelegate.java

Modified: incubator/click/trunk/tools/eclipse/org.apache.click.eclipse/src/org/apache/click/eclipse/core/facet/ClickFacetInstallDelegate.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/tools/eclipse/org.apache.click.eclipse/src/org/apache/click/eclipse/core/facet/ClickFacetInstallDelegate.java?rev=795870&r1=795869&r2=795870&view=diff
==============================================================================
--- incubator/click/trunk/tools/eclipse/org.apache.click.eclipse/src/org/apache/click/eclipse/core/facet/ClickFacetInstallDelegate.java
(original)
+++ incubator/click/trunk/tools/eclipse/org.apache.click.eclipse/src/org/apache/click/eclipse/core/facet/ClickFacetInstallDelegate.java
Mon Jul 20 15:16:44 2009
@@ -66,6 +66,7 @@
  * </ol>
  * @author Naoki Takezoe
  */
+@SuppressWarnings("unchecked")
 public class ClickFacetInstallDelegate implements IDelegate {
 
 	public void execute(IProject project, IProjectFacetVersion fv,
@@ -291,9 +292,40 @@
 
 			servlet = ClickUtils.createOrUpdateServletRef(webApp, config, servlet, useSpring);
 			
-			// create performance filter
+			// Add PerformanceFilter
 			if(usePerformanceFilter){
-				// TODO Not implemented.
+				Filter filter = WebapplicationFactory.eINSTANCE.createFilter();
+				filter.setName("PerformanceFilter");
+				filter.setFilterClassName("org.apache.click.extras.filter.PerformanceFilter");
+				
+				if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
+					// J2EE 1.4
+					ParamValue initParam = CommonFactory.eINSTANCE.createParamValue();
+					initParam.setName("cachable-paths");
+					initParam.setValue("/assets/*");
+					filter.getInitParamValues().add(initParam);
+				} else {
+					// J2EE 1.2 or 1.3
+					InitParam initParam = WebapplicationFactory.eINSTANCE.createInitParam();
+					initParam.setParamName("cachable-paths");
+					initParam.setParamValue("/assets/*");
+					filter.getInitParams().add(initParam);
+				}
+				
+				webApp.getFilters().add(filter);
+
+				FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();
+				mapping.setServletName(servlet.getServletName());
+				mapping.setFilter(filter);
+				webApp.getFilterMappings().add(mapping);
+				
+				String[] filterPatterns = {"*.css", "*.js", "*.gif", "*.png"};
+				for(String pattern: filterPatterns){
+					mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();
+					mapping.setFilter(filter);
+					mapping.setUrlPattern(pattern);
+					webApp.getFilterMappings().add(mapping);
+				}
 			}
 			
 			// init mappings



Mime
View raw message