439390 Ensure jsp scratchdir is created same way for quickstart and non-quickstart

This commit is contained in:
Jan Bartel 2014-07-11 16:06:40 +10:00
parent 644eccab8b
commit d5c210f1c3
3 changed files with 23 additions and 15 deletions

View File

@ -570,6 +570,15 @@ public class QuickStartDescriptorGenerator
if (holder instanceof FilterHolder)
out.tag(tag + "-class",origin(md,ot + tag + "-class"),holder.getClassName());
else if (holder instanceof ServletHolder)
{
ServletHolder s = (ServletHolder)holder;
if (s.getForcedPath() != null && s.getClassName() == null)
out.tag("jsp-file",s.getForcedPath());
else
out.tag(tag + "-class",origin(md,ot + tag + "-class"),s.getClassName());
}
for (String p : holder.getInitParameters().keySet())
{
@ -584,11 +593,6 @@ public class QuickStartDescriptorGenerator
if (holder instanceof ServletHolder)
{
ServletHolder s = (ServletHolder)holder;
if (s.getForcedPath() != null && s.getClassName() == null)
out.tag("jsp-file",s.getForcedPath());
else
out.tag(tag + "-class",origin(md,ot + tag + "-class"),s.getClassName());
if (s.getInitOrder() != 0)
out.tag("load-on-startup",Integer.toString(s.getInitOrder()));

View File

@ -18,6 +18,7 @@
package org.eclipse.jetty.servlet;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
@ -595,7 +596,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
initMultiPart();
if (LOG.isDebugEnabled())
LOG.debug("Filter.init {}",_servlet);
LOG.debug("Servlet.init {}",_servlet);
_servlet.init(_config);
}
catch (UnavailableException e)
@ -651,6 +652,18 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
if (classpath != null)
setInitParameter("classpath", classpath);
}
/* ensure scratch dir */
File scratch = null;
if (getInitParameter("scratchdir") == null)
{
File tmp = (File)getServletHandler().getServletContext().getAttribute(ServletContext.TEMPDIR);
scratch = new File(tmp, "jsp");
setInitParameter("scratchdir", scratch.getAbsolutePath());
}
scratch = new File (getInitParameter("scratchdir"));
if (!scratch.exists()) scratch.mkdir();
}
/* ------------------------------------------------------------ */

View File

@ -292,15 +292,6 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
try
{
Loader.loadClass(this.getClass(), servlet_class);
//Ensure there is a scratch dir
if (holder.getInitParameter("scratchdir") == null)
{
File tmp = context.getTempDirectory();
File scratch = new File(tmp, "jsp");
if (!scratch.exists()) scratch.mkdir();
holder.setInitParameter("scratchdir", scratch.getAbsolutePath());
}
}
catch (ClassNotFoundException e)
{