Web integration is based on a standard org.osgi.service.http.HttpService that is provided by OSGi platform. But in addition to available functions - servlets and resources registration only, the framework supports almost all web application configuration features that are available in a common J2EE application. org.sevenhats.web.api.WebConfiguration interface and org.sevenhats.web.WebConfigurationImpl its implementation are base components of Web integration module. org.sevenhats.web.api.WebConfiguration interface describes functionality for web configuration that allows to get notification after configuration changing. org.sevenhats.web.WebConfigurationImpl implements this functionality and aggregates all information about servlets, filters, and other web resources that need to be registered. It includes data similar to servlet, servlet-mapping, filter, filter-mapping and welcome-file-list web.xml deployment descriptor elements.
org.sevenhats.web.api.ServletProvider provides API for registering servlets through ServletRegistrator interface. It is under the necessity to force servlet registration code to be executed in a servlet provider's bundle.
org.sevenhats.web.api.FilterProvider interface should be implemented to register a filter. Initially, the framework registers only one system filter in the OSGi HttpService. This filter knows about other user-defined filters, and selects proper ones on each request in order to build appropriate filter chain for this request.
org.sevenhats.web.api.WelcomeFileListProvider interface should be implemented to add new welcome file information.
org.sevenhats.web.api.UrlMappingListProvider interface should be implemented to add new alias mapping information.
Web bundle exposes org.sevenhats.web.api.WebConfiguration service for other bundles.
Beans which are used in the Web Integration solution are described bellow.
1. org.sevenhats.web.WebConfigurationImpl bean implements org.sevenhats.web.beans.WebConfiguration interface.
WebConfigurationImpl bean that provides functioning of Web integration solution creates sevlets, filter servlets, and joins them (creates filter chain).
All properties of this bean are lists of other beans of the Web Integration solution.
2. org.sevenhats.web.beans.WelcomeFileProviderBean bean implements org.sevenhats.web.api.WelcomeFileListProvider interface.WelcomeFileProviderBean bean provides mapping support of a some resource (file) to a necessary resource (for example, the 'index.xhtml' file can be mapped to the 'index.jsf' file).
Class WelcomeFileRegistration contains properties resourceName and alias, where resourceName - source resource ('index.xhtml') and alias - destination resource ('index.jsp').
3. org.sevenhats.web.beans.UrlPathMappingProviderBean bean implements org.sevenhats.web.api.UrlPathMappingListProvider interface.
UrlPathMappingProviderBean bean provides mapping support of a source url part to a necessary url path (for example, '/' can be mapped to '/org/sevenhats/smoreapp').properties:
Class UrlPathMappingRegistration contains properties sourceUrlPath ('/') and destinationUrlPath ('/org/sevenhats/smoreapp').
4. org.sevenhats.web.beans.ServletProviderBean bean implements org.sevenhats.web.api.ServletProvider interface.
ServletProviderBean bean allows to create new servlets and join mapping pattrens (some resources) to these servlets.
5. org.sevenhats.web.beans.FilterProviderBean bean implements org.sevenhats.web.api.FilterProvider interface.
FilterProviderBean bean allows to map pattrens (filters) to created servlers by ServletProviderBean bean (i.e. this bean wides ServletProviderBean bean functionality) .
Configuration contains several xml files which describe beans and OSGi services for Spring FrameWork and his components (web-context.xml, web-context-osgi.xml and jsf-context.xml and jsf-context-osgi.xml configuration). It's necessary to add some . WebIntegrattion registers OSGi service WebConfiguration и org.sevenhats.web.WebConfigurationImpl bean in files (web-context.xml and web-context-osgi.xml, see bellow). Other bundles can provide loading of beans and regestering them as OSGi services (jsf-context.xml, jsf-context-osgi.xml, smokeapp-context.xml, smokeapp-context-osgi.xml). Web Integration contains several bean implementations. These beans can be exported to other bundles and noticed as OSGi services (WelcomeFileListProviderBean, UrlPathMappingListProviderBean, ServletProviderBean, FilterProviderBean). Tuning beans WelcomeFileListProviderBean and UrlPathMappingListProviderBean, it's possible to provide mapping a some Url resource to another Url resource (for example, source Url http://sevenhats.org:8080/index.xtml, destination Url http://sevenhats.org:8080/org/sevenhats/smokeapp/view/index.jsf).
Examples of xml files, that provide configuration of flow are presented bellow:
1. Configuration file (web-context.xml) describes webConfiguration bean and his properties:
2. Configuration file (web-context-osgi.xml) provides registering webConfiguration OSGi service.
3. Configuration file (jsf-context.xml) describes several beans (these beans have been imported from web bundle). Every bean description contains information, how these beans have to be config
4. Configuration file (jsf-context-osgi.xml) registes OSGi services imported from web bundle.
5. Configuration file (smokeapp-context-.xml) registers one more instance of UrlPathMappingListProviderBean.
6. Configuration file (smokeapp-context-osgi.xml) registers OSGi service.