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