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.exp;
020
021
022import javax.servlet.ServletException;
023
024import lucee.runtime.PageContext;
025import lucee.runtime.PageSource;
026import lucee.runtime.config.Config;
027import lucee.runtime.dump.DumpData;
028import lucee.runtime.dump.DumpProperties;
029import lucee.runtime.err.ErrorPage;
030import lucee.runtime.type.Struct;
031
032
033/**
034 * by definition a JSP Tag can only throw JSPExceptions, 
035 * for that case the PageException is a Subclass of the JSPExceptions, but when a PageException, 
036 * is escaleted to a parent page, this goes over the include method of the PageContext Object, but this can only throw ServletException.
037 * For that this class can Box a JSPException (PageException) in a ServletException (PageServletException)
038 */
039public final class PageServletException extends ServletException implements IPageException,PageExceptionBox {
040        private PageException pe;
041
042                
043        /**
044         * constructor of the class
045         * @param pe page exception to hold
046         */
047        public PageServletException(PageException pe) {
048                super(pe.getMessage());
049                this.pe=pe;
050        }
051
052        /**
053         * @see lucee.runtime.exp.PageExceptionBox#getPageException()
054         */
055        public PageException getPageException() {
056                return pe;
057        }
058
059
060        /**
061         * @see lucee.runtime.exp.IPageException#getDetail()
062         */
063        public String getDetail() {
064                return pe.getDetail();
065        }
066
067
068        /**
069         * @see lucee.runtime.exp.IPageException#getErrorCode()
070         */
071        public String getErrorCode() {
072                return pe.getErrorCode();
073        }
074
075
076        /**
077         * @see lucee.runtime.exp.IPageException#getExtendedInfo()
078         */
079        public String getExtendedInfo() {
080                return pe.getExtendedInfo();
081        }
082
083        /**
084         *
085         * @see lucee.runtime.exp.IPageException#getCatchBlock(lucee.runtime.PageContext)
086         */
087        public Struct getCatchBlock(PageContext pc) {
088                return pe.getCatchBlock(pc.getConfig());
089        }
090
091        /**
092         *
093         * @see lucee.runtime.exp.IPageException#getCatchBlock(lucee.runtime.PageContext)
094         */
095        public CatchBlock getCatchBlock(Config config) {
096                return pe.getCatchBlock(config);
097        }
098
099        /**
100         * @see lucee.runtime.exp.IPageException#getErrorBlock(PageContext pc,ErrorPage ep)
101         */
102        public Struct getErrorBlock(PageContext pc,ErrorPage ep) {
103                return pe.getErrorBlock(pc, ep);
104        }
105
106        /**
107         * @see lucee.runtime.exp.IPageException#addContext(lucee.runtime.PageSource, int, int, java.lang.StackTraceElement)
108         */
109        public void addContext(PageSource template, int line, int column, StackTraceElement ste) {
110                pe.addContext(template,line,column,ste);
111        }
112
113        /**
114         * @see lucee.runtime.dump.Dumpable#toDumpData(lucee.runtime.PageContext, int, lucee.runtime.dump.DumpProperties)
115         */
116        public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
117                return pe.toDumpData(pageContext, maxlevel,dp);
118        }
119
120        /**
121         * @see lucee.runtime.exp.IPageException#setDetail(java.lang.String)
122         */
123        public void setDetail(String detail) {
124                pe.setDetail(detail);
125        }
126
127        /**
128         * @see lucee.runtime.exp.IPageException#setErrorCode(java.lang.String)
129         */
130        public void setErrorCode(String errorCode) {
131                pe.setErrorCode(errorCode);
132        }
133
134        /**
135         * @see lucee.runtime.exp.IPageException#setExtendedInfo(java.lang.String)
136         */
137        public void setExtendedInfo(String extendedInfo) {
138                pe.setExtendedInfo(extendedInfo);
139        }
140
141        /**
142         * @see lucee.runtime.exp.IPageException#getTypeAsString()
143         */
144        public String getTypeAsString() {
145                return pe.getTypeAsString();
146        }
147
148        /**
149         * @see lucee.runtime.exp.IPageException#typeEqual(java.lang.String)
150         */
151        public boolean typeEqual(String type) {
152                return pe.typeEqual(type);
153        }
154
155        /**
156         * @see lucee.runtime.exp.IPageException#getCustomTypeAsString()
157         */
158        public String getCustomTypeAsString() {
159                return pe.getCustomTypeAsString();
160        }
161
162    /* *
163     * @see lucee.runtime.exp.IPageException#getLine()
164     * /
165    public String getLine() {
166        return pe.getLine();
167    }*/
168
169    /**
170     * @see lucee.runtime.exp.IPageException#getTracePointer()
171     */
172    public int getTracePointer() {
173        return pe.getTracePointer();
174    }
175
176    /**
177     * @see lucee.runtime.exp.IPageException#setTracePointer(int)
178     */
179    public void setTracePointer(int tracePointer) {
180        pe.setTracePointer(tracePointer);
181    }
182
183    /**
184     * @see lucee.runtime.exp.IPageException#getAdditional()
185     */
186    public Struct getAdditional() {
187        return pe.getAddional();
188    }
189
190    public Struct getAddional() {
191        return pe.getAddional();
192    }
193
194    /**
195     * @see lucee.runtime.exp.IPageException#getStackTraceAsString()
196     */
197    public String getStackTraceAsString() {
198        return pe.getStackTraceAsString();
199    }
200}