001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.runtime.listener;
020
021import java.io.IOException;
022
023import lucee.runtime.CFMLFactory;
024import lucee.runtime.PageContext;
025import lucee.runtime.PageSource;
026import lucee.runtime.exp.PageException;
027import lucee.runtime.op.Caster;
028
029public final class NoneAppListener  extends AppListenerSupport {
030
031        private int mode;
032
033        
034        @Override
035        public void onRequest(PageContext pc,PageSource requestedPage, RequestListener rl) throws PageException {
036                if(rl!=null) {
037                        requestedPage=rl.execute(pc, requestedPage);
038                        if(requestedPage==null) return;
039                }
040                pc.doInclude(requestedPage);
041        }
042
043        @Override
044        public boolean onApplicationStart(PageContext pc) throws PageException {
045                // do nothing
046                return true;
047        }
048
049        @Override
050        public void onSessionStart(PageContext pc) throws PageException {
051                // do nothing
052        }
053
054        @Override
055        public void onApplicationEnd(CFMLFactory factory, String applicationName) throws PageException {
056                // do nothing   
057        }
058
059        @Override
060        public void onSessionEnd(CFMLFactory cfmlFactory, String applicationName, String cfid) throws PageException {
061                // do nothing
062        }
063
064        @Override
065        public void onDebug(PageContext pc) throws PageException {
066                try {
067                        if(pc.getConfig().debug())pc.getDebugger().writeOut(pc);
068                } 
069                catch (IOException e) {
070                        throw Caster.toPageException(e);
071                }
072        }
073
074        @Override
075        public void onError(PageContext pc,PageException pe) {
076                pc.handlePageException(pe);
077        }
078
079        public void setMode(int mode) {
080                this.mode=mode;
081        }
082
083        @Override
084        public int getMode() {
085                return mode;
086        }
087        
088
089        @Override
090        public String getType() {
091                return "none";
092        }
093}