001 package railo.runtime.exp; 002 003 004 /** 005 * This Exception will be Throwed, when page Excecution will be aborted (tag abort). 006 */ 007 public class Abort extends AbortException { 008 009 public final static int SCOPE_PAGE=0; 010 public final static int SCOPE_REQUEST=1; 011 private int scope; 012 013 /** 014 * Constructor of the Class 015 */ 016 public Abort(int scope) { 017 super("Page request is aborted"); 018 this.scope=scope; 019 } 020 protected Abort(int scope, String msg) { 021 super(msg); 022 this.scope=scope; 023 } 024 public static Abort newInstance(int scope) { 025 return new Abort(scope); 026 } 027 028 public int getScope() { 029 return scope; 030 } 031 032 public static boolean isSilentAbort(Throwable t){ 033 if(t instanceof PageExceptionBox) { 034 return isSilentAbort(((PageExceptionBox)t).getPageException()); 035 } 036 return t instanceof Abort && !(t instanceof RequestTimeoutException); 037 } 038 039 public static boolean isAbort(Throwable t) { 040 if(t instanceof Abort) return true; 041 if(t instanceof PageExceptionBox) { 042 return (((PageExceptionBox)t).getPageException() instanceof Abort); 043 } 044 return false; 045 } 046 047 public static boolean isAbort(Throwable t, int scope) { 048 if(t instanceof PageExceptionBox) { 049 return isAbort(((PageExceptionBox)t).getPageException(),scope); 050 } 051 return t instanceof Abort && ((Abort) t).getScope()==scope; 052 } 053 }