}
private JspServletWrapperAdapter getJspWrapperAdapter(
SlingScriptHelper scriptHelper) throws SlingException {
JspRuntimeContext rctxt = jspRuntimeContext;
SlingScript script = scriptHelper.getScript();
String scriptName = script.getScriptResource().getPath();
JspServletWrapperAdapter wrapper = (JspServletWrapperAdapter) rctxt.getWrapper(scriptName);
if (wrapper != null) {
return wrapper;
}
synchronized (this) {
wrapper = (JspServletWrapperAdapter) rctxt.getWrapper(scriptName);
if (wrapper != null) {
return wrapper;
}
try {
wrapper = new JspServletWrapperAdapter(servletConfig, options,
scriptName, false, rctxt);
rctxt.addWrapper(scriptName, wrapper);
return wrapper;
} catch (JasperException je) {
if (je.getCause() != null) {
throw new SlingException(je.getMessage(), je.getCause());