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

Gavin King gavin.king at jboss.com
Sat Feb 3 21:30:48 EST 2007


  User: gavin   
  Date: 07/02/03 21:30:48

  Modified:    src/main/org/jboss/seam/mock   MockExternalContext.java
                        MockViewHandler.java
  Log:
  make redirect exception handling accept view ids
  
  Revision  Changes    Path
  1.11      +3 -3      jboss-seam/src/main/org/jboss/seam/mock/MockExternalContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MockExternalContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/mock/MockExternalContext.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- MockExternalContext.java	4 Feb 2007 01:13:19 -0000	1.10
  +++ MockExternalContext.java	4 Feb 2007 02:30:48 -0000	1.11
  @@ -29,7 +29,7 @@
   /**
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
    */
   public class MockExternalContext extends ExternalContext
   {
  @@ -119,9 +119,9 @@
      }
   
      @Override
  -   public String getInitParameter(String arg0)
  +   public String getInitParameter(String name)
      {
  -      return context.getInitParameter(arg0);
  +      return context.getInitParameter(name);
      }
   
      @Override
  
  
  
  1.5       +22 -8     jboss-seam/src/main/org/jboss/seam/mock/MockViewHandler.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MockViewHandler.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/mock/MockViewHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- MockViewHandler.java	25 Oct 2006 21:08:40 -0000	1.4
  +++ MockViewHandler.java	4 Feb 2007 02:30:48 -0000	1.5
  @@ -8,6 +8,8 @@
   import javax.faces.component.UIViewRoot;
   import javax.faces.context.FacesContext;
   
  +import org.jboss.seam.util.Strings;
  +
   public class MockViewHandler extends ViewHandler {
   
   	@Override
  @@ -29,27 +31,39 @@
   	}
   
   	@Override
  -	public String getActionURL(FacesContext ctx, String viewId) {
  -		return viewId;
  +	public String getActionURL(FacesContext ctx, String viewId) 
  +   {
  +      String contextPath = ctx.getExternalContext().getRequestContextPath();
  +      String pathInfo = ctx.getExternalContext().getRequestPathInfo();
  +      String servletPath = ctx.getExternalContext().getRequestServletPath();
  +      if ( Strings.isEmpty( pathInfo ) ) 
  +      {
  +         return contextPath + viewId.substring( 0, viewId.lastIndexOf('.') ) + 
  +               servletPath.substring( servletPath.lastIndexOf('.') );
  +      }
  +      else
  +      {
  +         return contextPath + pathInfo + viewId;
  +      }
   	}
   
   	@Override
  -	public String getResourceURL(FacesContext ctx, String url) {
  +	public String getResourceURL(FacesContext ctx, String url) 
  +   {
   		return url;
   	}
   
   	@Override
   	public void renderView(FacesContext ctx, UIViewRoot viewRoot)
  -			throws IOException, FacesException {
  -	}
  +			throws IOException, FacesException {}
   
   	@Override
  -	public UIViewRoot restoreView(FacesContext ctx, String id) {
  +	public UIViewRoot restoreView(FacesContext ctx, String id) 
  +   {
   		return null;
   	}
   
   	@Override
  -	public void writeState(FacesContext ctx) throws IOException {
  -	}
  +	public void writeState(FacesContext ctx) throws IOException {}
   
   }
  
  
  



More information about the jboss-cvs-commits mailing list