0

我制作了一个 osgi Bundle,它使用嵌入式小程序注册了一个 html 页面。

插件项目结构如下:

/META-INF/MANIFEST.MF
/thesis/bot/wab/Activator.class      //BundleActivator
/thesis/bot/wab/Applet/DApplet.class //extends JApplet
/home.html

如何从 DApplet 获取 BundleContext?

4

1 回答 1

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;

 }



}
于 2013-10-18T20:59:00.297 回答