ASF Bugzilla – Attachment 14608 Details for
Bug 34272
Patch to externalize the JspServlet Options implementation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for engineOptionsClass option patch
engineOptionsClass.patch (text/plain), 4.29 KB, created by
Scott M Stark
on 2005-04-02 08:25:37 UTC
(
hide
)
Description:
Patch for engineOptionsClass option patch
Filename:
MIME Type:
Creator:
Scott M Stark
Created:
2005-04-02 08:25:37 UTC
Size:
4.29 KB
patch
obsolete
>--- JspServlet.java.orig 2005-04-01 22:10:50.375000000 -0800 >+++ JspServlet.java 2005-04-01 22:12:50.390625000 -0800 >@@ -17,6 +17,7 @@ > package org.apache.jasper.servlet; > > import java.io.IOException; >+import java.lang.reflect.Constructor; > import java.util.Enumeration; > > import javax.servlet.ServletConfig; >@@ -67,19 +68,42 @@ > */ > public void init(ServletConfig config) throws ServletException { > >- super.init(config); >- this.config = config; >- this.context = config.getServletContext(); >+ super.init(config); >+ this.config = config; >+ this.context = config.getServletContext(); >+ >+ // Check for a custom Options implementation >+ String engineOptionsName = >+ config.getInitParameter("engineOptionsClass"); >+ if (engineOptionsName != null) { >+ // Instantiate the indicated Options implementation >+ try { >+ ClassLoader loader = Thread.currentThread().getContextClassLoader(); >+ Class engineOptionsClass = loader.loadClass(engineOptionsName); >+ Class[] ctorSig = {ServletConfig.class, ServletContext.class}; >+ Constructor ctor = engineOptionsClass.getConstructor(ctorSig); >+ Object[] args = {config, context}; >+ options = (Options) ctor.newInstance(args); >+ } catch(Throwable e) { >+ // Need to localize this. >+ log.warn("Failed to load engineOptionsClass", e); >+ // Use the default Options implementation >+ options = new EmbeddedServletOptions(config, context); >+ } >+ } >+ else { >+ // Use the default Options implementation >+ options = new EmbeddedServletOptions(config, context); >+ } > > // Initialize the JSP Runtime Context >- options = new EmbeddedServletOptions(config, context); > rctxt = new JspRuntimeContext(context,options); > >- if (log.isDebugEnabled()) { >- log.debug(Localizer.getMessage("jsp.message.scratch.dir.is", >- options.getScratchDir().toString())); >- log.debug(Localizer.getMessage("jsp.message.dont.modify.servlets")); >- } >+ if (log.isDebugEnabled()) { >+ log.debug(Localizer.getMessage("jsp.message.scratch.dir.is", >+ options.getScratchDir().toString())); >+ log.debug(Localizer.getMessage("jsp.message.dont.modify.servlets")); >+ } > } > > >@@ -164,11 +188,11 @@ > if (value.equals("true")) { > return (true); // ?jsp_precompile=true > } else if (value.equals("false")) { >- // Spec says if jsp_precompile=false, the request should not >- // be delivered to the JSP page; the easiest way to implement >- // this is to set the flag to true, and precompile the page anyway. >- // This still conforms to the spec, since it says the >- // precompilation request can be ignored. >+ // Spec says if jsp_precompile=false, the request should not >+ // be delivered to the JSP page; the easiest way to implement >+ // this is to set the flag to true, and precompile the page anyway. >+ // This still conforms to the spec, since it says the >+ // precompilation request can be ignored. > return (true); // ?jsp_precompile=false > } else { > throw new ServletException("Cannot have request parameter " + >@@ -180,7 +204,7 @@ > > > public void service (HttpServletRequest request, >- HttpServletResponse response) >+ HttpServletResponse response) > throws ServletException, IOException { > > String jspUri = null; >@@ -197,7 +221,7 @@ > jspUri = (String) request.getAttribute(Constants.INC_SERVLET_PATH); > if (jspUri != null) { > /* >- * Requested JSP has been target of >+ * Requested JSP has been target of > * RequestDispatcher.include(). Its path is assembled from the > * relevant javax.servlet.include.* request attributes > */ >@@ -220,7 +244,7 @@ > } > } > >- if (log.isDebugEnabled()) { >+ if (log.isDebugEnabled()) { > log.debug("JspEngine --> " + jspUri); > log.debug("\t ServletPath: " + request.getServletPath()); > log.debug("\t PathInfo: " + request.getPathInfo()); >@@ -293,4 +317,3 @@ > } > > } >-
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 34272
: 14608