View | Details | Raw Unified | Return to bug 34272
Collapse All | Expand All

(-)JspServlet.java.orig (-18 / +41 lines)
Lines 17-22 Link Here
17
package org.apache.jasper.servlet;
17
package org.apache.jasper.servlet;
18
18
19
import java.io.IOException;
19
import java.io.IOException;
20
import java.lang.reflect.Constructor;
20
import java.util.Enumeration;
21
import java.util.Enumeration;
21
22
22
import javax.servlet.ServletConfig;
23
import javax.servlet.ServletConfig;
Lines 67-85 Link Here
67
     */
68
     */
68
    public void init(ServletConfig config) throws ServletException {
69
    public void init(ServletConfig config) throws ServletException {
69
70
70
   super.init(config);
71
	super.init(config);
71
   this.config = config;
72
	this.config = config;
72
   this.context = config.getServletContext();
73
	this.context = config.getServletContext();
74
75
        // Check for a custom Options implementation
76
        String engineOptionsName =
77
           config.getInitParameter("engineOptionsClass");
78
        if (engineOptionsName != null) {
79
           // Instantiate the indicated Options implementation
80
           try {
81
              ClassLoader loader = Thread.currentThread().getContextClassLoader();
82
              Class engineOptionsClass = loader.loadClass(engineOptionsName);
83
              Class[] ctorSig = {ServletConfig.class, ServletContext.class};
84
              Constructor ctor = engineOptionsClass.getConstructor(ctorSig);
85
              Object[] args = {config, context};
86
              options = (Options) ctor.newInstance(args);
87
           } catch(Throwable e) {
88
              // Need to localize this.
89
              log.warn("Failed to load engineOptionsClass", e);
90
              // Use the default Options implementation
91
              options = new EmbeddedServletOptions(config, context);
92
           }
93
        }
94
        else {
95
           // Use the default Options implementation
96
           options = new EmbeddedServletOptions(config, context);
97
        }
73
98
74
        // Initialize the JSP Runtime Context
99
        // Initialize the JSP Runtime Context
75
        options = new EmbeddedServletOptions(config, context);
76
        rctxt = new JspRuntimeContext(context,options);
100
        rctxt = new JspRuntimeContext(context,options);
77
101
78
   if (log.isDebugEnabled()) {
102
	if (log.isDebugEnabled()) {
79
       log.debug(Localizer.getMessage("jsp.message.scratch.dir.is",
103
	    log.debug(Localizer.getMessage("jsp.message.scratch.dir.is",
80
                  options.getScratchDir().toString()));
104
					   options.getScratchDir().toString()));
81
       log.debug(Localizer.getMessage("jsp.message.dont.modify.servlets"));
105
	    log.debug(Localizer.getMessage("jsp.message.dont.modify.servlets"));
82
   }
106
	}
83
    }
107
    }
84
108
85
109
Lines 164-174 Link Here
164
        if (value.equals("true")) {
188
        if (value.equals("true")) {
165
            return (true);             // ?jsp_precompile=true
189
            return (true);             // ?jsp_precompile=true
166
        } else if (value.equals("false")) {
190
        } else if (value.equals("false")) {
167
       // Spec says if jsp_precompile=false, the request should not
191
	    // Spec says if jsp_precompile=false, the request should not
168
       // be delivered to the JSP page; the easiest way to implement
192
	    // be delivered to the JSP page; the easiest way to implement
169
       // this is to set the flag to true, and precompile the page anyway.
193
	    // this is to set the flag to true, and precompile the page anyway.
170
       // This still conforms to the spec, since it says the
194
	    // This still conforms to the spec, since it says the
171
       // precompilation request can be ignored.
195
	    // precompilation request can be ignored.
172
            return (true);             // ?jsp_precompile=false
196
            return (true);             // ?jsp_precompile=false
173
        } else {
197
        } else {
174
            throw new ServletException("Cannot have request parameter " +
198
            throw new ServletException("Cannot have request parameter " +
Lines 180-186 Link Here
180
    
204
    
181
205
182
    public void service (HttpServletRequest request, 
206
    public void service (HttpServletRequest request, 
183
             HttpServletResponse response)
207
    			 HttpServletResponse response)
184
                throws ServletException, IOException {
208
                throws ServletException, IOException {
185
209
186
        String jspUri = null;
210
        String jspUri = null;
Lines 197-203 Link Here
197
            jspUri = (String) request.getAttribute(Constants.INC_SERVLET_PATH);
221
            jspUri = (String) request.getAttribute(Constants.INC_SERVLET_PATH);
198
            if (jspUri != null) {
222
            if (jspUri != null) {
199
                /*
223
                /*
200
       * Requested JSP has been target of
224
		 * Requested JSP has been target of
201
                 * RequestDispatcher.include(). Its path is assembled from the
225
                 * RequestDispatcher.include(). Its path is assembled from the
202
                 * relevant javax.servlet.include.* request attributes
226
                 * relevant javax.servlet.include.* request attributes
203
                 */
227
                 */
Lines 220-226 Link Here
220
            }
244
            }
221
        }
245
        }
222
246
223
        if (log.isDebugEnabled()) {     
247
        if (log.isDebugEnabled()) {	    
224
            log.debug("JspEngine --> " + jspUri);
248
            log.debug("JspEngine --> " + jspUri);
225
            log.debug("\t     ServletPath: " + request.getServletPath());
249
            log.debug("\t     ServletPath: " + request.getServletPath());
226
            log.debug("\t        PathInfo: " + request.getPathInfo());
250
            log.debug("\t        PathInfo: " + request.getPathInfo());
Lines 293-296 Link Here
293
    }
317
    }
294
318
295
}
319
}
296

Return to bug 34272