// We wrap the servlet to monitor the Jasper Runtime change event by
// other plugin.
servlet = new ServletWrapper(servlet);
ServletDelegate servletDelegate = new ServletDelegate();
servletDelegate.className = servlet.getClass().getName();
servletDelegate.loadOnSetupPriority = 1;
servletDelegate.name = alias;
Hashtable<String, String> params = new Hashtable<String, String>();
if (initparams != null && !initparams.isEmpty()) {
Enumeration keys = initparams.keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key instanceof String
&& initparams.get(key) instanceof String)
params.put((String) key, (String) initparams.get(key));
}
}
servletDelegate.parameters = params;
servletDelegate.setBundleContext(servletContext);
servletDelegate.servlet = servlet;
String nsPrefix = HelpSupportActivator.getInstance()
.getServiceNSPrefix();
if (alias.indexOf('*') == -1 && alias.indexOf('.') == -1)
alias = "/" + nsPrefix + alias
+ ServletDelegate.MULTI_MAP_SEG_SEPERATOR + "/" + nsPrefix
+ alias + "/*";
else {
// case /*.jsp map from org.eclipse.help.webapp extension point.
alias = "/" + nsPrefix + alias;
}
servletDelegate.setRawURLPatterns(alias);
servletContext.addHttpContext(context);
servletContext.getServletsInfo().add(servletDelegate);
}