use of org.apache.sling.scripting.jsp.jasper.compiler.JspRuntimeContext in project sling by apache.
the class JspScriptEngineFactory method renewJspRuntimeContext.
/**
* Renew the jsp runtime context.
* A new context is created, the old context is destroyed in the background
*/
private void renewJspRuntimeContext() {
final JspRuntimeContext jrc;
synchronized (this) {
jrc = this.jspRuntimeContext;
this.jspRuntimeContext = null;
}
final Thread t = new Thread() {
@Override
public void run() {
destroyJspRuntimeContext(jrc);
}
};
t.start();
}
use of org.apache.sling.scripting.jsp.jasper.compiler.JspRuntimeContext in project sling by apache.
the class JspScriptEngineFactory method getJspWrapper.
private JspServletWrapper getJspWrapper(final String scriptName, final SlingBindings bindings) throws SlingException {
JspRuntimeContext rctxt = this.getJspRuntimeContext();
JspServletWrapper wrapper = rctxt.getWrapper(scriptName);
if (wrapper != null) {
if (wrapper.isValid()) {
return wrapper;
}
synchronized (this) {
rctxt = this.getJspRuntimeContext();
wrapper = rctxt.getWrapper(scriptName);
if (wrapper != null) {
if (wrapper.isValid()) {
return wrapper;
}
this.renewJspRuntimeContext();
rctxt = this.getJspRuntimeContext();
}
}
}
wrapper = new JspServletWrapper(servletConfig, options, scriptName, false, rctxt, defaultIsSession);
wrapper = rctxt.addWrapper(scriptName, wrapper);
return wrapper;
}
use of org.apache.sling.scripting.jsp.jasper.compiler.JspRuntimeContext in project sling by apache.
the class JspcMojo method initServletContext.
// ---------- Additional Settings ------------------------------------------
private void initServletContext() throws IOException, DependencyResolutionRequiredException {
if (loader == null) {
initClassLoader();
}
context = new JspCServletContext(getLog(), new URL("file:" + uriSourceRoot.replace('\\', '/') + '/'));
tldLocationsCache = new JspCTldLocationsCache(context, true, loader);
JavaCompiler compiler = new EclipseJavaCompiler();
ClassLoaderWriter writer = new JspCClassLoaderWriter(loader, new File(outputDirectory));
IOProvider ioProvider = new JspCIOProvider(loader, compiler, writer);
rctxt = new JspRuntimeContext(context, this, ioProvider);
jspConfig = new JspConfig(context);
tagPluginManager = new TagPluginManager(context);
}
Aggregations