[jboss-cvs] jboss-seam/src/main/org/jboss/seam/web ...

Gavin King gavin.king at jboss.com
Tue Jun 19 15:02:37 EDT 2007


  User: gavin   
  Date: 07/06/19 15:02:37

  Modified:    src/main/org/jboss/seam/web     ExceptionFilter.java
                        RedirectFilter.java
  Added:       src/main/org/jboss/seam/web     Parameters.java
                        ServletContexts.java
  Log:
  repackaged built-in components
  sorry for breakage, but it had to happen eventually :-(
  
  Revision  Changes    Path
  1.11      +1 -1      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.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- ExceptionFilter.java	13 Jun 2007 15:21:08 -0000	1.10
  +++ ExceptionFilter.java	19 Jun 2007 19:02:37 -0000	1.11
  @@ -26,7 +26,7 @@
   import org.jboss.seam.annotations.Scope;
   import org.jboss.seam.annotations.Startup;
   import org.jboss.seam.contexts.Lifecycle;
  -import org.jboss.seam.core.Exceptions;
  +import org.jboss.seam.exceptions.Exceptions;
   import org.jboss.seam.log.LogProvider;
   import org.jboss.seam.log.Logging;
   import org.jboss.seam.mock.MockApplication;
  
  
  
  1.10      +3 -3      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.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- RedirectFilter.java	4 May 2007 11:31:34 -0000	1.9
  +++ RedirectFilter.java	19 Jun 2007 19:02:37 -0000	1.10
  @@ -22,8 +22,8 @@
   import org.jboss.seam.annotations.Scope;
   import org.jboss.seam.annotations.Startup;
   import org.jboss.seam.contexts.Contexts;
  -import org.jboss.seam.core.Manager;
  -import org.jboss.seam.core.Pages;
  +import org.jboss.seam.faces.JsfManager;
  +import org.jboss.seam.navigation.Pages;
   
   /**
    * Propagates the conversation context and page parameters across any 
  @@ -63,7 +63,7 @@
                     {
                        url = Pages.instance().encodePageParameters( FacesContext.getCurrentInstance(), url, viewId );
                     }
  -                  url = Manager.instance().appendConversationIdFromRedirectFilter(url, viewId);
  +                  url = JsfManager.instance().appendConversationIdFromRedirectFilter(url, viewId);
                  }
               }
               super.sendRedirect(url);
  
  
  
  1.1      date: 2007/06/19 19:02:37;  author: gavin;  state: Exp;jboss-seam/src/main/org/jboss/seam/web/Parameters.java
  
  Index: Parameters.java
  ===================================================================
  package org.jboss.seam.web;
  
  import static org.jboss.seam.annotations.Install.BUILT_IN;
  
  import java.lang.reflect.Array;
  import java.util.Collections;
  import java.util.Map;
  
  import javax.servlet.ServletRequest;
  
  import org.jboss.seam.Component;
  import org.jboss.seam.InterceptionType;
  import org.jboss.seam.ScopeType;
  import org.jboss.seam.annotations.Install;
  import org.jboss.seam.annotations.Intercept;
  import org.jboss.seam.annotations.Name;
  import org.jboss.seam.annotations.Scope;
  
  @Name("org.jboss.seam.core.parameters")
  @Intercept(InterceptionType.NEVER)
  @Scope(ScopeType.STATELESS)
  @Install(precedence=BUILT_IN)
  public class Parameters
  {
  
     protected Object convertRequestParameter(String requestParameter, Class type)
     {
        if ( String.class.equals(type) ) return requestParameter;
        throw new IllegalArgumentException("No converters available");
     }
  
     public Map<String, String[]> getRequestParameters()
     {
        ServletRequest servletRequest = ServletContexts.instance().getRequest();
        if ( servletRequest != null )
        {
           return servletRequest.getParameterMap();
        }
        return Collections.EMPTY_MAP;
     }
  
     public Object convertMultiValueRequestParameter(Map<String, String[]> requestParameters, String name, Class<?> type)
     {
        String[] array = requestParameters.get(name);
        if (array==null || array.length==0)
        {
           return null;
        }
        else
        {
           if ( type.isArray() )
           {
                 int length = Array.getLength(array);
                 Class<?> elementType = type.getComponentType();
                 Object newInstance = Array.newInstance(elementType, length);
                 for ( int i=0; i<length; i++ )
                 {
                    Object element = convertRequestParameter( (String) Array.get(array, i), elementType );
                    Array.set( newInstance, i, element );
                 }
                 return newInstance;
           }
           else
           {
              return convertRequestParameter( array[0], type );
           }
        }
     }
  
     public static Parameters instance()
     {
        return (Parameters) Component.getInstance(Parameters.class, ScopeType.STATELESS);
     }
     
  }
  
  
  
  1.1      date: 2007/06/19 19:02:37;  author: gavin;  state: Exp;jboss-seam/src/main/org/jboss/seam/web/ServletContexts.java
  
  Index: ServletContexts.java
  ===================================================================
  /*
   * JBoss, Home of Professional Open Source
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jboss.seam.web;
  
  import static org.jboss.seam.annotations.Install.BUILT_IN;
  
  import javax.servlet.http.HttpServletRequest;
  
  import org.jboss.seam.Component;
  import org.jboss.seam.InterceptionType;
  import org.jboss.seam.ScopeType;
  import org.jboss.seam.annotations.Install;
  import org.jboss.seam.annotations.Intercept;
  import org.jboss.seam.annotations.Name;
  import org.jboss.seam.annotations.Scope;
  import org.jboss.seam.contexts.Contexts;
  
  /**
   * A Seam component that binds the HttpServletRequest object
   * to the current thread.
   * 
   * @author Gavin King
   */
  @Scope(ScopeType.EVENT)
  @Name("org.jboss.seam.core.httpServletRequest")
  @Intercept(InterceptionType.NEVER)
  @Install(precedence=BUILT_IN)
  public class ServletContexts 
  {
     
     private HttpServletRequest request;
     
     public static ServletContexts instance()
     {
        if ( !Contexts.isEventContextActive() ) 
        {
           throw new IllegalStateException("no event context active");
        }
        return (ServletContexts) Component.getInstance(ServletContexts.class, ScopeType.EVENT);
     }
  
     public HttpServletRequest getRequest()
     {
        return request;
     }
  
     public void setRequest(HttpServletRequest request)
     {
        this.request = request;
     }
     
  }
  
  
  



More information about the jboss-cvs-commits mailing list