webApp.getListeners().add(listener);
}
// Add PerformanceFilter
if(usePerformanceFilter){
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
String[] listOfMappings = {"*.htm"};
ClickUtils.setUpURLMappings(webApp, listOfMappings, servlet);
// welcome-file-list
ClickUtils.createOrUpdateFilelist(webApp);
// Add Cayenne Support
if(useCayenne){
Filter filter = WebapplicationFactory.eINSTANCE.createFilter();
filter.setFilterClassName(ClickUtils.CAYENNE_FILTER_CLASS);
filter.setName("DataContextFilter");
if (webApp.getJ2EEVersionID() >= J2EEVersionConstants.J2EE_1_4_ID) {
// J2EE 1.4
ParamValue initParam = CommonFactory.eINSTANCE.createParamValue();
initParam.setName("session-scope");
initParam.setValue("false");
filter.getInitParamValues().add(initParam);
} else {
// J2EE 1.2 or 1.3
InitParam initParam = WebapplicationFactory.eINSTANCE.createInitParam();
initParam.setParamName("session-scope");
initParam.setParamValue("false");
filter.getInitParams().add(initParam);
}
webApp.getFilters().add(filter);
FilterMapping mapping = WebapplicationFactory.eINSTANCE.createFilterMapping();