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