我已经创建了一个osgi Bundle,它注册了一个带有嵌入式applet的html页面。
插件项目的结构如下:
/META-INF/MANIFEST.MF
/thesis/bot/wab/Activator.class //BundleActivator
/thesis/bot/wab/Applet/DApplet.class //extends JApplet
/home.html
如何从DApplet获取BundleContext?
答案 0 :(得分:0)
有没有办法在OSGi中运行它?像这样:
@Component(provide = Servlet.class, properties = { "alias=/someUrl" })
public class MyServer extends HttpServlet {
BundleContext bundleContext;
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("OSGi On the Job and do your stuff from here");
}
// Your Activator
@Activate
public void activate(final BundleContext aContext, Map<String, Object> props) {
this.bundleContext = aContext;
}
}