Hello,
I am trying to use org.eclipse.equinox.jsp.jasper.JspServlet from org.eclipse.equinox.jsp.jasper together with the HTTP Whiteboard.
Currently I am attempting to register a JspServlet instance with Declarative Services like this:
@Component(
service = Servlet.class,
property = {
HTTP_WHITEBOARD_CONTEXT_SELECT + "=(" + HTTP_WHITEBOARD_CONTEXT_NAME + "=greeter)",
HTTP_WHITEBOARD_SERVLET_PATTERN + "=/",
})
public class GreeterForm extends JspServlet {
private GreeterManager greeters;
public GreeterForm() {
super(FrameworkUtil.getBundle(GreeterForm.class), "/");
}
@Reference
public void setGreeterManager(GreeterManager greeters) {
this.greeters = greeters;
}
@Override
public void init(ServletConfig config) throws ServletException {
config.getServletContext().setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
super.init(config);
}
@Override
public void service(ServletRequest req, ServletResponse res) throws IOException, ServletException {
req.setAttribute("greeters", greeters);
super.service(req, res);
}
}
My bundle requires both a bundle that provides the JSTL API and one that provides the JSTL implementation.
There is an "/index.jsp" in the bundle root that uses some tags from JSTL.
The goal is to use OSGi services in a JSP. However the JspServlet crashes in a variety of ways, which I gave up trying to fix.
Is there a standard way to combine HTTP Whiteboard and JSPs?
Moreover does the JSP support require other parts of Tomcat? Notice for example the init() method.
Thanks in advance,
Todor