Mais conteĂșdo relacionado Semelhante a Modular Web Applications based on OSGi - Jochen Hiller (20) Modular Web Applications based on OSGi - Jochen Hiller1. 1
Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license
Modular web applications based on OSGi
Jochen Hiller
March,18th 2008
2. Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license2
The OSGi HttpService âŠ
âąâ is lightweight
âąâ is restricted to Servlet Spec 2.1
ï·â no filters, no listeners, no welcome-files
ï·â no JSP support
âąâ requires registration at HttpService
ï·â servlets / resources
ï·â programmatically
ï·â via extension point if using Equinox
âąâ Equinox provides techniques to add missing functionality
ï·â see org.eclipse.equinox.http.helper classes from Simon Kaegi
ï·â but: complex, additional effort required
3. Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license3
A solution: âWeb Application Serviceâ
âąâThe web.xml provides all configuration information
âąâParse web.xml to âŠ
ï·âregister all servlets and filters from contributing bundle
ï·âsupport specified welcome-files
ï·âadd JSP support by default
ï·âadd all mime-types, support default mime-types
âąâMap web application to a context (alias in HttpService terms)
âąâResource lookup from contributing bundle
âąâBinds to all OSGi HttpServices
âąâThe technique: register wrapper servlets
âąâSee https://bugs.eclipse.org/bugs/show_bug.cgi?id=162132
4. Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license4
Web Application Service: The Service API
package org.eclipse.equinox.webapp.service;
public interface WebAppService {
public Object registerWebApp(
String alias,
Bundle bundle,
String bundleResourcePath,
String webXml,
Dictionary options)
throws WebContextException;
public void unregisterWebApp(Object handle);
}
5. Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license5
Web Application Service: As Extension point
<!â web application service as extension point -->
<extension
id="webapp"
name="DemoWebAppâ
point="org.eclipse.equinox.webapp.registry.webapp">
<webapp
alias="/"
path="/WebContent">
</webapp>
</extension>
6. Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license6
Web Application Service: As Extender pattern
âąâFollows Extender Pattern as proposed by OSGi
âąâBundle Listener observes all bundles coming / leaving
the platform
âąâTrigger file is /WEB-INF/web.xml
âąâContext to register is bundle symbolic name
ï·âMay be configured through /WEB-INF/osgi-web.xml
7. Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license7
What are the benefits?
âąâEasy development of JavaEE based web applications
based on OSGi
âąâSimplified deployment of existing web applications
(WAR) to OSGi
âąâOSGi can act as a lightweight web container
âąâImplementation is not dependent on OSGi runtime
implementation
8. Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license8
Demo: Deploy Tomcat examples
âąâTomcat 5.5.x example applications
ï·âservlet-examples
ï·âjsp-examples
âąâChanges required:
ï·âCreate /META-INF/MANIFEST.MF
ï·âAdded /WEB-INF/classes and /WEB-INF/lib/*.jar to
bundle classpath
ï·âMay be automated using bnd tool from Peter Kriens
9. Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license9
Limitations, Plans
âąâAnd what is missing?
ï·âTaglib support is missing
ï·âListeners not yet supported
ï·âDeclarative security not supported
ï·âImplementation under development, API may change
ï·âDocumentation, Tutorials
ï·âMore testing (e.g. compatibility with servlet bridge, other
OSGi implementations)
âąâFurther ideas:
ï·âEquinox specific framework extension to directly support
loading WAR files
ï·âAlign with Enterprise OSGi and RFC 66 activities
10. Modular web applications based on OSGi | March 18th 2008 | Short Talk #244
© Copyright 2008 Jochen Hiller; Source code in this presentation is made available under the EPL v1.0, remainder of the presentation is licensed
under Creative Commons Att. Nc Nd 2.5 license10
Questions?
âąâContact me:
ï·âjo.hiller@googlemail.com
âąâIncubator project at:
ï·âhttp://sourceforge.net/projects/sse-examples
ï·âCVS, webapp-incubator