Weblets 1.2 recently has been released on MavenCentral, this article is about the new features of the release and an outlook regarding the upcoming Weblets 1.3 release.
Weblets 1.2 is the first release hosted on Github after the failed transfer from java.net to Kenai and the first release under a new namespace on Maven Central.
If you want to include Weblets in your program simply now use following entries in your dependencies section.
and for the implementation use following include
As you can see the namespace was changed from java.net to com.github.weblets
This change was necessary due to the move to Github, I am sorry about any inconveniences this has caused, but having to move to Github was caused by a problem with the java.net to Kenai transition on Oracles side.
The main new Feature of the 1.2 release is subbundles. Subbundles is a usefule feature if you have multiple text file includes which you want to switch to one single include on the fly.
So how does this work.
First of all you need to define a subbundle in your weblets-config.xml
This defines a new subbundle /bundles/script.js from following resources script1.js and script2.js
Now what happens if one of the scripts is loaded is following, that script1 and script2 are concatenated and loaded within one request, the second request will get a resource already served answer.
You already get a small optimization that way without changing your code between subbundles and normal resource requests.
However by using a small utils function you can cut down on the additional requests if a bundle already is served.
Simply use following:
The utils function isResourceLoaded checks whether a resource already is loaded or not. You have this function enabled not only for jsp, but also for jspx and jsf. See the weblets documentation for further information on the utils functions / methods.
By using the utils function you can switch easily between the bundled and non bundled versions of the include.
(Note currently it is not possible to load a bundle from the given subbundle id, this limitation will be lifted in the future)
The main feature of Weblets 1.3 will be finally the connection between JSF 2.x resources and Weblets. What this means is that Weblets will provide its own Resource Handler which allows JSF to access Weblets resource bundles. Along with this feature comes also a set of utility functions which will allow the easy handling of weblets resources on JSF 2.0 level.
Here are examples on what Weblets 1.3 will try to achieve.
This is a set of different methods to generate valid weblet-JSF requests, which means all of those resources will be served by the JSF resource system.
The generated requests look like following:
As you can see the generated requests are all valid JSF2 resource requests.
Now how about Subbundles?
Subbundles also work with the JSF2 API, following example demonstrates how you can work with subbundles.
This is the exactly same example as before utilizing the JSF2 infrastructure of Weblets 1.3.
 Weblets Homepage