Comments (2)
Comment author: Tang Yong <[email protected]>
This is from a real and useful scene.
[Background]
An user/company is trying to build some dynamic Java EE Application using JSF 2 + CDI + OSGi, and he wants to reach the following effect or aim,
Building a host web application bundle(called "wab1") which maybe does not contain any concrete content or web module(containing some dynamic web resources).
Eg. imagining that we are building a dynamic portal site which divides the main page into different blocks(or web modules) and each block contains some concrete dynamic web resource. Then, we deploy the portal, and in the future, we or others can develop or add these blocks into the main page. However, we can not stop the jvm or application server's instance related the portal. Then, we can access these blocks's resource using uniform portal web context path. For example, if the host wab's web context path is "/wab1", the main page's url is "http://localhost:8080/wab1/faces/home.xhtml", then, while deploying another block(web application bundle) called "module1" which contains a "about.xhtml", we wish that an user can access the "about.xhtml" from wab1's context path, that is to say, accessing "http://localhost:8080/wab1/module1/faces/about.xhtml" , the most important thing is that CDI beans in module1 can be available in wab1 context not only in module1.
Such a scene is very valuable in a mission-critical application(eg. stock trading, finance...), while in the future needing to add a new function/resource(module) , we can not stop the application or related appserver's instance.
[Example Deploying Scene]
seeing https://github.com/tangyong/GlassFishOSGiJavaEESample/tree/master/glassfish.wab.sample_dynamicCDI
Note: I only put a sample to explain the scene and an implementation prototype related GlassFish is still in my private space.
Assuming the prototype related GlassFish has been available, I will try to deploy the scene by the following steps,
- asadmin deploy --type=osgi glassfish.wab.sample.core.jar
- asadmin deploy --type=osgi glassfish.wab.sample.web.war
- accessing "http://localhost:8080/wabsample/"
No any module available
- asadmin deploy --type=osgi glassfish.wab.sample.module2.war
- accessing "http://localhost:8080/wabsample/" again
Module2 should be displayed, and clicks "MODULE_2" link, and inputs any
text in inputbox, then, greeting page will be displayed correctly.
- asadmin deploy --type=osgi glassfish.wab.sample.module3.war
- accessing "http://localhost:8080/wabsample/" again
Module3 should be displayed too, and clicks "MODULE_3" link, and inputs
any text in inputbox, then, greeting page will be displayed correctly too.
[Example Explained in detailed]
I need to explain the example on some important aspects as following,
-
Host WAB(glassfish.wab.sample.web)
seeing https://github.com/tangyong/GlassFishOSGiJavaEESample/blob/master/glassfish.wab.sample_dynamicCDI/glassfish.wab.sample.web/src/main/webapp/home.xhtml<ui:repeat value="#{applicationBean.modules}" var="module"> <h:panelGrid columns="1"> <h:link outcome="#{module.moduleName}#{module.aboutPage}" value="#{module.moduleName}" /> </h:panelGrid> </ui:repeat> </h:panelGroup> <h:panelGroup layout="block" rendered="#{empty applicationBean.modules}"> No modules available. </h:panelGroup>
By JSF external context factory, we can locate other blocks(web bundles)'s resource (here is aboutPage(about.xhtml)).
-
module2(glassfish.wab.sample.module2)
seeing https://github.com/tangyong/GlassFishOSGiJavaEESample/blob/master/glassfish.wab.sample_dynamicCDI/glassfish.wab.sample.module2/src/main/webapp/about.xhtml<h:panelGrid columns="2"> <h:outputText value="Custom Message:" /> <h:inputText value="#{aboutBean.message}" /> </h:panelGrid> <h:commandButton value="OK" action="#{aboutBean.greeting}" />
Here, module2 has itself backing bean called aboutBean and uses EL to access the bean.
Well, we just wish aboutBean can be available in Host WAB's context in order to the user can access about page rightly.
[Difference between the feature and RFC 193]
-
the same point
They are all related to OSGi/CDI and all aimed to easy/simplify OSGi EE develop from JavaEE view. -
the difference point
RFC 193 focuses on OSGi Service's injection and CDI Bean's publishing by means of using CDI Extension, however, RFC 193 does not state how to integrate CDI/JSF(using EL) between host bundle and sub-modules and make sub-modules's beans/jsf pages available in host bundle context.
Once the feature can be implemented, we only use OSGi modularization instead of using OSGi Service, instead, the feature can be complementary to RFC 193 from another degree.
Wish I have stated the feature clearly.
from design.
Comment author: Tang Yong <[email protected]>
I have uploaded all related bundles into the following,
https://github.com/tangyong/GlassFishOSGiJavaEESample/tree/master/incubation
Pl. reading https://github.com/tangyong/GlassFishOSGiJavaEESample/blob/master/incubation/deploying_running in order to run the sample1 correctly.
BTW: in order to see how to resolve the issue , I also uploaded some patches for GlassFish OSGi-JavaEE.
Thanks
Tang
from design.
Related Issues (20)
- Ordering issue with RFC-217 "osgi.jaxrs.filter.base" filters HOT 2
- rfc-217 should clarify how ApplicationPath annotation can affect the base path HOT 1
- RFC-217 support for Feature, DynamicFeature, ContextResolver and other providers HOT 3
- RFC-221 Transaction control: Release resources managed by JDBCConnectionProvider HOT 4
- Typos in RFC 221 Transaction Control - Drafs HOT 1
- RFC-229 MQTT Wildcard topics HOT 2
- [Converter] Conversion of Collections HOT 2
- R7 Core draft 2017-3, 10.8.4.3 (Capability and Requirement version params) HOT 2
- Configurer specification - partial configurations and merging (R8+) HOT 2
- Feature: support Optional<T> for DS service reference type HOT 3
- [RFC 216/ PushStream] Inconsistency between JavaDoc/Spec Section 706.7.14.6 and the reference implementation HOT 1
- [RFC 216/ PushStream] Inconsistent time unit of PushbackPolicyOption.getPolicy() between JavaDoc and implementation HOT 4
- Component "outjection" for declarative services. HOT 1
- rfc-241 (Feature) - json structure and comment HOT 4
- Offer BundleContext#registerService without HashTable HOT 4
- [JPA Service] allow a JPA Service to use the (non-)jta-data-source attribute instead of the javax.persistence.jdbc.driver property HOT 1
- DS 1.4 Component Property Types: Allow meta annotations or static fields for generating constant component properties HOT 3
- DS 1.4 Component Property Type Annotations: Allow elements which only optionally create component properties HOT 1
- DS: Allow a condition towards a framework property HOT 3
- DS: Allow conditions for a class being available to the classloader HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from design.