Clover coverage report - angkor - 0.4
Coverage timestamp: ti okt 15 2002 22:32:48 CEST
file stats: LOC: 50   Methods: 2
NCLOC: 30   Classes: 1
Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
RedirectValve.java 50% 50% 50% 50%
 1   
 /*
 2   
  * Angkor Web Framework
 3   
  *
 4   
  * Distributable under LGPL license.
 5   
  * See terms of license at gnu.org.
 6   
  */
 7   
 
 8   
 package com.tirsen.angkor.process;
 9   
 
 10   
 import com.tirsen.angkor.Debug;
 11   
 import com.tirsen.angkor.RenderContext;
 12   
 import org.apache.log4j.Category;
 13   
 
 14   
 /**
 15   
  * <!-- $Id: RedirectValve.java,v 1.3 2002/10/09 21:37:37 tirsen Exp $ -->
 16   
  * <!-- $Author: tirsen $ -->
 17   
  *
 18   
  * @author Jon Tirs&acute;n (tirsen@users.sourceforge.net)
 19   
  * @version $Revision: 1.3 $
 20   
  */
 21   
 public class RedirectValve implements Valve
 22   
 {
 23   
     private static final Category logger = Debug.getCategory();
 24   
 
 25   
     public static final ExecuteContext.Attribute RedirectToAttribute = new ExecuteContext.Attribute("RedirectTo");
 26   
 
 27  0
     public static void redirectTo(String url)
 28   
     {
 29  0
         logger.info("redirecting to " + url);
 30  0
         Pipeline.getCurrentExecuteContext().setAttribute(RedirectToAttribute, url);
 31   
     }
 32   
 
 33  8
     public void execute(ExecuteContext exec) throws Exception
 34   
     {
 35  8
         String redirectTo = (String) exec.getAttribute(RedirectToAttribute);
 36  8
         System.out.println("exec = " + exec);
 37  8
         System.out.println("redirectTo = " + redirectTo);
 38  8
         if (redirectTo == null)
 39   
         {
 40  8
             exec.executeNext();
 41   
         }
 42   
         else
 43   
         {
 44  0
             RenderContext context = (RenderContext) exec.getAttribute(ExecuteContext.RenderContextAttribute);
 45  0
             logger.info("sending redirect " + redirectTo);
 46  0
             context.getResponse().sendRedirect(redirectTo);
 47   
         }
 48   
     }
 49   
 }
 50