简体   繁体   中英

Communication between OSGI bundle and web application

I want to build a web application in combination with OSGI to modularize it. But I'm a little bit confused. I build an OSGI web bundle with a simple Hello Word Servlet. It works. But now, how can I create a "complete" web application and not only a Servlet?

For example I don't know how to reference to different *.html files, et cetera. In typical Java EE web apps you have the WEB-INF folder, et cetera. But not in this case. There is only the Servlet.java which generates the output.

So how can I create a "complete" web application and how can it's backend access other osgi bundles I created?

Are there any good tutorials? I find several tutorials which only create the Servlet.

Actually there are different approaches available, depending on what you want to achieve. The most favored way right now would be to use the Http Whiteboard approach. In that way you'd register your Servlets as Services and while doing so you still can receive Services in your Servlet itself. A good starting point is to look at either PAX-Web Samples or Apache Felix Whiteboard .

Please look at the OSGi enRoute tutorials which demonstrate building web applications with OSGi. http://enroute.osgi.org/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM