- disable Jetty servlet defaultUseCache (prevent double caching)

- include short memory status check for class cache in DefaultServlet
- remove obsolete Resource interface for Jetty8YaCyDefaultServlet
pull/1/head
reger 11 years ago
parent f111f30ace
commit b1dc9a6f52

@ -54,7 +54,6 @@ import org.eclipse.jetty.util.MultiPartOutputStream;
import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.QuotedStringTokenizer;
import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
@ -95,7 +94,7 @@ import org.eclipse.jetty.util.resource.ResourceFactory;
* </PRE> * </PRE>
* *
*/ */
public class Jetty8YaCyDefaultServlet extends YaCyDefaultServlet implements ResourceFactory { public class Jetty8YaCyDefaultServlet extends YaCyDefaultServlet {
private static final long serialVersionUID = 4900000000000001110L; private static final long serialVersionUID = 4900000000000001110L;

@ -154,6 +154,7 @@ public abstract class YaCyDefaultServlet extends HttpServlet {
_dirAllowed = getInitBoolean("dirAllowed", _dirAllowed); _dirAllowed = getInitBoolean("dirAllowed", _dirAllowed);
_pathInfoOnly = getInitBoolean("pathInfoOnly", _pathInfoOnly); _pathInfoOnly = getInitBoolean("pathInfoOnly", _pathInfoOnly);
Resource.setDefaultUseCaches(false); // caching is handled internally (prevent double caching)
_relativeResourceBase = getInitParameter("relativeResourceBase"); _relativeResourceBase = getInitParameter("relativeResourceBase");
String rb = getInitParameter("resourceBase"); String rb = getInitParameter("resourceBase");
@ -168,7 +169,7 @@ public abstract class YaCyDefaultServlet extends HttpServlet {
throw new UnavailableException(e.toString()); throw new UnavailableException(e.toString());
} }
} }
_etags = getInitBoolean("etags", _etags); _etags = getInitBoolean("etags", _etags);
if (ConcurrentLog.isFine("FILEHANDLER")) { if (ConcurrentLog.isFine("FILEHANDLER")) {
@ -423,9 +424,12 @@ public abstract class YaCyDefaultServlet extends HttpServlet {
serverSwitch.class}; serverSwitch.class};
m = c.getMethod("respond", params); m = c.getMethod("respond", params);
// store the method into the cache if (MemoryControl.shortStatus()) {
templateMethodCache.put(classFile, new SoftReference<Method>(m)); templateMethodCache.clear();
} else {
// store the method into the cache
templateMethodCache.put(classFile, new SoftReference<Method>(m));
}
} catch (final ClassNotFoundException e) { } catch (final ClassNotFoundException e) {
ConcurrentLog.severe("FILEHANDLER","YaCyDefaultServlet: class " + classFile + " is missing:" + e.getMessage()); ConcurrentLog.severe("FILEHANDLER","YaCyDefaultServlet: class " + classFile + " is missing:" + e.getMessage());
throw new InvocationTargetException(e, "class " + classFile + " is missing:" + e.getMessage()); throw new InvocationTargetException(e, "class " + classFile + " is missing:" + e.getMessage());

Loading…
Cancel
Save