1 15 package tutorial.pagetypes; 16 17 import net.sf.tapestry.html.BasePage; 18 import net.sf.tapestry.IRequestCycle; 19 import net.sf.tapestry.RequestCycleException; 20 import net.sf.tapestry.StaleSessionException; 21 import net.sf.tapestry.StaleLinkException; 22 import org.apache.log4j.Logger; 23 24 import javax.swing.*; 25 26 31 public class Home extends BasePage { 32 public void niceExceptionPage(IRequestCycle cycle) throws RequestCycleException { 33 throw new RequestCycleException("This exception is intentionally thrown by the link handler", 36 this, 37 new MyException("this is an intentional runtime exception")); 38 } 39 40 public void forceStaleSession(IRequestCycle cycle) throws RequestCycleException { 41 log.warn("throwing stale session exception"); 42 throw new StaleSessionException("The session has expired", getPage()); 43 } 44 45 public void forceStaleLink(IRequestCycle cycle) throws RequestCycleException { 46 log.warn("throwing stale link exception"); 47 throw new StaleLinkException("This link is STALE!", this); 48 } 49 50 public void forceException(IRequestCycle cycle) throws RequestCycleException { 51 log.warn("throwing some other exception"); 52 throw new RequestCycleException("This exception is intentionally thrown by the link handler", 53 this, 54 new RuntimeException ("this is an intentional runtime exception")); 55 } 56 57 private static final Logger log = Logger.getLogger(Home.class); 58 } | Popular Tags |