001 package railo.runtime.listener; 002 003 import javax.servlet.ServletException; 004 005 import railo.runtime.CFMLFactory; 006 import railo.runtime.PageContext; 007 import railo.runtime.PageSource; 008 import railo.runtime.exp.PageException; 009 010 /** 011 * interface for PageContext to interact with CFML 012 * 013 */ 014 public interface ApplicationListener { 015 016 public static final int MODE_CURRENT2ROOT=0; 017 public static final int MODE_CURRENT=1; 018 public static final int MODE_ROOT=2; 019 public static final String CFC_EXTENSION="cfc"; 020 021 public void setMode(int mode); 022 public int getMode(); 023 024 025 /** 026 * @return the type 027 */ 028 public String getType(); 029 030 /** 031 * @param type the type to set 032 */ 033 public void setType(String type); 034 035 /** 036 * this method will be called the application self 037 * @param pc 038 * @param requestedPage 039 * @throws PageException 040 * @throws ServletException 041 */ 042 public void onRequest(PageContext pc,PageSource requestedPage) throws PageException; 043 044 /** 045 * this method will be called when a new session starts 046 * @throws PageException 047 */ 048 public void onSessionStart(PageContext pc) throws PageException; 049 050 /** 051 * this method will be called when a session ends 052 * @param cfmlFactory 053 * @param applicationName 054 * @param cfid 055 * @throws PageException 056 */ 057 public void onSessionEnd(CFMLFactory cfmlFactory, String applicationName, String cfid) throws PageException; 058 059 /** 060 * this method will be called when a new application context starts 061 * @throws PageException 062 */ 063 public boolean onApplicationStart(PageContext pc) throws PageException; 064 065 /** 066 * this method will be called when a application scope ends 067 * @throws PageException 068 */ 069 public void onApplicationEnd(CFMLFactory cfmlFactory, String applicationName) throws PageException; 070 071 /* * 072 * this method will be called when a server starts 073 * @throws PageException 074 * / 075 public void onServerStart(PageContext pc) throws PageException; 076 077 / * * 078 * this method will be called when the server shutdown correctly (no crashes) 079 * @throws PageException 080 * / 081 public void onServerEnd() throws PageException; 082 */ 083 /** 084 * this method will be called if server has a error (exception) not throwed by a try-catch block 085 * @param pe PageExcpetion Exception that has been throwed 086 */ 087 public void onError(PageContext pc,PageException pe); 088 089 /** 090 * called after "onRequestEnd" to generate debugging output, will only be called when debugging is enabled 091 * @throws PageException 092 */ 093 public void onDebug(PageContext pc) throws PageException; 094 095 /* * 096 * will be called when server is run int a timeout 097 * / 098 public void onTimeout(PageContext pc); 099 */ 100 }