[jboss-cvs] jboss-seam/src/main/org/jboss/seam/web ...
Gavin King
gavin.king at jboss.com
Tue Jul 17 09:08:58 EDT 2007
User: gavin
Date: 07/07/17 09:08:58
Modified: src/main/org/jboss/seam/web Ajax4jsfFilter.java
AuthenticationFilter.java
CharacterEncodingFilter.java ContextFilter.java
ExceptionFilter.java LoggingFilter.java
MultipartFilter.java RedirectFilter.java
Log:
redesign Ajax4JsfFilter integration
Filters no longer need @Startup
Revision Changes Path
1.5 +85 -13 jboss-seam/src/main/org/jboss/seam/web/Ajax4jsfFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Ajax4jsfFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/Ajax4jsfFilter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Ajax4jsfFilter.java 16 Jul 2007 15:15:01 -0000 1.4
+++ Ajax4jsfFilter.java 17 Jul 2007 13:08:58 -0000 1.5
@@ -4,19 +4,26 @@
import static org.jboss.seam.annotations.Install.BUILT_IN;
import java.io.IOException;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.web.Filter;
+import org.jboss.seam.util.EnumerationEnumeration;
/**
* A Seam filter component wrapper for the Ajax4JSF.
@@ -24,40 +31,60 @@
* be configured in the web: namespace. The subclass
* does the actual work.
*
+ * @see org.jboss.seam.ui.filter.Ajax4jsfFilterInstantiator
* @author Pete Muir
*
*/
@Scope(APPLICATION)
@Name("org.jboss.seam.web.ajax4jsfFilter")
- at Install(precedence = BUILT_IN, value=false)
+ at Install(precedence = BUILT_IN, dependencies="org.jboss.seam.web.ajax4jsfFilterInstantiator")
@BypassInterceptors
@Filter
- at Startup
public class Ajax4jsfFilter extends AbstractFilter
{
+ private javax.servlet.Filter delegate;
+
private String forceParser;
private String enableCache;
private String log4jInitFile;
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException
{
+ if (delegate==null)
+ {
+ chain.doFilter(servletRequest, servletResponse);
+ }
+ else
+ {
delegate.doFilter(servletRequest, servletResponse, chain);
}
-
- protected javax.servlet.Filter delegate;
+ }
@Override
public void init(FilterConfig filterConfig) throws ServletException
{
- filterConfig = initFilterConfig(filterConfig);
super.init(filterConfig);
- delegate.init(filterConfig);
- }
- protected FilterConfig initFilterConfig(FilterConfig filterConfig)
+ delegate = (javax.servlet.Filter) Component.getInstance("org.jboss.seam.web.ajax4jsfFilterInstantiator", ScopeType.STATELESS);
+ if (delegate!=null)
+ {
+ Map<String, String> parameters = new HashMap<String, String>();
+ if ( getForceParser() != null )
+ {
+ parameters.put( "forceparser", getForceParser() );
+ }
+ if ( getEnableCache() != null )
{
- return filterConfig;
+ parameters.put( "enable-cache", getEnableCache() );
+ }
+ if ( getLog4jInitFile() != null )
+ {
+ parameters.put( "log4j-init-file", getLog4jInitFile() );
+ }
+
+ delegate.init( new FilterConfigWrapper(filterConfig, parameters) );
+ }
}
public String getEnableCache()
@@ -100,4 +127,49 @@
this.log4jInitFile = log4jInitFile;
}
+ private class FilterConfigWrapper implements FilterConfig
+ {
+
+ private FilterConfig delegate;
+ private Map<String, String> parameters;
+
+ public FilterConfigWrapper(FilterConfig filterConfig, Map<String, String> parameters)
+ {
+ delegate = filterConfig;
+ this.parameters = parameters;
+ }
+
+ public String getFilterName()
+ {
+ return delegate.getFilterName();
+ }
+
+ public String getInitParameter(String name)
+ {
+ if ( parameters.containsKey(name) )
+ {
+ return parameters.get(name);
+ }
+ else
+ {
+ return delegate.getInitParameter(name);
+ }
+ }
+
+ public Enumeration getInitParameterNames()
+ {
+ Enumeration[] enumerations = {
+ delegate.getInitParameterNames(),
+ Collections.enumeration( parameters.keySet() )
+ };
+ return new EnumerationEnumeration(enumerations);
+ }
+
+ public ServletContext getServletContext()
+ {
+ return delegate.getServletContext();
+ }
+
+ }
+
}
1.10 +0 -2 jboss-seam/src/main/org/jboss/seam/web/AuthenticationFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AuthenticationFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/AuthenticationFilter.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- AuthenticationFilter.java 25 Jun 2007 22:56:50 -0000 1.9
+++ AuthenticationFilter.java 17 Jul 2007 13:08:58 -0000 1.10
@@ -20,7 +20,6 @@
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.web.Filter;
import org.jboss.seam.contexts.Context;
@@ -41,7 +40,6 @@
*
* @author Shane Bryzak
*/
- at Startup
@Scope(APPLICATION)
@Name("org.jboss.seam.web.authenticationFilter")
@Install(value = false, precedence = BUILT_IN)
1.9 +0 -2 jboss-seam/src/main/org/jboss/seam/web/CharacterEncodingFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CharacterEncodingFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/CharacterEncodingFilter.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- CharacterEncodingFilter.java 6 Jul 2007 20:35:51 -0000 1.8
+++ CharacterEncodingFilter.java 17 Jul 2007 13:08:58 -0000 1.9
@@ -12,7 +12,6 @@
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.web.Filter;
/**
@@ -23,7 +22,6 @@
* @author Gavin King
*
*/
- at Startup
@Scope(APPLICATION)
@Name("org.jboss.seam.servlet.characterEncodingFilter")
@Install(value=false, precedence = BUILT_IN)
1.13 +0 -2 jboss-seam/src/main/org/jboss/seam/web/ContextFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ContextFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/ContextFilter.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- ContextFilter.java 25 Jun 2007 22:56:50 -0000 1.12
+++ ContextFilter.java 17 Jul 2007 13:08:58 -0000 1.13
@@ -14,7 +14,6 @@
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.web.Filter;
import org.jboss.seam.servlet.ContextualHttpServletRequest;
@@ -24,7 +23,6 @@
*
* @author Gavin King
*/
- at Startup
@Scope(APPLICATION)
@Name("org.jboss.seam.web.contextFilter")
@Install(value=false, precedence = BUILT_IN)
1.22 +0 -2 jboss-seam/src/main/org/jboss/seam/web/ExceptionFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ExceptionFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/ExceptionFilter.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- ExceptionFilter.java 4 Jul 2007 18:29:39 -0000 1.21
+++ ExceptionFilter.java 17 Jul 2007 13:08:58 -0000 1.22
@@ -22,7 +22,6 @@
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.web.Filter;
import org.jboss.seam.contexts.FacesLifecycle;
@@ -44,7 +43,6 @@
*
* @author Gavin King
*/
- at Startup
@Scope(APPLICATION)
@Name("org.jboss.seam.web.exceptionFilter")
@Install(precedence = BUILT_IN, classDependencies="javax.faces.context.FacesContext")
1.2 +0 -2 jboss-seam/src/main/org/jboss/seam/web/LoggingFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LoggingFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/LoggingFilter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- LoggingFilter.java 6 Jul 2007 20:35:51 -0000 1.1
+++ LoggingFilter.java 17 Jul 2007 13:08:58 -0000 1.2
@@ -14,7 +14,6 @@
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.web.Filter;
import org.jboss.seam.security.Identity;
@@ -27,7 +26,6 @@
*
* @author Eric Trautman
*/
- at Startup
@Scope(ScopeType.APPLICATION)
@Name("org.jboss.seam.web.loggingFilter")
@BypassInterceptors
1.9 +0 -2 jboss-seam/src/main/org/jboss/seam/web/MultipartFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MultipartFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/MultipartFilter.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- MultipartFilter.java 25 Jun 2007 22:56:50 -0000 1.8
+++ MultipartFilter.java 17 Jul 2007 13:08:58 -0000 1.9
@@ -15,7 +15,6 @@
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.web.Filter;
@@ -26,7 +25,6 @@
* @author Shane Bryzak
*
*/
- at Startup
@Scope(APPLICATION)
@Name("org.jboss.seam.web.multipartFilter")
@Install(precedence = BUILT_IN)
1.17 +0 -2 jboss-seam/src/main/org/jboss/seam/web/RedirectFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: RedirectFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/RedirectFilter.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- RedirectFilter.java 29 Jun 2007 19:19:23 -0000 1.16
+++ RedirectFilter.java 17 Jul 2007 13:08:58 -0000 1.17
@@ -17,7 +17,6 @@
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.web.Filter;
import org.jboss.seam.contexts.Contexts;
@@ -32,7 +31,6 @@
*
* @author Gavin King
*/
- at Startup
@Scope(APPLICATION)
@Name("org.jboss.seam.web.redirectFilter")
@Install(precedence = BUILT_IN, classDependencies="javax.faces.context.FacesContext")
More information about the jboss-cvs-commits
mailing list