<?xml version="1.0"?>
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007" xmlns:atom="http://www.w3.org/2005/Atom">
   <channel>
      <title>glassfish-webtier</title>
      <description>Aggregated feed from various developers working on GlassFish webtier</description>
      <link>http://pipes.yahoo.com/pipes/pipe.info?_id=8uEA4dQi3RGq6caoTaoASA</link>
      <atom:link rel="next" href="http://pipes.yahoo.com/pipes/pipe.run?_id=8uEA4dQi3RGq6caoTaoASA&amp;_render=rss&amp;page=2"/>
      <pubDate>Thu, 01 Oct 2015 22:33:05 +0000</pubDate>
      <generator>http://pipes.yahoo.com/pipes/</generator>
      <item>
         <title>Some of the new Features in Java 8</title>
         <link>http://www.java.net/blog/driscoll/archive/2014/01/20/some-new-features-java-8</link>
         <description>&lt;p&gt;In my other blogging site, I've been using JDK 8 features to answer some sample interview questions.  Here's a quick recap:&lt;/p&gt;
&lt;p&gt;To learn the Java 8 API&amp;#8217;s, I relied on &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://weblogs.java.net/blog/cayhorstmann/archive/2013/12/06/java-8-really-impatient&quot;&gt;Cay Horstman&lt;/a&gt;&amp;#8216;s just released book, &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.amazon.com/Java-SE-8-Really-Impatient-ebook/dp/B00HSH2QT6/ref=sr_1_1?ie=UTF8&amp;amp;qid=1390236065&amp;amp;sr=8-1&amp;amp;keywords=java+se+8+for+the+really+impatient&quot;&gt;Java SE 8 for the Really Impatient&lt;/a&gt;, and I can&amp;#8217;t recommend it enough.  It&amp;#8217;s quite good.&lt;/p&gt;
&lt;p&gt;The topics I covered were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2014/01/02/java-8-streams/&quot;&gt;Finding all the Palindromes in English&lt;/a&gt; using Streams&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2014/01/02/combining-two-sorted-lists-2/&quot;&gt;Combining Sorted Lists&lt;/a&gt;, again using Streams&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2014/01/04/using-jdk-8-to-get-a-sum-of-a-list/&quot;&gt;Getting the largest sum of a sublist&lt;/a&gt;, this time using Streams, Futures, Completable Futures, parallel processing, etc.&lt;/li&gt;
&lt;li&gt;Getting Bacon Numbers Parts &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2014/01/09/bacon-numbers-with-java-8-part-1/&quot;&gt;1&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2014/01/11/bacon-numbers-with-java-8-part-2/&quot;&gt;2&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2014/01/11/bacon-numbers-with-java-8-part-3/&quot;&gt;3&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2014/01/11/bacon-numbers-with-java-8-part-4/&quot;&gt;4&lt;/a&gt; &amp;#8211; using Streams, parallel processing, method expressions, Map.merge&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See the individual posts for more.&lt;/p&gt;</description>
         <guid isPermaLink="false">900893 at http://www.java.net</guid>
         <pubDate>Mon, 20 Jan 2014 16:58:18 +0000</pubDate>
      </item>
      <item>
         <title>DSLs in Groovy</title>
         <link>http://www.java.net/blog/driscoll/archive/2012/10/20/dsls-groovy</link>
         <description>&lt;p&gt;In my other blogging site, I've covered many of the basics of creating DSLs in Groovy:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/03/12/what-is-a-dsl-anyway-why-should-you-care/&quot;&gt;What DSLs are&lt;/a&gt;, and why you'd use them&lt;/li&gt;
&lt;li&gt;A quick introduction to Groovy, &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/03/16/a-quick-introduction-to-the-groovy-language-part-1/&quot;&gt;part 1&lt;/a&gt; and &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/03/17/a-quick-introduction-to-the-groovy-language-part-2/&quot;&gt;part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/03/17/executing-groovy-programs-in-memory/&quot;&gt;Dynamically executing Groovy Programs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/04/14/groovy-bindings-or-adding-keywords-to-your-dsl/&quot;&gt;Creating binding variables&lt;/a&gt; (the nouns of your language)&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/04/22/adding-default-methods-with-a-groovy-basescript/&quot;&gt;Creating new methods&lt;/a&gt; (the verbs of your language)&lt;/li&gt;
&lt;li&gt;Delegating behavior via &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/09/29/method-dispatch-on-groovy-objects/&quot;&gt;Method Dispatch&lt;/a&gt; and &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/09/29/property-dispatch-on-groovy-objects/&quot;&gt;Property Dispatch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Check them out if this looks interesting - I'm about to tackle my first real example - implementing a Turtle Graphics control language.&lt;/p&gt;</description>
         <guid isPermaLink="false">890970 at http://www.java.net</guid>
         <pubDate>Sat, 20 Oct 2012 23:51:35 +0000</pubDate>
      </item>
      <item>
         <title>A Turtle Graphics DSL</title>
         <link>http://www.java.net/blog/driscoll/archive/2012/10/06/turtle-graphics-dsl</link>
         <description>&lt;p&gt;In my &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/10/03/napili-a-turtle-graphics-program-with-javafx-and-groovy/&quot;&gt;previous post&lt;/a&gt;, I discussed the example program that I wrote to exercise the things I've described so far. &lt;/p&gt;</description>
         <guid isPermaLink="false">891227 at http://www.java.net</guid>
         <pubDate>Sat, 06 Oct 2012 20:05:53 +0000</pubDate>
      </item>
      <item>
         <title>Napili - a Turtle Graphics program with JavaFX and Groovy</title>
         <link>http://www.java.net/blog/driscoll/archive/2012/10/03/napili-turtle-graphics-program-javafx-and-groovy</link>
         <description>&lt;p&gt;My very first programming language was &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://en.wikipedia.org/wiki/BASIC&quot;&gt;BASIC&lt;/a&gt;. &lt;/p&gt;</description>
         <guid isPermaLink="false">891136 at http://www.java.net</guid>
         <pubDate>Wed, 03 Oct 2012 19:22:34 +0000</pubDate>
      </item>
      <item>
         <title>JavaOne on the Cheap</title>
         <link>http://www.java.net/blog/driscoll/archive/2012/09/29/javaone-cheap</link>
         <description>&lt;p&gt;I won't be speaking at JavaOne this year, and didn't get a pass through work.&lt;/p&gt;
&lt;p&gt;Regular tickets to JavaOne are&lt;/p&gt;</description>
         <guid isPermaLink="false">890853 at http://www.java.net</guid>
         <pubDate>Sat, 29 Sep 2012 19:22:47 +0000</pubDate>
      </item>
      <item>
         <title>Executing Groovy Programs in-memory</title>
         <link>http://www.java.net/blog/driscoll/archive/2012/04/14/executing-groovy-programs-memory</link>
         <description>&lt;p&gt;Now that we've gone over some &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/03/16/a-quick-introduction-to-the-groovy-language-part-1/&quot;&gt;Groovy&lt;/a&gt; &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/03/17/a-quick-introduction-to-the-groovy-language-part-2/&quot;&gt;basics&lt;/a&gt;, it's time to switch back to writing in the Java language, and talk about how to run Groovy programs inside your Java programs. &lt;/p&gt;</description>
         <guid isPermaLink="false">885091 at http://www.java.net</guid>
         <pubDate>Sat, 14 Apr 2012 22:37:07 +0000</pubDate>
      </item>
      <item>
         <title>A quick introduction to the Groovy language (part 2)</title>
         <link>http://www.java.net/blog/driscoll/archive/2012/04/14/quick-introduction-groovy-language-part-2</link>
         <description>&lt;p&gt;In my &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jamesgdriscoll.wordpress.com/2012/03/16/a-quick-introduction-to-the-groovy-language-part-1/&quot;&gt;previous post&lt;/a&gt;, I started with a simple Java program (which also worked in Groovy), and slowly stripped out the cruft until I was left with the following Groovy script:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;def sayHello(name) {&lt;br /&gt;    println(&quot;Hello $name!&quot;)&lt;br /&gt;}&lt;br /&gt;def name = 'world'&lt;br /&gt;sayHello(name)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;code class=&quot;prettyprint&quot;&gt;&lt;br /&gt;&lt;/code&gt;
&lt;p&gt;Now, let's add a little change to use an array. &lt;/p&gt;</description>
         <guid isPermaLink="false">884342 at http://www.java.net</guid>
         <pubDate>Sat, 14 Apr 2012 22:35:44 +0000</pubDate>
      </item>
      <item>
         <title>A quick introduction to the Groovy language (part 1)</title>
         <link>http://www.java.net/blog/driscoll/archive/2012/03/17/quick-introduction-groovy-language-part-1</link>
         <description>&lt;p&gt;Before I start talking about using Groovy's capabilities to create a DSL (mostly in Java), let's take a few minutes to go over what Groovy is.&lt;/p&gt;
&lt;p&gt;Groovy is a general purpose scripting language which runs on the JVM, and can largely be viewed as a superset of Java. &lt;/p&gt;</description>
         <guid isPermaLink="false">884335 at http://www.java.net</guid>
         <pubDate>Sat, 17 Mar 2012 15:51:40 +0000</pubDate>
      </item>
      <item>
         <title>DSLs with Groovy JavaOne talk</title>
         <link>http://www.java.net/blog/driscoll/archive/2012/03/10/dsls-groovy-javaone-talk</link>
         <description>&lt;p&gt;I've been neglecting my blog, but just a quick note to mention that my latest talk at JavaOne, DSLs with Groovy, is &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/jimdriscoll/groovy-dsls-javaone-presentation&quot;&gt;posted up on Slideshare&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The talk's designed for someone with no significant Groovy experience (unlike most Groovy DSL talks), so if it's interesting to you, check it out.&lt;/p&gt;
&lt;p&gt;I'm hoping (but not promising) to turn the talk into a series of Blog entries in the coming weeks. &lt;/p&gt;</description>
         <guid isPermaLink="false">884174 at http://www.java.net</guid>
         <pubDate>Sat, 10 Mar 2012 21:33:30 +0000</pubDate>
      </item>
      <item>
         <title>JSF 2 And HTML5 Server Sent Events</title>
         <link>http://www.java.net/blog/rogerk/archive/2012/01/04/jsf-2-and-html5-server-sent-events-0</link>
         <description>&lt;div class=&quot;field field-type-filefield field-field-thumb-100x70&quot;&gt;
    &lt;div class=&quot;field-items&quot;&gt;
            &lt;div class=&quot;field-item odd&quot;&gt;
                    &lt;img class=&quot;imagefield imagefield-field_thumb_100x70&quot; width=&quot;125&quot; height=&quot;154&quot; alt=&quot;&quot; src=&quot;http://www.java.net/sites/default/files/rogerk/rogerkitain.jpg?1325724360&quot;/&gt;        &lt;/div&gt;
        &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Recently I had the privilege of writing an article for &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jaxenter.com/java-tech-journal/&quot;&gt;Java Tech Journal&lt;/a&gt; about using HTML5 &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.w3.org/TR/eventsource/&quot;&gt;Server Sent Events&lt;/a&gt; in a JSF 2 User Interface.&amp;nbsp; I've made that article available &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.thethirdstone.com/?p=9&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;</description>
         <guid isPermaLink="false">880052 at http://www.java.net</guid>
         <pubDate>Thu, 05 Jan 2012 01:15:03 +0000</pubDate>
      </item>
      <item>
         <title>Call for nominations for expert group members for Servlet 3.1 - JSR 340</title>
         <link>http://www.java.net/blog/mode/archive/2011/04/09/call-nominations-expert-group-members-servlet-31-jsr-340</link>
         <description>&lt;p&gt;The JSR for the next revision of Servlet specification - Servlet 3.1 is approved and we are now in the process of forming the expert group. If you would like to contribute to the development of the next version of the servlet specification, please nominate yourself and, if possible, please explain how you plan to contribute to the specification.&lt;/p&gt;
&lt;p&gt;If you would like to track the progress of the spec, and see the folowings of the JSR, the spec will now be done using java.net infrastructure. Anyone can sign up to the users mailing list of the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://servlet-spec.java.net&quot;&gt;servlet-spec.java.net&lt;/a&gt; project and will be able to see the proceedings of the expert group mailing list. Please go the JCP site &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jcp.org/en/jsr/summary?id=340&quot;&gt;here&lt;/a&gt; and click on &quot;I would iike to join this Expert Group&quot;. Please make sure that your JSPA is up-to-date. Feel free to provide feedback directly to me if you rather prefer that. &lt;/p&gt;</description>
         <guid isPermaLink="false">790213 at http://www.java.net</guid>
         <pubDate>Sat, 09 Apr 2011 06:20:50 +0000</pubDate>
      </item>
      <item>
         <title>GlassFish 3.1: using the master password and managing instances</title>
         <link>http://www.java.net/blog/carlavmott/archive/2011/03/02/glassfish-31-using-master-password-and-managing-instances</link>
         <description>&lt;p&gt;GlassFish 3.1 supports creating and managing instances on multiple hosts from a central location (the DAS).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;GlassFish 3.1 supports creating and managing instances on multiple hosts from a central location (the DAS). The server software uses SSH to communicate to the remote systems where the instances reside and &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blogs.sun.com/dipol/entry/glassfish_3_1_using_ssh&quot;&gt;Joe's blog&lt;/a&gt; contains useful information on setting up SSH in a way that GlassFish can take advantage.&amp;nbsp;&amp;nbsp;&amp;nbsp; In this blog I talk about managing those instances when the user sets the master password to something other than the default.&lt;/p&gt;
&lt;p&gt;It is recommended that users change the default master password for security reasons.&amp;nbsp; Since GlassFish never transmits the master password or associated file over the network, the user must take action on the remote hosts to allow the system to manage the instances from a central location.&amp;nbsp; Commands such as &lt;strong&gt;start-instance&lt;/strong&gt; do not have a mechanism that allows the user to enter the master password but they do look for a master password file in the agent directory of the node associated with that instance.&amp;nbsp; This means that each instance on that node uses the same master password.&amp;nbsp; We have updated the command &lt;strong&gt;change-master-password&lt;/strong&gt; so that it creates the&lt;strong&gt; master-password&lt;/strong&gt; file for a node. Commands with the --&lt;strong&gt;savemasterpassword&lt;/strong&gt; option will create or update the &lt;strong&gt;master-password&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;Let's look at an example.&amp;nbsp; In this case, I create a new domain setting the master password to 'welcome1'&amp;nbsp; and start the domain.&amp;nbsp; I create an SSH node for the remote host I plan to use for the instances. &amp;nbsp; I&amp;nbsp;then create an instance on a remote node using the command &lt;strong&gt;create-instance&lt;/strong&gt; which I run on the DAS.&amp;nbsp; &amp;nbsp; Note that I can create the instance from the DAS but I can not start it unless the master password for the instance matches the master password for the DAS.&amp;nbsp; At that point I have to go to the instance machine and run the &lt;strong&gt;change-master-password&lt;/strong&gt; command with the --&lt;strong&gt;savemasterpassword&lt;/strong&gt; option set to true so that the&lt;strong&gt; master-password &lt;/strong&gt;file is created in the node's agent directory.&amp;nbsp; Once I do that I can go to the DAS machine and manage the instance.&amp;nbsp; Since the master pasword is associated with the node I can then create additional instances from the DAS machine and start or stop them without having to go to the remote host.&amp;nbsp; I&amp;nbsp;have added the commands that need to be run below.&lt;/p&gt;
&lt;p&gt;1) Create and start a domain with the master-password set to &amp;quot;welcome1&amp;quot; using the command .&amp;nbsp; Note that I did not set a password for admin user.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;asadmin create-domain --savemasterpassword true domain2 &lt;br /&gt;
asadmin start-domain domain2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;
2) Create an SSH node&lt;/p&gt;
&lt;p&gt;&lt;em&gt; &amp;nbsp;asadmin create-node-ssh --nodehost glassfish1.sfbay.sun.com --installdir /export/glassfish3 node2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;
3) Create an instance from the DAS.&amp;nbsp; This creates the instance configuration information and the instance file system.&lt;/p&gt;
&lt;p&gt;&lt;em&gt; asadmin create-instance --node node2 ins2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;
4) At this point the instance is created but it can not be started by the &lt;strong&gt;start-instance&lt;/strong&gt; command because there is no &lt;strong&gt;master-password &lt;/strong&gt;file in the agent directory for that node. That file must exist and it must have the same password as the master password on the DAS. To create that file run the following command on the instance machine.&amp;nbsp; If I try to start the instance I get the following error:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;asadmin start-instance ins2&lt;br /&gt;
remote failure: Could not start instance ins2 on node node2 (glassfish1.sfbay.sun.com).&lt;/p&gt;
&lt;p&gt;Command failed on node node1 (glassfish1.sfbay.sun.com): The Master Password is required to start the domain.&amp;nbsp; No console, no prompting possible.&amp;nbsp; You should either create the domain with --savemasterpassword=true or provide a password file with the --passwordfile option.Command start-local-instance failed.&lt;/p&gt;
&lt;p&gt;To complete this operation run the following command locally on host glassfish1.sfbay.sun.com from the GlassFish install location /export/glassfish3:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;asadmin&amp;nbsp; start-local-instance --node node2 --sync normal ins2&lt;br /&gt;
Command start-instance failed.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Go to the instance machine (glassfish1.sfbay.sun.com in this case)&amp;nbsp; and create the master password file for node2 by typing the following command.&lt;/p&gt;
&lt;p&gt;
&lt;em&gt; asadmin change-master-password --savemasterpassword true --nodedir /export/glassfish3/glassfish/nodes node2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;
Important note: At the prompt I have to enter the old master password ('welcome1') which is what I had set when I created domain2 on the DAS. It is not the default master password 'changeit'&amp;nbsp; because the keystore was copied over when the instance was created and it is encrypted with the master password from the DAS. So the passwords are the same but since &lt;strong&gt;start-instance&lt;/strong&gt; doesn't have an option to take the master password it looks for a file called&lt;strong&gt; master-password&lt;/strong&gt; in the agent directory to access the keystores. Once that file is created, &lt;strong&gt;start-instance&lt;/strong&gt; can be run centrally (from the DAS). &lt;/p&gt;
&lt;p&gt;5) Start the instance from the DAS&lt;/p&gt;
&lt;p&gt;&lt;em&gt; asadmin start-instance ins2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;At this point you can create additional instances from the DAS and start them without going to the instance machine.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;A slightly different scenario is below.&amp;nbsp; In this case I will begin by creating a domain with the master password set to 'welcome1' as in the previous example, create an SSH node to point to the remote host where the instance will run but I will create the instance locally on the instance machine.&amp;nbsp; At some future time I want to manage the instance from the DAS so I still need the &lt;strong&gt;master-password&lt;/strong&gt; file created in the node's agent directory.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;On DAS machine: &lt;/p&gt;
&lt;p&gt;1) Create&amp;nbsp; and start a domain with the master-password set to &amp;quot;welcome1&amp;quot; using the command &lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;asadmin create-domain --savemasterpassword true domain2 &lt;br /&gt;
asadmin start-domain domain2 &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;2) Create an ssh node&amp;nbsp; pointing to the remote host where the instances will run.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;asadmin create-node-ssh --nodehost glassfish1.sfbay.sun.com --installdir /export/glassfish3 node2&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Now we move to the instance machine and create the instance locally and as long as there is no &lt;strong&gt;master-password&lt;/strong&gt; file in the node we need to create one. The command create-local-instance can do that for us. &lt;/p&gt;
&lt;p&gt;&lt;em&gt; asadmin --host DASHost create-local-instance --node node2 --savemasterpassword true insL2 &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In this case, the master password for the keystore in the instance is 'changeit' or the default. Nothing was copied over from the DAS so the password is what is on the instance machine. Again, once the file &lt;strong&gt;master-password&lt;/strong&gt; has been created with the passwordthat matches the one on the DAS, then instance insL2 can be administered from the DAS. Additional instances can be created, started and stopped from the DAS machine.&lt;/p&gt;
&lt;p&gt;If the master password is changed on the DAS then you must go to each  instance machine and run the &lt;strong&gt;change-master-password &lt;/strong&gt;command as in step 4 above to reset the master  password file for each node.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;</description>
         <guid isPermaLink="false">732398 at http://www.java.net</guid>
         <pubDate>Wed, 02 Mar 2011 20:38:25 +0000</pubDate>
      </item>
      <item>
         <title>JSF Hudson View Support</title>
         <link>http://www.java.net/blog/rogerk/archive/2011/02/14/jsf-hudson-view-support-1</link>
         <description>&lt;p&gt;Recently, we've enabled a &quot;view&quot; to simplify the monitoring of JSF automated tests through the Hudson framework. The introduction of clustering support in GlassFish has expanded our JSF automated test suite coverage. The URL for the view is:&lt;br /&gt;
&lt;br/&gt;&lt;br /&gt;
&lt;br/&gt;&lt;br /&gt;
&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://hudson.glassfish.org/view/JSF%20Mojarra/&quot; title=&quot;http://hudson.glassfish.org/view/JSF%20Mojarra/&quot;&gt;http://hudson.glassfish.org/view/JSF%20Mojarra/&lt;/a&gt;&lt;br /&gt;
&lt;br/&gt;&lt;/p&gt;
&lt;p&gt;On a side note - &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jsf.java.net&quot; title=&quot;http://jsf.java.net&quot;&gt;http://jsf.java.net&lt;/a&gt; and &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jsf-spec.java.net&quot; title=&quot;http://jsf-spec.java.net&quot;&gt;http://jsf-spec.java.net&lt;/a&gt; redirect to &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://javaserverfaces.java.net&quot; title=&quot;http://javaserverfaces.java.net&quot;&gt;http://javaserverfaces.java.net&lt;/a&gt; and &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://javaserverfaces-spec-public.java.net&quot; title=&quot;http://javaserverfaces-spec-public.java.net&quot;&gt;http://javaserverfaces-spec-public.java.net&lt;/a&gt; respectively.&lt;/p&gt;</description>
         <guid isPermaLink="false">732382 at http://www.java.net</guid>
         <pubDate>Mon, 14 Feb 2011 21:51:15 +0000</pubDate>
      </item>
      <item>
         <title>Testing JSF</title>
         <link>http://www.java.net/blog/driscoll/archive/2011/01/22/testing-jsf</link>
         <description>&lt;p&gt;It's been a while since I've blogged last (ok, it's been a year), but I recently came across a question that I have a little insight into, and I thought I'd tackle it briefly.&lt;/p&gt;
&lt;p&gt;The question was simple: &lt;/p&gt;</description>
         <guid isPermaLink="false">732342 at http://www.java.net</guid>
         <pubDate>Sat, 22 Jan 2011 21:16:33 +0000</pubDate>
      </item>
      <item>
         <title>JSR 330 Style Injection Support For JSF Managed Beans</title>
         <link>http://www.java.net/blog/rogerk/archive/2010/07/23/jsr-330-style-injection-support-jsf-managed-beans</link>
         <description>&lt;p&gt;One of the features that had been lacking in JSF has been the ability to use the JSR 330 @Inject annotation for injecting object instances into JSF managed beans.&amp;nbsp; The feature now has been enabled in GlassFish 3.1 - starting with the latest July 22 nightly builds, or a current source build.&amp;nbsp; So now, you should be able to use it in a JSF managed bean as follows:&lt;/p&gt;
&lt;table cellspacing=&quot;1&quot; cellpadding=&quot;1&quot; border=&quot;1&quot; style=&quot;width:355px;height:22px;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td bgcolor=&quot;#ffffcc&quot;&gt;
&lt;p&gt;&lt;strong&gt;import javax.inject.Inject;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;....&lt;/p&gt;
&lt;p&gt;@ManagedBean&lt;br /&gt;
            @SessionScoped&lt;br /&gt;
            &amp;nbsp;&lt;/p&gt;
&lt;p&gt;public class UserNumberBean implements Serializable {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;@Inject&lt;br /&gt;
            &amp;nbsp;&amp;nbsp;&amp;nbsp; private Count count;&lt;/strong&gt;&lt;br /&gt;
            ...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String getCount() {&lt;br /&gt;
            &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (null != &lt;strong&gt;count&lt;/strong&gt;) {&lt;br /&gt;
            &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &lt;strong&gt;count&lt;/strong&gt;.getCount();&lt;br /&gt;
            &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;
            &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &amp;quot;&amp;quot;;&lt;br /&gt;
            &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
            &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
            ...&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
         <guid isPermaLink="false">453062 at http://www.java.net</guid>
         <pubDate>Fri, 23 Jul 2010 17:58:11 +0000</pubDate>
      </item>
      <item>
         <title>GlassFish 3.1 m2 supports creating and starting instances on remote hosts.</title>
         <link>http://www.java.net/blog/carlavmott/archive/2010/06/24/glassfish-31-m2-supports-creating-and-starting-instances-remote-h</link>
         <description>&lt;p&gt;One of the main features in GlassFish 3.1 is clustering and for m2 we have added support for creating and starting instances on remote hosts.&amp;nbsp; The underying GlassFish 3.1 code uses SSH to connect to the remote hosts and introduces the concept of a node which is used by the system to deterimine where the instances will be created or started. At this time the only connection type supported is SSH.&amp;nbsp; Users now have a few new commands to manage nodes.&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;create-node-ssh&lt;/strong&gt;&amp;nbsp; creates a node that describes the hostname where the instance will run and location of GlassFish installation. &amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;delete-node-ssh&lt;/strong&gt; and&lt;strong&gt; list-nodes&lt;/strong&gt; are useful in deleting and listing nodes respectfully.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Below is a simple example of creating a cluster, creating an instance and starting the instance all from the administration host or the DAS (Domain Administration System).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;First, some assumptions about the setup for GlassFish.&amp;nbsp; For m2, users will have to install and start GlassFish on all hosts that are part of the cluster. We do not currently support installing or starting GlassFish on a remote host and this is planned for a future release.&amp;nbsp; Second, SSH needs to be setup on both hosts as it is the underlying mechanism that is used to run commands on the remote hosts.&amp;nbsp; Currently we have only tested on UNIX (MacOs, Ubuntu, and OpenSolaris) but for m3 we will be including Windows as a tested platform.&amp;nbsp; There are many blogs that talk about setting up SSH so I won't go into all details here. I found &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://pkeck.myweb.uga.edu/ssh/&quot;&gt;this blog &lt;/a&gt;useful.&amp;nbsp; To summarize how I set up the authentication key,&amp;nbsp; I used &lt;b&gt;ssh-keygen -t dsa &lt;/b&gt;to create the key file in my &lt;strong&gt;.ssh&lt;/strong&gt; dir. &amp;nbsp; Note: a limitation for m2 is that we don't support encrypted key files so you must&amp;nbsp; not set a passphrase when creating keys.&amp;nbsp; I then used &lt;strong&gt;scp&lt;/strong&gt; to copy the key file &lt;b&gt;id_dsa.pub &lt;/b&gt;to the host I want to log in to.&amp;nbsp; I put it in the &lt;span style=&quot;font-weight:bold;&quot;&gt;.s&lt;/span&gt;&lt;strong&gt;sh&lt;/strong&gt; dir and called it &lt;b&gt;authorized_keys2.&amp;nbsp;&lt;/b&gt; Also I had the same username on both systems which further simplified things.&amp;nbsp; At that point I can ssh into the remote host without supplying a password.&amp;nbsp; This is a good test to see if you are set up correctly before you try the commands below.&lt;/p&gt;
&lt;p&gt;In this example, we will create a cluster with two machines, &lt;em&gt;foo&lt;/em&gt; and &lt;em&gt;bar&lt;/em&gt;.&amp;nbsp; &lt;em&gt;foo&lt;/em&gt; will be the DAS which has all the information about the servers running in the cluster.&amp;nbsp; Recall that in this release we have introduced a new CLI command &lt;strong&gt;create-node-ssh&lt;/strong&gt; to create a node which is used to locate the host for a particular instance.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;create-node-ssh&lt;/strong&gt; has three required parameters,&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;--nodehost:&amp;nbsp; the name of the host where the instance lives&lt;/li&gt;
&lt;li&gt;--nodename:&amp;nbsp; the GlassFish installation directory&lt;/li&gt;
&lt;li&gt;--name:&amp;nbsp; name of the node being created&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;All other parameters will default to reasonable values.&amp;nbsp; We default the ssh port to 22. If no username is provided we default to the user running the command and we look for the key file in the home directory of that user.&amp;nbsp; All instances are now required to reference a node element which GlassFish uses to determine where the instance will be created or started.&amp;nbsp; This means that we have added a &lt;strong&gt;--node&lt;/strong&gt; option to the &lt;strong&gt;create-instance&lt;/strong&gt; command. As a convience we have a default node for &lt;em&gt;localhost&lt;/em&gt; so if the&amp;nbsp; node option is not specified when the instance is created a reference is automatically added&amp;nbsp; to the &lt;em&gt;localhost&lt;/em&gt; node.&amp;nbsp; The localhost node contains only a node name of localhost.&amp;nbsp; We can get the GlassFish installation directory from the server.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let's see how this works.&amp;nbsp; All commands are run on the DAS machine and as long as there is SSH access to the other host we will be able to create and start instances.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Install and start GlassFish 3.1 m2 on &lt;em&gt;foo&lt;/em&gt; and &lt;em&gt;bar&lt;/em&gt;.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On host &lt;em&gt;foo&lt;/em&gt; (the DAS) we run all the commands.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;$&lt;strong&gt;asadmin create-cluster c1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Command create-cluster executed successfully.&lt;/p&gt;
&lt;p&gt;$&lt;strong&gt;asadmin create-node-ssh --nodehost=bar --nodehome=/home/cmott/glassfishv3/glassfish nodebar&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Command create-node-ssh executed successfully.&lt;/p&gt;
&lt;p&gt;$&lt;strong&gt;asadmin list-nodes&amp;nbsp; &lt;/strong&gt;&lt;br /&gt;
localhost&lt;br /&gt;
nodebar&lt;/p&gt;
&lt;p&gt;Command list-nodes executed successfully.&lt;/p&gt;
&lt;p&gt;$&lt;strong&gt;asadmin create-instance --cluster=c1 --node=nodebar instance1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Command create-instance executed successfully.&lt;/p&gt;
&lt;p&gt;$&lt;strong&gt;asadmin create-instance --cluster=c1 instance2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Command create-instance executed successfully.&lt;/p&gt;
&lt;p&gt;$&lt;strong&gt;asadmin list-instances&lt;/strong&gt;&lt;br /&gt;
instance2 not running&lt;br /&gt;
instance1 not running&lt;/p&gt;
&lt;p&gt;Command list-instances executed successfully.&lt;/p&gt;
&lt;p&gt;$&lt;strong&gt;asadmin start-cluster c1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;strong&gt;&lt;br /&gt;
&lt;/strong&gt;&lt;/strong&gt;Command&lt;strong&gt; &lt;/strong&gt;start-cluster executed successfully.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;$asadmin list-instances&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;instance2 running&lt;br /&gt;
instance1 running&lt;/p&gt;
&lt;p&gt;
Command list-instances executed successfully.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Notice that when creating instance2 I did not specify a node and so the default node &lt;em&gt;lcoalhost&lt;/em&gt; is used.&amp;nbsp; In a future release of GlassFish, &lt;strong&gt;create-node-ssh &lt;/strong&gt;will test if a connection can be made to the remote host when the node is created.&amp;nbsp; If not reachable the user can create the node if the &lt;strong&gt;--force&lt;/strong&gt; option is set to &lt;strong&gt;true&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
         <guid isPermaLink="false">435685 at http://www.java.net</guid>
         <pubDate>Thu, 24 Jun 2010 16:46:06 +0000</pubDate>
      </item>
      <item>
         <title>JSF 2 / HTML 5 Jazoon 2010 Slides Posted</title>
         <link>http://www.java.net/blog/rogerk/archive/2010/06/09/jsf-2-html-5-jazoon-2010-slides-posted</link>
         <description>&lt;p&gt;My slides for &amp;quot;Exploring HTML5 With JavaServer Faces 2.0&amp;quot; slides are  available at Slideshare: Available at: &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/rkitain/jsf2-html5jazoon&quot; title=&quot;http://www.slideshare.net/rkitain/jsf2-html5jazoon&quot;&gt;http://www.slideshare.net/rkitain/jsf2-html5jazoon&lt;/a&gt;&lt;/p&gt;</description>
         <guid isPermaLink="false">427935 at http://www.java.net</guid>
         <pubDate>Wed, 09 Jun 2010 15:06:10 +0000</pubDate>
      </item>
      <item>
         <title>Testing HTML5 Feature Availability In Browsers</title>
         <link>http://www.java.net/blog/rogerk/archive/2010/05/25/testing-html5-feature-availability-browsers</link>
         <description>&lt;p&gt;The ongoing &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://dev.w3.org/html5/spec/Overview.html&quot;&gt;HTML5 specification&lt;/a&gt; offers many features to promote a &amp;quot;rich&amp;quot;   web user experience.&amp;nbsp; If you've worked wth HTML5, you know that some   features are available in some browsers and not available in others.&amp;nbsp;   Here's a handy tool to tell you the HTML5 features that are available in   your favorite browser.&amp;nbsp; All you need to do is fire up a browser and  visit: &lt;a rel=&quot;nofollow&quot; title=&quot;http://html5test.com&quot; target=&quot;_blank&quot; href=&quot;http://html5test.com/&quot;&gt;http://html5test.com&lt;/a&gt;  .&amp;nbsp; With this,  you'll see a nice breakdown of the features that are  available in the  current browser version.&amp;nbsp; It will also tell you, the  strengh of support  for each feature.&amp;nbsp; For example, for the current  version of Firefox I'm  using (3.6.3), it says it has a total score of  101 out of 160.&amp;nbsp; Here's a breakdown for each of the current browsers I'm using:&lt;/p&gt;
&lt;table cellspacing=&quot;1&quot; cellpadding=&quot;1&quot; border=&quot;1&quot; width=&quot;200&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Firefox 3.6.3&lt;/td&gt;
&lt;td&gt;101/160&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safari 4.0.3&lt;/td&gt;
&lt;td&gt;115/160&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Opera 10.10&lt;/td&gt;
&lt;td&gt;&amp;nbsp; 38/160&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chrome 5.0.375.55 beta&lt;/td&gt;
&lt;td&gt;142/160&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Of course if you really like an HTML5 feaure that is not available in your favorite browser, you can always check the &amp;quot;development&amp;quot; versions for the browser - as HTML5 support is still a work in progress.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
         <guid isPermaLink="false">418723 at http://www.java.net</guid>
         <pubDate>Tue, 25 May 2010 09:55:22 +0000</pubDate>
      </item>
      <item>
         <title>Context And Dependency Injection (JSR 299) And Servlets</title>
         <link>http://www.java.net/blog/rogerk/archive/2009/09/09/context-and-dependency-injection-jsr-299-and-servlets</link>
         <description>&lt;p&gt;I've had questions about how to inject Web Beans into servlets and whether that is supported.&amp;nbsp; In this entry I'll outline a method of accomplishing just that.&lt;br /&gt;
This is a simple login application that communicates to a servlet using Ajax calls from a JSP view.&amp;nbsp; I'm not going to focus on the view or the protocol (Ajax) that&amp;nbsp; is used to communicate with the servlet.&amp;nbsp; If you are interested in that, you can check out the source (instructions at the end of this post).&amp;nbsp; I'm going to focus on the servlet code and the supporting classes for the application.&amp;nbsp; The application just prompts for a user name / pasword, and pressing the submit button sends those values to a servlet.&amp;nbsp; First, let's take a look at some of the supporting code for the application:&lt;/p&gt;
&lt;h3&gt;Listing 1: Login Credentials&lt;/h3&gt;
&lt;table cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot; style=&quot;text-align:left;width:1277px;background-color:rgb(240, 248, 255);height:486px;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align:top;background-color:rgb(240, 248, 255);&quot;&gt;
&lt;ol&gt;
&lt;li&gt;package webbeansservlet;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;import javax.enterprise.context.RequestScoped;&lt;/li&gt;
&lt;li&gt;import javax.enterprise.inject.Default;&lt;/li&gt;
&lt;li&gt;import javax.inject.Named;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;/**&lt;/li&gt;
&lt;li&gt;&amp;nbsp;* This is just a simple container class Web Bean for the username &lt;/li&gt;
&lt;li&gt;&amp;nbsp;*&amp;nbsp; and password entry values.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;*/&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;@Named&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;@RequestScoped&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;@Default&lt;/li&gt;
&lt;li&gt;public class Credentials {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private String username = null;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private String password = null;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String getUsername() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return username;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void setUsername(String username) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.username = username;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String getPassword() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return password;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void setPassword(String password) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.password = password;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Line 11: The name of this Web Bean will be &lt;span style=&quot;font-style:italic;&quot;&gt;credentials&lt;/span&gt; since we don't supply an argument to the Named annotation.&lt;/li&gt;
&lt;li&gt;Line 12: For the purposes of this simple application this Web Bean scope will be for the current request.&lt;/li&gt;
&lt;li&gt;Line 13: Specifies the default qualifier type for this Web Bean.&amp;nbsp; Note that you should not have to specify this if it's the only qualifier type being used.&amp;nbsp; In future implementations of Web Beans this should be fixed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Listing 2: Login&lt;/h3&gt;
&lt;table cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot; style=&quot;text-align:left;width:1277px;background-color:rgb(240, 248, 255);height:486px;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align:top;background-color:rgb(240, 248, 255);&quot;&gt;
&lt;ol&gt;
&lt;li&gt;package webbeansservlet;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;import java.io.Serializable;&lt;/li&gt;
&lt;li&gt;import javax.enterprise.context.SessionScoped;&lt;/li&gt;
&lt;li&gt;import javax.enterprise.inject.Default;&lt;/li&gt;
&lt;li&gt;import javax.inject.Inject;&lt;/li&gt;
&lt;li&gt;import javax.inject.Named;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;/**&lt;/li&gt;
&lt;li&gt;&amp;nbsp;* A simple Web Bean that performs a login operation with user's&lt;/li&gt;
&lt;li&gt;&amp;nbsp;* credentials.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;*/&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;@Named&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;@SessionScoped&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;@Default&lt;/li&gt;
&lt;li&gt;public class Login implements Serializable {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;@Inject Credentials credentials;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private boolean loggedIn = false;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /**&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * This is where you could potentially access a database.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void login() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;credentials&lt;/span&gt;.getUsername() != null &amp;amp;&amp;amp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;credentials&lt;/span&gt;.getUsername().trim().length() &amp;gt; 0) &amp;amp;&amp;amp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;credentials&lt;/span&gt;.getPassword() != null &amp;amp;&amp;amp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;credentials&lt;/span&gt;.getPassword().trim().length() &amp;gt; 0)) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; loggedIn = true;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public boolean isLoggedIn() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return loggedIn;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul&gt;
&lt;li&gt;Line 13: The name of this Web Bean will be &lt;span style=&quot;font-style:italic;&quot;&gt;login&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Line 14: This Web Bean will exist for the session&lt;/li&gt;
&lt;li&gt;Line 15: Specifies the default qualifier type for this Web Bean.&lt;/li&gt;
&lt;li&gt;Line 18: We're injecting an instance of &lt;span style=&quot;font-style:italic;&quot;&gt;Credentials &lt;/span&gt;so we can check the validity of the user name and password entries&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Listing 3: Login Servlet&lt;/h3&gt;
&lt;table cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot; style=&quot;text-align:left;width:1277px;background-color:rgb(240, 248, 255);height:486px;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align:top;background-color:rgb(240, 248, 255);&quot;&gt;
&lt;ol&gt;
&lt;li&gt;package webbeansservlet;&lt;/li&gt;
&lt;li&gt;import java.io.IOException;&lt;/li&gt;
&lt;li&gt;import java.io.PrintWriter;&lt;/li&gt;
&lt;li&gt;import javax.enterprise.inject.spi.BeanManager;&lt;/li&gt;
&lt;li&gt;import javax.inject.Inject;&lt;/li&gt;
&lt;li&gt;import javax.servlet.ServletException;&lt;/li&gt;
&lt;li&gt;import javax.servlet.annotation.WebServlet;&lt;/li&gt;
&lt;li&gt;import javax.servlet.http.HttpServlet;&lt;/li&gt;
&lt;li&gt;import javax.servlet.http.HttpServletRequest;&lt;/li&gt;
&lt;li&gt;import javax.servlet.http.HttpServletResponse;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;/**&lt;/li&gt;
&lt;li&gt;&amp;nbsp;* This Servlet class demonstrates Web Beans injection.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;*/&lt;/li&gt;
&lt;li&gt;@WebServlet(name=&amp;quot;LoginServlet&amp;quot;, urlPatterns={&amp;quot;/LoginServlet&amp;quot;})&lt;/li&gt;
&lt;li&gt;public class LoginServlet extends HttpServlet {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Inject Web Beans Bean Manager.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;@Inject BeanManager m;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Inject The Credentials Web Bean.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;@Inject Credentials credentials;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Inject the Login Web Bean.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;@Inject Login login;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /**&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Processes requests for both HTTP &amp;lt;code&amp;gt;GET&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;POST&amp;lt;/code&amp;gt; methods.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * @param request servlet request&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * @param response servlet response&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * @throws ServletException if a servlet-specific error occurs&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * @throws IOException if an I/O error occurs&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void processRequest(HttpServletRequest request, HttpServletResponse response)&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throws ServletException, IOException {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; response.setContentType(&amp;quot;text/html;charset=UTF-8&amp;quot;);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PrintWriter out = response.getWriter();&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;credentials.setUsername&lt;/span&gt;(request.getParameter(&amp;quot;username&amp;quot;));&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;credentials.setPassword&lt;/span&gt;(request.getParameter(&amp;quot;password&amp;quot;));&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;login.login();&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;login.isLoggedIn()&lt;/span&gt;) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out.println(&amp;quot;Successfully Logged In As: &amp;quot; + &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;credentials.getUsername()&lt;/span&gt;);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out.println(&amp;quot;Login Failed: Check username and/or password.&amp;quot;);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } finally {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out.close();&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp; .......&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul&gt;
&lt;li&gt;Line 15: New for Servlet 3.0 - eliminates servlet entry in web.xml! Not relevant to this example, but worth mentioning.&lt;/li&gt;
&lt;li&gt;Line 19: The Web Beans &lt;span style=&quot;font-style:italic;&quot;&gt;Bean Manager &lt;/span&gt;can also be injected.&amp;nbsp; The &lt;span style=&quot;font-style:italic;&quot;&gt;Bean Manager &lt;/span&gt;api provides some useful methods for interrogating portions of a Web Beans application.&lt;/li&gt;
&lt;li&gt;Line 22: The &lt;span style=&quot;font-style:italic;&quot;&gt;Credentials &lt;/span&gt;Web Bean is injected making it available to the servlet.&lt;/li&gt;
&lt;li&gt;Line 38: Now we can access the &lt;span style=&quot;font-style:italic;&quot;&gt;Credentials &lt;/span&gt;Web Bean.&lt;/li&gt;
&lt;li&gt;Line 40: We can also use the injected &lt;span style=&quot;font-style:italic;&quot;&gt;Login &lt;/span&gt;Web Bean&lt;span style=&quot;font-style:italic;&quot;&gt; &lt;/span&gt;instance.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is just one example of Web Bean injection into a servlet.&amp;nbsp; There are more areas in the JavaEE6 platform that can be used as Web Bean injection points - topics that will certainly be covered in future posts.&amp;nbsp; The sample for this blog can be found under the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://glassfish-samples.dev.java.net/&quot;&gt;glassfish-samples&lt;/a&gt; project.&amp;nbsp; You can check out the code following these &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://glassfish-samples.dev.java.net/source/browse/glassfish-samples/&quot;&gt;instructions&lt;/a&gt;.&amp;nbsp; Once the workspace is checked out, you can find this sample under &lt;span style=&quot;font-style:italic;&quot;&gt;glassfish-samples/ws/javaee6/webbeans/webbeans-servlet&lt;/span&gt;.&amp;nbsp; You can find documentation for the sample under &lt;span style=&quot;font-style:italic;&quot;&gt;glassfish-samples/ws/javaee6/webbeans/webbeans-servlet/docs.&amp;nbsp; &lt;/span&gt;As with all the Web Beans samples now, you should run with GlassFish V3 - any build after September 2 2009.&lt;/p&gt;</description>
         <guid isPermaLink="false">265331 at http://www.java.net</guid>
         <pubDate>Wed, 09 Sep 2009 14:34:21 +0000</pubDate>
      </item>
      <item>
         <title>Contexts and Dependency Injection (JSR 299)  and GlassFish</title>
         <link>http://www.java.net/blog/rogerk/archive/2009/09/04/contexts-and-dependency-injection-jsr-299-and-glassfish</link>
         <description>&lt;p&gt;Version 1.0.0.PREVIEW3 of Web Beans (the implementation for &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jcp.org/en/jsr/summary?id=299&quot;&gt;JSR 299&lt;/a&gt; Contexts and Dependency Injection For Java EE) now uses the annotations from &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jcp.org/en/jsr/summary?id=330&quot;&gt;JSR 330&lt;/a&gt; (Dependency Injection For Java) and it is available in GlassFish V3.&amp;nbsp; &lt;br /&gt;
In this entry, we'll look at a simple JSF 2 application that uses Web Beans and the JSR 330 annotations. There are other features available in this release of Web Beans which will be discussed in subsequent blog entries. This application is a simple &amp;quot;guess number&amp;quot; application which I'm sure we are probably all familiar with by now.&amp;nbsp; Let's start by taking a look at the application's UI markup.&lt;/p&gt;
&lt;h3&gt;Listing 1: User Interface Markup&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;table cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot; style=&quot;text-align:left;width:1277px;background-color:rgb(240, 248, 255);height:518px;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align:top;background-color:rgb(240, 248, 255);&quot;&gt;
&lt;ol&gt;
&lt;li&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:ui=&amp;quot;http://java.sun.com/jsf/facelets&amp;quot;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:h=&amp;quot;http://java.sun.com/jsf/html&amp;quot;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:f=&amp;quot;http://java.sun.com/jsf/core&amp;quot;&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:head&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;meta http-equiv=&amp;quot;Content-Type&amp;quot; content=&amp;quot;text/html; charset=iso-8859-1&amp;quot; /&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;JSF 2.0 Web Beans Example&amp;lt;/title&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h:head&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:body&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:form id=&amp;quot;NumberGuessMain&amp;quot;&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:panelGrid styleClass=&amp;quot;title-panel&amp;quot;&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:outputText value=&amp;quot;Guess Number&amp;quot; styleClass=&amp;quot;title-panel-text&amp;quot;/&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:outputText value=&amp;quot;Powered By JavaServer Faces 2.0 and Web Beans&amp;quot; styleClass=&amp;quot;title-panel-subtext&amp;quot;/&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h:panelGrid&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div style=&amp;quot;color: black; font-size: 24px;&amp;quot;&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I'm thinking of a number between &amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.smallest}&lt;/span&gt;&amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.biggest}&lt;/span&gt;&amp;lt;/span&amp;gt;. You have &amp;lt;span style=&amp;quot;color: blue&amp;quot;&amp;gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.remainingGuesses}&lt;/span&gt;&amp;lt;/span&amp;gt; guesses.&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:panelGrid border=&amp;quot;1&amp;quot; columns=&amp;quot;5&amp;quot; style=&amp;quot;font-size: 18px;&amp;quot;&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Number:&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:inputText id=&amp;quot;inputGuess&amp;quot; value=&amp;quot;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.guess}&lt;/span&gt;&amp;quot; required=&amp;quot;true&amp;quot; size=&amp;quot;3&amp;quot; disabled=&amp;quot;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.number eq &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.guess}&lt;/span&gt;&amp;quot; validator=&amp;quot;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.validateNumberRange}&lt;/span&gt;&amp;quot;/&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:commandButton id=&amp;quot;GuessButton&amp;quot; value=&amp;quot;Guess&amp;quot; action=&amp;quot;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.check}&lt;/span&gt;&amp;quot; disabled=&amp;quot;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.number eq &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.guess}&lt;/span&gt;&amp;quot;/&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:commandButton id=&amp;quot;RestartButton&amp;quot; value=&amp;quot;Reset&amp;quot; action=&amp;quot;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.reset}&lt;/span&gt;&amp;quot; immediate=&amp;quot;true&amp;quot; /&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:outputText id=&amp;quot;Higher&amp;quot; value=&amp;quot;Higher!&amp;quot; rendered=&amp;quot;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.number gt &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.guess and &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.guess ne 0}&amp;quot;&lt;/span&gt; style=&amp;quot;color: red&amp;quot;/&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:outputText id=&amp;quot;Lower&amp;quot; value=&amp;quot;Lower!&amp;quot; rendered=&amp;quot;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;#{&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.number lt &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.guess and &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;game&lt;/span&gt;.guess ne 0}&amp;quot;&lt;/span&gt; style=&amp;quot;color: red&amp;quot;/&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h:panelGrid&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div style=&amp;quot;color: red; font-size: 14px;&amp;quot;&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:messages id=&amp;quot;messages&amp;quot; globalOnly=&amp;quot;false&amp;quot;/&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;h:outputStylesheet name=&amp;quot;stylesheet.css&amp;quot; /&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h:form&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/h:body&amp;gt;&lt;/li&gt;
&lt;li&gt;&amp;lt;/html&amp;gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
Everything on this page is really just standard JSF 2.0 view markup.&amp;nbsp; I've emphasized&amp;nbsp; the&amp;nbsp; Expression Language&amp;nbsp; (EL) portions of the view, especially &lt;span style=&quot;font-style:italic;&quot;&gt;game &lt;/span&gt;because it refers to a contextual bean instance also known as a &lt;span style=&quot;font-style:italic;&quot;&gt;Web Bean&lt;/span&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Line 17: Binding to Web Bean properties&lt;/li&gt;
&lt;li&gt;Line 21: Binding to Web Bean properties and validation method&lt;/li&gt;
&lt;li&gt;Line 22, 23: Binding to Web Bean action method&lt;/li&gt;
&lt;li&gt;Line 24, 25: Binding to Web Bean properties&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As you can see, in JSF, binding to a Web Bean is no different than binding to a typical managed bean.&lt;/p&gt;
&lt;h2&gt;Supporting Classes And Annotations For The Applicaton&lt;/h2&gt;
&lt;p&gt;Let's take a look at some of the utility classes for the application, namely the classes that are used to generate a random number and some of the supporting annotations.&lt;/p&gt;
&lt;h3&gt;Listing 2: The &amp;quot;Random&amp;quot; Annotation&lt;/h3&gt;
&lt;table cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot; style=&quot;text-align:left;width:100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align:top;background-color:rgb(240, 248, 255);&quot;&gt;
&lt;ol&gt;
&lt;li&gt;package webbeansguess;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.ElementType.FIELD;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.ElementType.METHOD;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.ElementType.PARAMETER;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.ElementType.TYPE;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.RetentionPolicy.RUNTIME;&lt;/li&gt;
&lt;li&gt;import java.lang.annotation.Documented;&lt;/li&gt;
&lt;li&gt;import java.lang.annotation.Retention;&lt;/li&gt;
&lt;li style=&quot;color:rgb(255, 0, 0);&quot;&gt;import javax.inject.Qualifier;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;@Target( { TYPE, METHOD, PARAMETER, FIELD })&lt;/li&gt;
&lt;li&gt;@Retention(RUNTIME)&lt;/li&gt;
&lt;li&gt;@Documented&lt;/li&gt;
&lt;li style=&quot;color:rgb(255, 0, 0);&quot;&gt;@Qualifier&lt;/li&gt;
&lt;li&gt;public @interface Random {&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
The JSR 330 &lt;span style=&quot;font-style:italic;&quot;&gt;@Qualifier &lt;/span&gt;annotation is used to make &lt;span style=&quot;font-style:italic;&quot;&gt;Random &lt;/span&gt;a binding type.&amp;nbsp;&amp;nbsp; This will allow us to inject a random number into the application.&lt;/p&gt;
&lt;h3&gt;Listing 3: The &amp;quot;MaxNumber&amp;quot; Annotation&lt;/h3&gt;
&lt;table cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot; style=&quot;text-align:left;width:100%;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align:top;background-color:rgb(240, 248, 255);&quot;&gt;
&lt;ol&gt;
&lt;li&gt;package webbeansguess;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.ElementType.FIELD;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.ElementType.METHOD;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.ElementType.PARAMETER;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.ElementType.TYPE;&lt;/li&gt;
&lt;li&gt;import static java.lang.annotation.RetentionPolicy.RUNTIME;&lt;/li&gt;
&lt;li&gt;import java.lang.annotation.Documented;&lt;/li&gt;
&lt;li&gt;import java.lang.annotation.Retention;&lt;/li&gt;
&lt;li&gt;import java.lang.annotation.Target;&lt;/li&gt;
&lt;li style=&quot;color:rgb(255, 0, 0);&quot;&gt;import javax.inject.Qualifier;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;@Target( { TYPE, METHOD, PARAMETER, FIELD })&lt;/li&gt;
&lt;li&gt;@Retention(RUNTIME)&lt;/li&gt;
&lt;li&gt;@Documented&lt;/li&gt;
&lt;li style=&quot;color:rgb(255, 0, 0);&quot;&gt;@Qualifier&lt;/li&gt;
&lt;li&gt;public @interface MaxNumber {&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;Likewise, the &lt;span style=&quot;font-style:italic;&quot;&gt;@Qualifier &lt;/span&gt;annotation is used to make &lt;span style=&quot;font-style:italic;&quot;&gt;MaxNumber &lt;/span&gt;a binding type that will allow us to inject the maximum number allowed (for a guess) in the application.&lt;/p&gt;
&lt;h3&gt;Listing 4: The &amp;quot;Generator&amp;quot; Class&lt;/h3&gt;
&lt;table cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot; style=&quot;text-align:left;width:100%;background-color:rgb(240, 248, 255);&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align:top;&quot;&gt;
&lt;ol&gt;
&lt;li&gt;package webbeansguess;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;import java.io.Serializable;&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;import javax.enterprise.context.ApplicationScoped;&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;import javax.enterprise.inject.Produces;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;@ApplicationScoped&lt;/li&gt;
&lt;li&gt;public class Generator implements Serializable {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static final long serialVersionUID = -7213673465118041882L;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp; private java.util.Random random = new java.util.Random( System.currentTimeMillis() );&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private int maxNumber = 100;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; java.util.Random getRandom() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return random;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt; @Produces @Random&lt;/span&gt; int next() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; return getRandom().nextInt(maxNumber);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;@Produces @MaxNumber&lt;/span&gt; int getMaxNumber() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; return maxNumber;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Line 7: An instance of this class exists for the lifecycle of the application&lt;/li&gt;
&lt;li&gt;Line 15: &lt;span style=&quot;font-style:italic;&quot;&gt;next() &lt;/span&gt;is a Web Beans &lt;span style=&quot;font-style:italic;&quot;&gt;producer &lt;/span&gt;method.&amp;nbsp; It will get called by the Web Beans Manager to obtain an instance of the next random number.&lt;/li&gt;
&lt;li&gt;Line 18: &lt;span style=&quot;font-style:italic;&quot;&gt;getMaxNumber() &lt;/span&gt;is also a Web Beans &lt;span style=&quot;font-style:italic;&quot;&gt;producer &lt;/span&gt;method.&amp;nbsp; It will get called by the Web Beans Manager to obtain an instance of &lt;span style=&quot;font-style:italic;&quot;&gt;maxNumber - &lt;/span&gt;essentially returning the maximum number to &amp;quot;guess&amp;quot; in the application (in this case &amp;quot;100&amp;quot;).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;The Anatomy of a Simple Contextual Bean&lt;/h2&gt;
&lt;p&gt;Now that we have are utility classes and annotations in place, we can use them in our Web Bean.&lt;/p&gt;
&lt;h3&gt;Listing 5: The &amp;quot;Game&amp;quot; Contextual Bean&lt;/h3&gt;
&lt;table cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot; style=&quot;text-align:left;width:1277px;height:1397px;background-color:rgb(240, 248, 255);&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;vertical-align:top;&quot;&gt;
&lt;ol&gt;
&lt;li&gt;package webbeansguess;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;import java.io.Serializable;&lt;/li&gt;
&lt;li&gt;import javax.annotation.PostConstruct;&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;import javax.enterprise.context.SessionScoped;&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;import javax.enterprise.inject.Instance;&lt;/li&gt;
&lt;li style=&quot;color:rgb(255, 0, 0);&quot;&gt;import javax.inject.Inject;&lt;/li&gt;
&lt;li style=&quot;color:rgb(255, 0, 0);&quot;&gt;import javax.inject.Named;&lt;/li&gt;
&lt;li&gt;import javax.faces.application.FacesMessage;&lt;/li&gt;
&lt;li&gt;import javax.faces.component.UIComponent;&lt;/li&gt;
&lt;li&gt;import javax.faces.component.UIInput;&lt;/li&gt;
&lt;li&gt;import javax.faces.context.FacesContext;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style=&quot;color:rgb(255, 0, 0);&quot;&gt;@Named&lt;/li&gt;
&lt;li style=&quot;color:rgb(51, 51, 255);&quot;&gt;@SessionScoped&lt;/li&gt;
&lt;li&gt;public class Game implements Serializable {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static final long serialVersionUID = 1L;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private int number;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private int guess;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private int smallest;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;@MaxNumber&lt;/span&gt; &lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;@Inject&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp; &amp;nbsp; private int maxNumber;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private int biggest;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private int remainingGuesses;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;@Random&lt;/span&gt; &lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;@Inject &lt;/span&gt;Instance&amp;lt;Integer&amp;gt; randomNumber;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Game() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp; &amp;nbsp; public int getNumber() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return number;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp; &amp;nbsp; public int getGuess() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return guess;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void setGuess(int guess) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.guess = guess;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp; &amp;nbsp; public int getSmallest() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return smallest;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int getBiggest() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return biggest;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int getRemainingGuesses() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return remainingGuesses;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String check() throws InterruptedException {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (guess&amp;gt;number) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; biggest = guess - 1;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (guess&amp;lt;number) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; smallest = guess + 1;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (guess == number) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(&amp;quot;Correct!&amp;quot;));&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; remainingGuesses--;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return null;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @PostConstruct&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void reset() {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.smallest = 0;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; this.guess = 0;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; this.remainingGuesses = 10;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; this.biggest = maxNumber;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; this.number = &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;randomNumber.get()&lt;/span&gt;;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void validateNumberRange(FacesContext context,&amp;nbsp; UIComponent toValidate, Object value) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (remainingGuesses &amp;lt;= 0) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FacesMessage message = new FacesMessage(&amp;quot;No guesses left!&amp;quot;);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.addMessage(toValidate.getClientId(context), message);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((UIInput)toValidate).setValid(false);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int input = (Integer) value;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (input &amp;lt; smallest || input &amp;gt; biggest) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((UIInput)toValidate).setValid(false);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FacesMessage message = new FacesMessage(&amp;quot;Invalid guess&amp;quot;);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.addMessage(toValidate.getClientId(context), message);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
I've color coded the areas of interest in this class.&amp;nbsp; The &lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;blue &lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;areas are JSR 299 (Web Beans) implementation details.&amp;nbsp; The &lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;red &lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;areas are JSR 330 (Dependency Injection For Java) areas.&amp;nbsp; The &lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;purple &lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;areas are the &lt;span style=&quot;font-style:italic;&quot;&gt;binding types.&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;Line 14: We are using the &lt;span style=&quot;font-style:italic;&quot;&gt;Named &lt;/span&gt;annotation to associate a name with this bean.&amp;nbsp; Because there is no argument specified with the &lt;span style=&quot;font-style:italic;&quot;&gt;Named &lt;/span&gt;annotation, its name will be the name of the bean itself with the first letter lowercase (game).&amp;nbsp;&amp;nbsp; This allows us to reference the bean by that name using the Expression Language in the view.&lt;br /&gt;
    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;Line 15: We declare this bean as a session scoped bean, meaning it's lifecycle is the lifecycle of the session. &lt;br /&gt;
    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;Line 23: The &lt;span style=&quot;font-style:italic;&quot;&gt;producer &lt;/span&gt;method in the &lt;span style=&quot;font-style:italic;&quot;&gt;Generator&lt;/span&gt; class (line 18) will service this injection point causing maxNumber to have a value of &amp;quot;100&amp;quot;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;Line 29: The &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;producer &lt;/span&gt;method in the &lt;span style=&quot;font-style:italic;&quot;&gt;Generator&lt;/span&gt; class (line 15) will service this injection point making a&amp;nbsp; &lt;span style=&quot;font-style:italic;&quot;&gt;randomNumber &lt;/span&gt;instance available for this Web Bean.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;Line 72: We use a standard &lt;span style=&quot;font-style:italic;&quot;&gt;@PostConstruct &lt;/span&gt;annotation causing variable initialization (after this Web Bean is created).&lt;br /&gt;
    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;Line 78: Our Web Bean has been created, so the &lt;span style=&quot;font-style:italic;&quot;&gt;randomNumber.get() &lt;/span&gt;call will cause the &lt;span style=&quot;font-style:italic;&quot;&gt;producer &lt;/span&gt;method in the &lt;span style=&quot;font-style:italic;&quot;&gt;Generator &lt;/span&gt;class (line 15) to get called.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style=&quot;color:rgb(51, 51, 255);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(255, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color:rgb(204, 51, 204);&quot;&gt;&lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;Well, that's a quick overview of a simple JSF2 application that uses the Web Beans (JSR 299 implementation) and the Java Dependency Injection (JSR 330) annotations. You can find this version of Web Beans in any of the GlassFish V3 builds after September 2, 2009.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description>
         <guid isPermaLink="false">263829 at http://www.java.net</guid>
         <pubDate>Fri, 04 Sep 2009 19:34:20 +0000</pubDate>
      </item>
      <item>
         <title>Latest functionality in GlassFish v3 logging.</title>
         <link>http://www.java.net/blog/carlavmott/archive/2009/09/02/latest-functionality-glassfish-v3-logging</link>
         <description>&lt;p&gt;This blog highlights some of the changes that are part of GlassFish v3 logging.&amp;nbsp; Since Prelude I have added 3 asadmin commands related to logging. I have updated the set-log-level command and changed the syntax. See below for details. The new commands are:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * &lt;em&gt;asadmin rotate-log&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; * asadmin list-logger-levels&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; * asadmin set-log-level&lt;/em&gt;  logger-name=level:logger-name=level&lt;/p&gt;
&lt;p&gt;The first command rotates the log files immediately.&amp;nbsp; Users can now use native scheduling software such as &lt;em&gt;cron&lt;/em&gt; to rotate the logs.&amp;nbsp; We still support rotating logs based on file size or elapsed time since the last log rotation and this new command allows more flexibility when rotating log files.&amp;nbsp; The second command lists the loggers and their current level.&amp;nbsp; This command reports on all the known loggers that are listed in &lt;em&gt;logging.properties&lt;/em&gt; file.&amp;nbsp; Note that in some cases the loggers may not have been created by the respective containers however they will still appear in the list. The third command,&amp;nbsp; asadmin set-log-level, sets the level for aone or more loggers.&amp;nbsp;&amp;nbsp; For example, to set the log level of the web container logger level to WARNING&amp;nbsp; simply type:&amp;nbsp; &lt;em&gt;asadmin set-log-level  javax.enterprise.system.container.web=WARNING.&lt;/em&gt; This command updates the logging.properties file which means that the values are persisted across server restart.&amp;nbsp; Use &lt;em&gt;asadmin list-logger-levels&lt;/em&gt;&amp;nbsp; to get the names of the loggers. &lt;/p&gt;
&lt;p&gt;Finally, I've added a property to &lt;em&gt;logging.properties&lt;/em&gt; file in the domain &lt;em&gt;config&lt;/em&gt; directory that controls&amp;nbsp; the number of message written to the server log file.&amp;nbsp; GlassFish v3 logging code writes messages to a queue instead of directly to&amp;nbsp; the server log file.&amp;nbsp; Log messages are taken off the queue and written to the server log file as cycles become available.&amp;nbsp; The property name is &lt;em&gt;com.sun.enterprise.server.logging.GFFileHandler.flushFrequency&lt;/em&gt;.&amp;nbsp; This propertys controls the number of messages that are taken off the queue and written to a file a time.&amp;nbsp; The actual number written is the value of this property or less depending on the number of messages in the queue.&amp;nbsp; The default value is 1.&lt;br /&gt;
&amp;nbsp;&lt;/p&gt;</description>
         <guid isPermaLink="false">263778 at http://www.java.net</guid>
         <pubDate>Thu, 03 Sep 2009 00:33:50 +0000</pubDate>
      </item>
      <item>
         <title>Slides from our talk at JavaOne.</title>
         <link>http://www.java.net/blog/mode/archive/2009/06/slides_from_our.html</link>
         <description>&lt;p&gt;Jan Luehe, Greg Wilkins and I did a talk on Servlet 3.0 at JavaOne yesterday. Am attaching the &lt;a rel=&quot;nofollow&quot;&gt;slides&lt;/a&gt; from the talk for those that didn't make it or did make it and want a copy of the slides :).&lt;/p&gt;</description>
         <guid isPermaLink="false">242363 at http://www.java.net</guid>
         <pubDate>Wed, 03 Jun 2009 18:05:44 +0000</pubDate>
      </item>
      <item>
         <title>ICEFaces 2.0 And JSF 2.0 Together</title>
         <link>http://www.java.net/blog/rogerk/archive/2009/05/icefaces_20_and.html</link>
         <description>&lt;p&gt;JSF Ajax frameworks have been around for some time. JSF is all about&lt;br /&gt;
server side components that render&lt;br /&gt;
their state as markup to the client. JSF has a well defined lifecycle&lt;br /&gt;
that defines how component state&lt;br /&gt;
is handled on the server and when component state is rendered to the&lt;br /&gt;
client.&amp;nbsp; JSF Ajax frameworks can control which components are&lt;br /&gt;
processed on the server (known as partial processing), and which&lt;br /&gt;
components render themselves back to the client (known as partial&lt;br /&gt;
rendering) by sending Ajax requests with special parameters.&amp;nbsp; &lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight:bold;&quot;&gt;How ICEFaces Uses JSF 2.0&amp;nbsp; To&lt;br /&gt;
Send Ajax Requests&lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
&lt;/span&gt;The JSF 2.0 Ajax JavaScript API &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;jsf.ajax.request&lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt; can be used to trigger Ajax&lt;br /&gt;
requests from an HTML event such as &lt;span style=&quot;font-style:italic;&quot;&gt;onclick&lt;/span&gt;.&amp;nbsp;&lt;br /&gt;
This function can be called from within a JavaScript function&lt;br /&gt;
too.&amp;nbsp; ICEFaces uses the &lt;span style=&quot;font-style:italic;&quot;&gt;jsf.ajax.request&lt;br /&gt;
&lt;/span&gt;function within their JavaScript library:&lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;/p&gt;
&lt;table style=&quot;text-align:left;width:698px;height:204px;&quot; border=&quot;1&quot;&gt;
 cellpadding=&quot;2&quot; cellspacing=&quot;2&quot;&amp;gt;&lt;br /&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;br /&gt;
 style=&quot;vertical-align: top; background-color: rgb(204, 255, 255);&quot;&amp;gt;&amp;nbsp;&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; submitEvent = function(event, element, form) {&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
 style=&quot;color: rgb(51, 51, 255);&quot;&amp;gt;jsf.ajax.request(element, event,&lt;br /&gt;
{execute: '@all', render: '@all'});&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br&gt;&lt;br /&gt;
      &lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; submitForm = function(event, form) {&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
 style=&quot;color: rgb(51, 51, 255);&quot;&amp;gt;jsf.ajax.request(form, event,&lt;br /&gt;
{execute: '@all', render: '@all'});&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(0, 0, 0);&quot;&gt;...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br&gt;&lt;br /&gt;
      &lt;/span&gt;&lt;/span&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;br&gt;&lt;br /&gt;
ICEFaces uses &lt;span style=&quot;font-style:italic;&quot;&gt;submitEvent &lt;/span&gt;and&lt;br /&gt;
&lt;span style=&quot;font-style:italic;&quot;&gt;submitForm &lt;/span&gt;in their &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;iceSubmitPartial and &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;iceSubmit functions&lt;br /&gt;
respectively.&amp;nbsp; The &lt;span style=&quot;font-style:italic;&quot;&gt;iceSubmitPartial&lt;br /&gt;
&lt;/span&gt;and &lt;span style=&quot;font-style:italic;&quot;&gt;iceSubmit &lt;/span&gt;functions&lt;br /&gt;
are part of the ICEFaces Ajax Bridge that&amp;nbsp; communicate with the&lt;br /&gt;
server.&amp;nbsp; ICEFaces is using the keyword &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;@all for both &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;execute and &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;render which means that all&lt;br /&gt;
components are processed on the server, and all components are targeted&lt;br /&gt;
for rendering markup back to the client.&amp;nbsp; ICEFaces sends&lt;br /&gt;
everything because on the server the framework determines the &quot;dirty&quot;&lt;br /&gt;
regions in a view by comparing the current rendered view with the view&lt;br /&gt;
that was rendered as a result of the Ajax request.&lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight:bold;&quot;&gt;How ICEFaces Uses JSF 2.0 To Process&lt;br /&gt;
Ajax Requests On The Server&lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
&lt;/span&gt;JSF 2.0 provides extensibility points that allow JSF Ajax&lt;br /&gt;
frameworks to perform customized partial processing and partial&lt;br /&gt;
rendering on the server.&amp;nbsp; The JSF 2.0 API provides the &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;javax.faces.context.PartialViewContext.processPartial&lt;br /&gt;
method for this purpose.&amp;nbsp; This method performs partial&lt;br /&gt;
processing and partial rendering on the components identified by the&lt;br /&gt;
identifiers in the &lt;span style=&quot;font-style:italic;&quot;&gt;execute &lt;/span&gt;and&lt;br /&gt;
&lt;span style=&quot;font-style:italic;&quot;&gt;render &lt;/span&gt;lists from the&lt;br /&gt;
request.&amp;nbsp; ICEFaces extends &lt;span style=&quot;font-style:italic;&quot;&gt;javax.faces.context.PartialViewContext&lt;br /&gt;
&lt;/span&gt;with their &lt;span style=&quot;font-style:italic;&quot;&gt;DOMPartialViewContext&lt;br /&gt;
&lt;/span&gt;impementation:&lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;/p&gt;
&lt;table style=&quot;text-align:left;width:692px;height:28px;&quot; border=&quot;1&quot;&gt;
 cellpadding=&quot;2&quot; cellspacing=&quot;2&quot;&amp;gt;&lt;br /&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;br /&gt;
 style=&quot;vertical-align: top; background-color: rgb(204, 255, 255);&quot;&amp;gt;import&lt;br /&gt;
javax.faces.context.PartialViewContextWrapper;&lt;br&gt;&lt;br /&gt;
...&lt;br&gt;&lt;br /&gt;
public class DOMPartialViewContext extends PartialViewContextWrapper {&lt;br&gt;&lt;br /&gt;
...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:rgb(51, 102, 255);&quot;&gt;&lt;br /&gt;
 style=&quot;color: rgb(51, 51, 255);&quot;&amp;gt;public void processPartial(PhaseId&lt;br /&gt;
phaseId)&lt;/span&gt;&amp;nbsp; {&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isRenderAll() &amp;amp;&amp;amp;&lt;br /&gt;
PhaseId.RENDER_RESPONSE) {&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
Perform DOM Diffing ..&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;
Send updates as separate &amp;lt;update&amp;gt; elements using JSF 2.0&lt;br /&gt;
PartialResponseWriter&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
super.processPartial(phaseId);&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br /&gt;
...&lt;br&gt;&lt;br /&gt;
}&lt;br&gt;
      
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;br&gt;&lt;br /&gt;
If the current processing phase is the &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;Render Response Phase, ICEFaces:&lt;br&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;retrieves the current DOM (for the view before rendering)&lt;br&gt;
  &lt;/li&gt;
&lt;li&gt;generates the new DOM by rendering the new view (using a special&lt;br /&gt;
DOMResponseWriter)&lt;/li&gt;
&lt;li&gt;determines if there are differences between the DOMs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If there are differences, then the JSF 2.0 &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;javax.faces.context.PartialResponseWriter implementation&lt;br /&gt;
is used to write &amp;lt;update&amp;gt; elements back to the client following&lt;br /&gt;
the specification defined partial response format:&lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;/p&gt;
&lt;table style=&quot;text-align:left;width:688px;height:28px;&quot; border=&quot;1&quot;&gt;
 cellpadding=&quot;2&quot; cellspacing=&quot;2&quot;&amp;gt;&lt;br /&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;br /&gt;
 style=&quot;vertical-align: top; background-color: rgb(204, 255, 255);&quot;&amp;gt;&amp;lt;partial-response&amp;gt;&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;changes&amp;gt;&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;update id=&quot;user&quot;&amp;gt;&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/update&amp;gt;&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;update id=&quot;password&quot;&amp;gt;&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/update&amp;gt;&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/changes&amp;gt;&lt;br&gt;&lt;br /&gt;
&amp;lt;/partial-response&amp;gt;&lt;br&gt;
      
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;br&gt;&lt;br /&gt;
If there are no differences, then the JSF 2.0 &lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;javax.faces.context.PartialResponseWriter implementation&lt;br /&gt;
is used to write the single &amp;lt;update&amp;gt; element containing the&lt;br /&gt;
entire view markup.&lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight:bold;&quot;&gt;Summary&lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
&lt;span style=&quot;font-style:italic;&quot;&gt;&lt;/span&gt;&lt;/span&gt;ICEFaces 2.0 is still&lt;br /&gt;
under development, and it is one of the early component frameworks that&lt;br /&gt;
follow the JSF 2.0 Ajax standard.&amp;nbsp; It uses the JSF 2.0 Ajax&lt;br /&gt;
JavaScript API to initiate Ajax requests to the server.&amp;nbsp; It&lt;br /&gt;
leverages the JSF 2.0 Ajax extensibility points on the server to&lt;br /&gt;
process Ajax Requests and formulate the partial response to send back&lt;br /&gt;
to the client.&amp;nbsp; This version of ICEFaces (2.0) currently uses the &lt;br /&gt;
 href=&quot;https://javaserverfaces.dev.java.net/&quot;&amp;gt;mojarra&amp;nbsp; implementation&lt;br /&gt;
of the JSF 2.0 specification.&amp;nbsp; There will surely be more component&lt;br /&gt;
frameworks on board with JSF 2.0, which should go a long way towards&lt;br /&gt;
component interoperability.&lt;br&gt;&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight:bold;&quot;&gt;References&lt;br&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br&gt;&lt;br /&gt;
&lt;br /&gt;
 href=&quot;http://www.jroller.com/tedgoddard/entry/on_the_road_to_icefaces&quot;&amp;gt;ICEFaces&lt;br /&gt;
2.0&lt;br&gt;&lt;br /&gt;
&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jcp.org/en/jsr/detail?id=314&quot;&gt;JavaServer Faces 2.0&lt;br /&gt;
Specification&lt;/a&gt;&lt;br&gt;&lt;br /&gt;
&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://javaserverfaces.dev.java.net/&quot;&gt;Project Mojarra&lt;/a&gt;&lt;br&gt;&lt;br /&gt;
&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://glassfish.dev.java.net&quot;&gt;GlassFish&lt;/a&gt;&lt;br&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;/span&gt;&lt;br&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;/span&gt;&lt;br&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
 style=&quot;font-style: italic;&quot;&amp;gt;&lt;br&gt;&lt;/p&gt;</description>
         <guid isPermaLink="false">242252 at http://www.java.net</guid>
         <pubDate>Mon, 25 May 2009 23:40:29 +0000</pubDate>
      </item>
      <item>
         <title>Proposed Final Draft of Servlet 3.0 now available</title>
         <link>http://www.java.net/blog/mode/archive/2009/05/proposed_final.html</link>
         <description>&lt;p&gt;The proposed final draft of the Servlet 3.0 specification is now available at the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jcp.org/en/jsr/detail?id=315&quot;&gt;JCP site &lt;/a&gt;. In addition to the specification, also refer to Shing Wai's blog describing in detail the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blogs.sun.com/swchan/entry/servlet_3_0_web_fragment&quot;&gt;ordering solution for fragments&lt;/a&gt; and the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blogs.sun.com/swchan/entry/servlet_3_0_security_annotations&quot;&gt;use of security annotations&lt;/a&gt;.&lt;/p&gt;</description>
         <guid isPermaLink="false">242172 at http://www.java.net</guid>
         <pubDate>Fri, 08 May 2009 20:58:15 +0000</pubDate>
      </item>
      <item>
         <title>Servlet 3.0 PFD draft coming soon.</title>
         <link>http://www.java.net/blog/mode/archive/2009/04/servlet_30_pfd.html</link>
         <description>&lt;p&gt;It's been a while since my last update. However I am pleased to report that the Proposed Final Draft (PFD) of Servlet 3.0 is now been handed off to the JCP. Some highlights of what is in the PFD draft - &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; The issues around Async have been worked out and Greg will also be posting an update to his last set of comments. Basically there were some tweaks to the APIs and semantics of the proposal. However the proposal itself hasn't changed drastically. It has been implemented in GlassFish and I believe also in Jetty 7.0 pre release build.
&lt;li&gt; We now have an ordering solution for Servlets, Filters and Listeners that also allows users to control what jar files are looked up based on the pluggability feature described previously.
&lt;li&gt; In addition to the pluggability via fragments, annotations, we also introduced the concept of &lt;code class=&quot;prettyprint&quot;&gt;ServletContainerInitializer&lt;/code&gt; which allows you to plugin providers based on either annotations or classes that a particular class implements. For example when plugging in JAX-WS into a web container to support web services, today most implementations require you to use a proprietary descriptor (unless you are writing a JSR 109 style web service) for using the web service library in a web container. I will provide more details of how framework authors can use the &lt;code class=&quot;prettyprint&quot;&gt;ServletContainerInitializer&lt;/code&gt; in a separate blog soon to follow.
&lt;li&gt; Ability to load static resources and JSPs from a jar file. This feature enables users to bundle shared resources in a jar file in a special directory - &lt;code class=&quot;prettyprint&quot;&gt;META-INF/resources&lt;/code&gt;. When included in the WEB-INF/lib directory of the webapp, if the container does not find a particular resource in the root directory of the webapp, it will look at the jar files in the WEB-INF/lib to see if the resource is bundled in META-INF/resources of any jar file and serve it up.
&lt;li&gt;Security enhancements - programmatic authenticate, login and logout support. Support for &lt;code class=&quot;prettyprint&quot;&gt;@RolesAllowed, @PermitAll, @DenyAll&lt;/code&gt; annotations in the web container.
&lt;li&gt; Updated existing APIs to use generics where possible in a backward compatible manner.
&lt;li&gt;Default error pages for error codes.
&lt;li&gt;Clarified welcome files.
&lt;li&gt;File upload - We have a basic solution in place, which we will build upon in a future release of the Servlet specification.
&lt;/ul&gt;
&lt;p&gt;Look out for the specification release (I will post an update when relased) and provide feedback. &lt;/p&gt;
&lt;p&gt;
If you are attending JavaOne this year, Jan Luehe (from Sun), Greg Wilkins(Jetty / Webtide) and I will be presenting the Servlet 3.0 features in a technical session - TS-3790 &quot;Java&lt;/p&gt;</description>
         <guid isPermaLink="false">242085 at http://www.java.net</guid>
         <pubDate>Tue, 28 Apr 2009 20:20:13 +0000</pubDate>
      </item>
      <item>
         <title>Rebuttal of Greg Wilkin's Blog about Servlet 3.0 PR</title>
         <link>http://www.java.net/blog/mode/archive/2008/12/rebuttal_of_gre.html</link>
         <description>&lt;p&gt;Someone just pointed me to Greg Wilkin's latest blog &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blogs.webtide.com/gregw/entry/servlet_3_0_public_review&quot;&gt;entry&lt;/a&gt;. I tried posting my response in his comments however it was tagged as spam and not displayed. So I am making the comments available her.&lt;br /&gt;
&lt;br&gt;&lt;/p&gt;
&lt;p&gt;I am REALLY surprised at this blog. Let me try to answer some of these questions in the public forum.&lt;/p&gt;
&lt;p&gt;
&quot;This public draft of the servlet-3.0 represents a thought experiment in API design unhindered by the complexities of implementation, trial usage or community feedback.&quot;&lt;/p&gt;
&lt;p&gt; &lt;b&gt;An implementation of this is available in GlassFish in the trunk.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
&quot;As a member of this Expert Group, I've been as guilty as the other members by looking at uncompiled/untested APIs and believing them to solve the issues at hand, only to later discover that these APIs prove to be unworkable when implemented and/or used.&quot;&lt;/p&gt;
&lt;p&gt; &lt;b&gt;The APIs are implementable. Take a look at the GlassFish trunk.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
&quot;Requests for test implementations have been denied&quot;&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;I never saw a request from you. In fact YOU offered to implement some of the features in Jetty and showcase the technology.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
&quot;Any feedback received on the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;mailto:jsr-315-comments@jcp.org&quot;&gt;jsr-315-comments@jcp.org&lt;/a&gt; list have been kept private and not shared even with the EG, despite several requests. &quot;&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Please check your email carefully. All the mails that I have received I have forwarded to the EG. Also I never saw  a request from you to share feedback that is received.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
&quot;EG members and community feedback raised concerns about the security and ordering aspects of the automatic deployment possible with the  Annotations and Pluggability feature (see below).  The response was not the &quot;How can we address these concerns&quot; discussion that I was expecting.   Instead the response was more along the lines of Obe-wan Kenobi saying &quot;these are not the concerns you are looking for. Move along!&quot; &quot;&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;&lt;br /&gt;
Looking into the security concerns we introduced the enabled, flag that can enable and disable servlets. Also like some of the other EG members pointed out that if a user does not know how a framework works he shouldn't be using it in the first place. Or if a framework is authored badly then it shouldn't be used in the first place. The problem is that you never get PAST what YOU suggest as a solution and YOU always think of solutions keeping that in mind.&lt;br /&gt;
&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
&quot;Alternately, some unsubstantiated requirements (eg. wrapped asynchronous requests) have been included at a late stage without any use-cases or user demand, which have introduced whole new dimensions of complexity so that discussions have been ratholed for months chasing marginal edge cases.&quot;&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;&lt;br /&gt;
I don't believe that you say this. Late in the game and we rat holed more on the use case that you had as opposed to the wrapped use case. In fact if you remember, members of the EG were opposed to the re-dispatch semantics that we had. So please don't provide an incorrect picture to the people reading your blogs.&lt;br /&gt;
&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
&quot;Accidental Deployment&quot;&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;&lt;br /&gt;
We have had no such experience with the use of annotations in JAX-WS, EJB, and other places in the Java EE platform. Also there are ways to turn off the accidental deployment - use the enable flag to enable / disable servlets. Are you even paying attention to the solutions that the EG is working on providing?&lt;br /&gt;
&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
&quot;Slow Deployment&quot;&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;&lt;br /&gt;
Please provide numbers of how deployment is slowed down. If you just &quot;feel&quot; that deployment will slow down significantly it isn't good enough. In the Java EE 5 days we did the analysis of scanning of annotations and the result was that we didn't see any significant slowing down. I can share the numbers in the EG if you are REALLY interested in the problem.&lt;br /&gt;
&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
&quot;Ordering&quot;&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;&lt;br /&gt;
Yes this is a problem for the fragments. However there is a solution to use the web.xml to do the ordering. Also your blog seems to be getting confusing. On one hand you criticize the feature of pluggability with accidental deployment, slowing down deployment with scanning, and on the other hand you want to use the feature and not define everything in the web.xml? Make up your mind what you want? Use the feature or just keep using the web.xml as before.&lt;br /&gt;
&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
As for the async rebuttal and everything else about the Async proposal just a few quotes from emails to the EG.&lt;/p&gt;
&lt;p&gt;
Quoting you -&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
&quot;Excellent!    This proposal is definitely better than suspend/resume!&quot;&lt;/p&gt;
&lt;p&gt;Quoting another EG member -&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
&quot;Greg, I think you're being too aggressive. I do realize you care about the subject.&lt;/p&gt;
&lt;p&gt;I think Rajiv's design is now quite fine, so using the &quot;flood until he&lt;br /&gt;
agrees to my stuff&quot; tactic is unfair. From what I've seen many have&lt;br /&gt;
stated a preference for his design (I have a coworker who's also not&lt;br /&gt;
very comfortable with your design). And the adapted code example looks&lt;br /&gt;
good to me too.&quot;&lt;/p&gt;
&lt;p&gt;
You have just taken this tactic outside the EG now because the EG members were starting to point this out to you. &lt;/p&gt;
&lt;p&gt;
I am really starting to agree with Bill Burke about the statement he made in his &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/&quot;&gt;blog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;h3&gt;Update:&lt;/h3&gt;
&lt;p&gt;Maxim MoldenHauer, the IBM representative on the EG has also &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://maximmoldenhauer.blogspot.com/2008/12/servlet-30-public-draft.html&quot;&gt;blogged&lt;/a&gt; on the issue.&lt;/p&gt;</description>
         <guid isPermaLink="false">241299 at http://www.java.net</guid>
         <pubDate>Tue, 16 Dec 2008 07:34:54 +0000</pubDate>
      </item>
      <item>
         <title>Servlet 3.0 webinar</title>
         <link>http://www.java.net/blog/mode/archive/2008/12/servlet_30_webi.html</link>
         <description>&lt;p&gt;I will be presenting 3.0 in a webinar on December 18th. For details and logistics about the webinar go to &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://wikis.sun.com/display/TheAquarium/Servlet3.0&quot;&gt;http://wikis.sun.com/display/TheAquarium/Servlet3.0&lt;/a&gt;. If you would like to learn about the new features in servlet 3.0 I would definitely encourage you to attend the webinar.&lt;/p&gt;</description>
         <guid isPermaLink="false">241278 at http://www.java.net</guid>
         <pubDate>Thu, 11 Dec 2008 01:58:25 +0000</pubDate>
      </item>
      <item>
         <title>Asynchronous support in Servlet 3.0</title>
         <link>http://www.java.net/blog/mode/archive/2008/12/asynchronous_su.html</link>
         <description>&lt;p&gt;After the last couple of entries I have gotten requests for more details on how the async works. So I decided to write this up in a blog to share what the async support looks like in the Servlet 3.0 public review draft.&lt;/p&gt;
&lt;p&gt;There are a couple of use cases that we are trying to handle with the async support in Servlet 3.0 - &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; Wait for a resource to become available (JDBC, call to webservice)
&lt;li&gt; Generate response asynchronously
&lt;li&gt; Use the existing frameworks to generate responses after waiting for the async operation to complete
&lt;/ul&gt;
&lt;p&gt;Keeping this in mind the API that the expert group has agreed upon for async is as follows.&lt;/p&gt;
&lt;p&gt;&lt;ul&gt;
&lt;li&gt;Annotation attributes in the &lt;code class=&quot;prettyprint&quot;&gt;@WebServlet&lt;/code&gt; and &lt;code class=&quot;prettyprint&quot;&gt;@ServletFilter&lt;/code&gt; annotations that indicates if a Servlet or a Filter supports async. The attribute is &lt;code class=&quot;prettyprint&quot;&gt;asyncSupported&lt;/code&gt;.
&lt;li&gt;To initiate an async operation there are methods on &lt;code class=&quot;prettyprint&quot;&gt;ServletRequest&lt;/code&gt; - &lt;code class=&quot;prettyprint&quot;&gt;startAsync(req, res)&lt;/code&gt; and &lt;code class=&quot;prettyprint&quot;&gt;startAsync()&lt;/code&gt; (difference described below).
&lt;li&gt; Call to &lt;code class=&quot;prettyprint&quot;&gt;startAsync&lt;/code&gt; returns an &lt;code class=&quot;prettyprint&quot;&gt;AsyncContext&lt;/code&gt; initialized with the request and response objects passed to the &lt;code class=&quot;prettyprint&quot;&gt;startAsync&lt;/code&gt; call.
&lt;li&gt;&lt;code class=&quot;prettyprint&quot;&gt;AsyncContext.forward(path)&lt;/code&gt; and &lt;code class=&quot;prettyprint&quot;&gt;AsyncContext.forward()&lt;/code&gt; that forwards the request back to the container so you can use frameworks like JSP to generate the response.
&lt;li&gt;&lt;code class=&quot;prettyprint&quot;&gt;AsyncContext.complete()&lt;/code&gt; indicates that the developer is done processing the request and generating the appropriate response.
&lt;li&gt;There are a few more methods in &lt;code class=&quot;prettyprint&quot;&gt;ServletRequest&lt;/code&gt; like &lt;code class=&quot;prettyprint&quot;&gt;isAsyncSupported&lt;/code&gt; and &lt;code class=&quot;prettyprint&quot;&gt;isAsyncStarted&lt;/code&gt; that can be used by applications to determine if async operations are supported or started.
&lt;li&gt; There is also a new listener - &lt;code class=&quot;prettyprint&quot;&gt;AsyncListener&lt;/code&gt; that applications can use to get notified of when async processing is completed or if a timeout occurs.
&lt;/ul&gt;
&lt;p&gt;To initiate async processing there are two methods available - one that takes a request and response (startAsync(req, res) ) and one that does not take any parameters (startAsync()). The difference between the two method signatures is that the startAsync() with no parameters implicitly uses the original request and response while the startAsync(req, res) uses the request and response objects passed in. The request and response passed in can be wrapped by filters or other servlets earlier in the request processing chain. The AsyncContext is initialized appropriately with the request and response depending on the method used. Caution must be taken when wrapping the response and calling the no arguments startAsync(). If any data has been written to the wrapped response and not flushed to the underlying response stream you could lose the data.&lt;/p&gt;
&lt;p&gt;
Similarly after the async processing is over if you choose to forward the request back to run in the context of the web container there are three methods that are available in the AsyncContext that enable this. forward(path), forward(ServletContext, path) and forward().&lt;/p&gt;
&lt;p&gt;&lt;ul&gt;
&lt;li&gt;forward() no args forwards back to the &quot;original url&quot; or if a forward (AsyncContext or RequestDispatcher forward) has occured after an async context has been initialized then the no args forward will forward to the path that was used by the AsyncContext / RequestDispatcher to forward to.
&lt;li&gt;forward(path) forwards to the path relative to the context of the request
&lt;li&gt;forward(ServletContext, path) forwards to the path relative to the context specified.
&lt;p&gt;Below is an example that shows a simple web application that is waiting for a webservice call to return and then rendering the response. Note the actual code for calling the web service itself is not included.&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;@WebServlet(&quot;/foo&quot; asyncSupported=true)&lt;br /&gt;public class MyServlet extends HttpServlet {&lt;br /&gt;    public void doGet(HttpServletRequest req, HttpServletResponse res) {&lt;br /&gt;        ...&lt;br /&gt;        AsyncContext aCtx = request.startAsync(req, res);&lt;br /&gt;        ScheduledThreadPoolExecutor executor = new ThreadPoolExecutor(10);&lt;br /&gt;        executor.execute(new AsyncWebService(aCtx));&lt;br /&gt;    }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;public class AsyncWebService implements Runnable {&lt;br /&gt;    AsyncContext ctx;&lt;br /&gt;    public AsyncWebService(AsyncContext ctx) {&lt;br /&gt;         this.ctx = ctx;&lt;br /&gt;    }&lt;br /&gt;    public void run() {&lt;br /&gt;        // Invoke web service and save result in request attribute&lt;br /&gt;        // Forward the request to render the result to a JSP. &lt;br /&gt;        ctx.forward(&quot;/render.jsp&quot;); &lt;br /&gt;    }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you would like to try it out use the nightly build of the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://glassfish.dev.java.net&quot;&gt;GlassFish&lt;/a&gt; trunk and post any issues that you run into at &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;mailto:webtier@glassfish.dev.java.net&quot;&gt;webtier@glassfish.dev.java.net&lt;/a&gt; which the GlassFish webtier team monitors closely.&lt;/p&gt;&lt;/ul&gt;</description>
         <guid isPermaLink="false">241233 at http://www.java.net</guid>
         <pubDate>Thu, 11 Dec 2008 01:50:22 +0000</pubDate>
      </item>
      <item>
         <title>Adding custom handlers to GlassFish v3 loggers</title>
         <link>http://www.java.net/blog/carlavmott/archive/2008/12/adding_custom_h.html</link>
         <description>&lt;p&gt;&lt;p&gt;
I recently blogged about the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://weblogs.java.net/blog/carlavmott/archive/2008/10/glassfish_v3_lo.html&quot;&gt;changes to logging GlassFish Prelude&lt;/a&gt;. Building on that I wanted to show how to add custom handlers to your installation of v3.  You may find that you want to log messages to a database, send them to a remote server or log messages from specific loggers to your own file. This can be done by writing a custom log handler. It is pretty straight forward and actually there are two approaches you can take to add the handler.  Either you can write an HK2 service for the handler or a Java class as specified by the JDK. Either approach will work in GlassFish  v3 Prelude so I have examples for both approaches in this blog. In the examples below I simple print some messages to a specific file but you can replace that code with something that interests you.  &lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Option 1&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
First I'll implement the handler as a simple Java class.  This requires for me to write a class that implements the Handler APIs, package it in a jar file and add the jar to the GlassFish classpath.  The last step is to update the &lt;b&gt;logging.properties&lt;/b&gt; file to include the name of the class of the handler.  At server startup the handler is added to the root logger automatically. Since the handler is added to root logger it is available to all loggers.  &lt;/p&gt;
&lt;p&gt;My NewHandler class implements the &lt;b&gt;publish, close&lt;/b&gt; and &lt;b&gt; flush&lt;/b&gt; Handler APIs.  In the publish method, my handler simply writes to a file all messages that come from the web and deployment loggers as those are the ones that I'm interested in seeing.  All messages are still logged to server.log so nothing is lost.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;package logging;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author cmott&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;import java.util.logging.*;&lt;br /&gt;import java.io.BufferedWriter;&lt;br /&gt;import java.io.FileWriter;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * New Handler&lt;br /&gt; *&lt;br /&gt; */&lt;br /&gt;public class NewHandler extends Handler {&lt;br /&gt;&lt;br /&gt;    static BufferedWriter f = null;&lt;br /&gt;    String webLogger = &quot;javax.enterprise.system.container.web&quot;;&lt;br /&gt;    String deployLogger = &quot;javax.enterprise.system.tools.deployment&quot;;&lt;br /&gt;&lt;br /&gt;    public NewHandler(){&lt;br /&gt;        try {&lt;br /&gt;              String userDir = System.getProperty(&quot;user.dir&quot;);&lt;br /&gt;              f = new BufferedWriter(new FileWriter(userDir + &quot;/mylogging.log&quot;));       &lt;br /&gt;            } catch (IOException e) {&lt;br /&gt;                System.out.println(&quot;not able to create log file.&quot;+e);&lt;br /&gt;       }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Overridden method used to capture log entries   *&lt;br /&gt;  * @param record The log record to be written out.&lt;br /&gt;  */&lt;br /&gt; public void publish(LogRecord record)&lt;br /&gt; {&lt;br /&gt;  // first see if this entry should be filtered out&lt;br /&gt;  // the filter should keep anything&lt;br /&gt;  if ( getFilter()!=null ) {&lt;br /&gt;   if ( !getFilter().isLoggable(record) )&lt;br /&gt;    return;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  try { &lt;br /&gt;     if (webLogger.equals(record.getLoggerName()) || deployLogger.equals(record.getLoggerName()) ) {&lt;br /&gt;         f.write (&quot;NewHandler output - &quot;);&lt;br /&gt;         f.write(&quot;logger name: &quot;+record.getLoggerName());&lt;br /&gt;         f.write(&quot; source classname: &quot;+record.getSourceClassName());&lt;br /&gt;         f.write(&quot; message: &quot;+record.getMessage());&lt;br /&gt;         f.newLine();&lt;br /&gt;         f.flush();&lt;br /&gt;     }&lt;br /&gt;  } catch (IOException ex){&lt;br /&gt;        System.out.println(&quot;not able to write to log file.&quot;+ex);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; /**&lt;br /&gt;  * Called to close this log handler.&lt;br /&gt;  */&lt;br /&gt; public void close()&lt;br /&gt; {&lt;br /&gt;        try {&lt;br /&gt;	     f.close();&lt;br /&gt;        } catch (IOException ex){&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt; /**&lt;br /&gt;  * Called to flush any cached data &lt;br /&gt;  */&lt;br /&gt; public void flush()&lt;br /&gt; {&lt;br /&gt;// not used&lt;br /&gt; }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Next I need to do is to package it in a jar file and copy that jar to glassfish/lib directory.  By default the handler is associated with the root logger so all loggers will have messages send to the handler.  &lt;/p&gt;
&lt;p&gt;
Update the property &lt;b&gt;handler&lt;/b&gt; in the &lt;b&gt;logging.properties&lt;/b&gt; file to include the name of the new handler as below.    &lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;handlers= java.util.logging.ConsoleHandler, logging.NewHandler&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Restarting the server with the new jar file on the classpath will include the new handler. To test this out I deployed a simple web app and looked at the log file.  There you will see the messages from the new handler we just wrote.  &lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Option 2&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
The other option is to create service using HK2. See &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://docs.sun.com/app/docs/doc/820-6583/ghmna?a=view&quot;&gt;Chapter 2 Writing HK2 Components&lt;/a&gt; of the GlassFish documentation for more information on writing an HK2 component. Again you need to implement the handler code much like the example above.  I started with that example and added code to make it an HK2 service.  I had to implement PostConstruct and specify that the service contract is provided by the Handler.class which is part of the JDK.  I built the module and then add the jar file to the GlassFish modules directory.  At server startup the module is found and the handler is added to the root logger.  The handler code now looks like:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;package logging;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author cmott&lt;br /&gt; */&lt;br /&gt;import org.jvnet.hk2.annotations.Inject;&lt;br /&gt;import org.jvnet.hk2.annotations.Scoped;&lt;br /&gt;import org.jvnet.hk2.annotations.Service;&lt;br /&gt;import org.jvnet.hk2.annotations.*;&lt;br /&gt;import org.jvnet.hk2.component.*;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;import java.util.logging.*;&lt;br /&gt;import java.io.BufferedWriter;&lt;br /&gt;import java.io.FileWriter;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * New Handler&lt;br /&gt; *&lt;br /&gt; */&lt;br /&gt;//specify that the contract is provided by handler.class in the JDK&lt;br /&gt;@Service&lt;br /&gt;@ContractProvided(Handler.class) &lt;br /&gt;@Scoped(Singleton.class)&lt;br /&gt;public class NewHandler extends Handler implements PostConstruct {&lt;br /&gt;    @Inject&lt;br /&gt;&lt;br /&gt;    Habitat habitat;&lt;br /&gt;    static BufferedWriter f = null;&lt;br /&gt;    String webLogger = &quot;javax.enterprise.system.container.web&quot;;&lt;br /&gt;    String deployLogger = &quot;javax.enterprise.system.tools.deployment&quot;;&lt;br /&gt;    &lt;br /&gt;    public void postConstruct(){&lt;br /&gt;    	try {&lt;br /&gt;             String userDir = System.getProperty(&quot;user.dir&quot;);&lt;br /&gt;             f = new BufferedWriter(new FileWriter(userDir + &quot;/mylogging.log&quot;));       &lt;br /&gt;    	} catch (IOException e) {&lt;br /&gt;    		System.out.println(&quot;not able to create log file.&quot;+e);&lt;br /&gt;    	}&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt; /**&lt;br /&gt;  * Overridden method used to capture log entries   *&lt;br /&gt;  * @param record The log record to be written out.&lt;br /&gt;  */&lt;br /&gt; public void publish(LogRecord record)&lt;br /&gt; {&lt;br /&gt;  // first see if this entry should be filtered out&lt;br /&gt;  // the filter should keep anything&lt;br /&gt;  if ( getFilter()!=null ) {&lt;br /&gt;   if ( !getFilter().isLoggable(record) )&lt;br /&gt;    return;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  try {&lt;br /&gt;     if (webLogger.equals(record.getLoggerName()) || deployLogger.equals(record.getLoggerName()) ) {&lt;br /&gt;         f.write (&quot;NewHandler output - &quot;);&lt;br /&gt;         f.write(&quot;logger name: &quot;+record.getLoggerName());&lt;br /&gt;         f.write(&quot; source classname: &quot;+record.getSourceClassName());&lt;br /&gt;         f.write(&quot; message: &quot;+record.getMessage()); &lt;br /&gt;         f.newLine();&lt;br /&gt;         f.flush();&lt;br /&gt;     }&lt;br /&gt;  } catch (IOException ex){&lt;br /&gt;  	System.out.println(&quot;not able to write to log file.&quot;+ex);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Called to close this log handler.&lt;br /&gt;  */&lt;br /&gt; public void close()&lt;br /&gt; {&lt;br /&gt; 	try {&lt;br /&gt;	    f.close();&lt;br /&gt; 	} catch (IOException ex){&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; /**&lt;br /&gt;  * Called to flush any cached data that&lt;br /&gt;  * this log handler may contain.&lt;br /&gt;  */&lt;br /&gt; public void flush()&lt;br /&gt; {&lt;br /&gt;// not used&lt;br /&gt; }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
I created this as its own module and included the pom files I used to build the module below.  In the example I have a very simple directory structure with handler-module as the parent containing one directory, handler. I've zipped up the standalone module, &lt;a rel=&quot;nofollow&quot;&gt;handler-module.zip &lt;/a&gt; rather than include the pom.xml files needed to create it.  &lt;/p&gt;
&lt;p&gt; There is no need to update the logging.properties file when creating a service. All that is needed is to drop the newly created jar file in the modules directory of the v3 installation.  GlassFish detects the service in the modules directory automatically.  Again I deployed a simple web app to test and look at mylogging.log file to see the expected messages.  &lt;/p&gt;
&lt;p&gt;
That's it.&lt;/p&gt;</description>
         <guid isPermaLink="false">241049 at http://www.java.net</guid>
         <pubDate>Tue, 09 Dec 2008 22:08:19 +0000</pubDate>
      </item>
      <item>
         <title>Servlet 3.0 - from the source</title>
         <link>http://www.java.net/blog/mode/archive/2008/12/servlet_30_from.html</link>
         <description>&lt;p&gt;Since the Early draft of the specification for Servlet 3.0 (JSR 315) the expert group has been working on refining and improving the specificaiton in a couple of areas - Ease of Development (EoD), pluggability and asynchronous support. Below is a description of things that are in the soon to be available public review to enable each of these features.&lt;/p&gt;
&lt;p&gt;&lt;ul&gt;
&lt;li&gt;
&lt;h3&gt; Ease of Development (Eod)&lt;/h3&gt;
&lt;p&gt;In the early draft we added the annotations that allowed you to essentially write a Servlet as a POJO. However after some discussions in the expert group and feedback from some folks in the community, we decided to actually remove the method level annotations like @GET, @POST etc and keep the doGet, doPost method contracts and require extending an HttpServlet. However the top level annotations which are renamed for better usage in applications still exist. The @WebServlet annotation is used to declare a servlet, @ServletFilter to declare a filter and @WebServletContextListener to define ServletContextListeners. In addition to these annotations, other annotations like @Resource, which have been supported in web applications since Servlet 2.5 will continue to work as before. As an example a servlet declaration using Servlet 3.0 will now look like - &lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;@WebServlet(&quot;/foo&quot;)&lt;br /&gt;public class MyServlet extends HttpServlet {&lt;br /&gt;    public void doGet(...) {&lt;br /&gt;        ....&lt;br /&gt;    }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;
&lt;h3&gt;Pluggability&lt;/h3&gt;
&lt;p&gt; Web frameworks built on top of servlets are very popular for developers and there are a lot of them that address various different problems. In order to better support frameworks for developers writing webapps we are adding ways in the servlet 3.0 specification to make it easier to use and configure frameworks of their choice. There are a couple of ways that enable pluggability - &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; Methods to add Servlets and Filters - If a ServletContextListener is registered and wants to add a Servlet or Filter, then at the time of context initialization the event that is fired to the Listener can add Servlets and Filters to the context. The methods are addServlet and addFilter. For more details look for the javadocs when the specification is published.
&lt;li&gt; Web.xml fragments - Instead of having just one monolithic web.xml that is used by the developer to declare servlets, filters and other configuration for using the framework, the framework can now include a web-fragment.xml with all it's configuration. A web-fragment is almost identical to the web.xml and can contain all the configuration needed by the framework in the META-INF directory of the framework's jar file. The container will use the information to assembe the descriptor for the application and the application needn't have to use any of the boilerplate configuration in their app for the framework. There are rules that are defined int the specification for conflict resolution, overriding and disabling fragment scanning. Along with the annotations which also can be in libraries the feature is very compelling not only for the developers that use frameworks but also for framework authors to be self sufficient in defining the configuration needed.
&lt;/ul&gt;
&lt;li&gt;
&lt;h3&gt;Asynchronous processing&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;This is the biggest change that we have made in the servlet 3.0 specification. In the early draft we had suspend and resume and certain semantics that were defined. However after the early draft the expert group had a lot of discussions on solving various use cases for asynchronous processing and the changes that are made to the specification in this area now also address the various use cases.
&lt;li&gt;Instead of suspend and resume we now have a startAsync method on request and there are two variations of these. One that takes a request and response in which case the AsyncContext that is created when you call startAsync will be initialized with the request and response passed in. The other is a startAsync() that takes no parameters, in which case the AsyncContext is initialized with the original request and response. Also the Servlets and Filters that support asynchronous processing must be annotated appropriately with asyncSupport attribute set. It is illegal to call startAsync if anywhere in the request processing chain you have  have a servlet or a filter that does not support async.
&lt;li&gt;In addition to the AsyncContext there is also an AsyncListener that can be registered to get notifications on timeout and completion of async processing of a request. The event listener can be used to clean up resources if wrapped request and responses were used to initialize the AsyncContext.
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;Please take a look at the specification when it is published on the jcp.org website and send us your feedback at &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;mailto:jsr-315-comments@jcp.org&quot;&gt;jsr-315-comments@jcp.org&lt;/a&gt;.&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
An early access implementation of some of the features are available in the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://glassfish.dev.java.net&quot;&gt;GlassFish &lt;/a&gt; nightly build. For further discussion please post your questions about the implementation to &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;mailto:webtier@glassfish.dev.java.net&quot;&gt;webtier@glassfish.dev.java.net&lt;/a&gt;&lt;br /&gt;
&lt;br&gt; Jetty 7 pre-release also has some of the features implemented for those interested.&lt;br /&gt;
&lt;br&gt; Look for more blogs about these features from my colleagues &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blogs.sun.com/swchan&quot;&gt;Shing Wai&lt;/a&gt; and &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blogs.sun.com/jluehe&quot;&gt;Jan Luehe&lt;/a&gt; on specifics of some of the implementation.&lt;/p&gt;</description>
         <guid isPermaLink="false">241227 at http://www.java.net</guid>
         <pubDate>Wed, 03 Dec 2008 02:13:17 +0000</pubDate>
      </item>
      <item>
         <title>Servlet 3.0 (JSR 315) update</title>
         <link>http://www.java.net/blog/mode/archive/2008/12/servlet_30_jsr_2.html</link>
         <description>&lt;p&gt;It's been a while since I gave an update about servlet 3.0. However while I haven't been blogging we at the expert group are working through refining and making the specification better for the web community. We are in the process of making the Public Review available and was waiting to push out a blog after that. However I have seen a few people write about the 3.0 work based on the Early Draft Review (EDR) (like &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.theserverside.com/tt/tss&quot;&gt;http://www.theserverside.com/tt/tss&lt;/a&gt;)and thought it was best to clarify this so that there isn't any confusion arising from this.&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
The specification has evolved since the EDR and things have changed. the EDR is an early review to get feedback from the community. It is not the final version of the specification. Some of the changes that have happened since the EDR are :&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The annotations to define the http methods (GET, POST, etc) are no longer there. One would still have the extend HttpServlet and use the contract specified there. The top level annotations for declaring a Servlet and Filter are still there and that the expert group still feels is needed and useful to the community. However they are no longer POJOs.
&lt;li&gt;The fragments have evolved since the EDR and the rules for merging the fragments have been specified in the upcoming Public Review.
&lt;li&gt;The asynchronous (or what people are referring to as continuations) has also evolved. First off the notion of continuations is different than async. We now have what the expert group considers a cleaner proposal that will be able to handle a lot more use cases.
&lt;/ol&gt;
&lt;p&gt;&lt;br&gt;&lt;br /&gt;
As an example of some of the things that you will have to do as a developer -&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;@WebServlet(&quot;/foo&quot;)&lt;br /&gt;public class MyServlet extends HttpServlet {&lt;br /&gt;    public void doGet(HttpServletRequest req, HttpServletResponse res) {&lt;br /&gt;        //....&lt;br /&gt;    }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
The suspend and resume APIs are no longer there. Instead we have a startAsync on request that returns an AsyncContext that the users then can use to do async operations and not have to block a thread to complete the processing.&lt;br /&gt;
&lt;br&gt;&lt;br /&gt;
These are just a sneak peak at what is coming and would encourage users to look at the public review when it becomes avaialble at the jcp.org site and send feedback. In the mean time I also encourage people writing articles / blogs about servlet 3.0 to contact us at &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;mailto:jsr-315-comments@jcp.org&quot;&gt;jsr-315-comments@jcp.org&lt;/a&gt; to get an update from the expert group so they can reflect the status of the specification correctly. I will be writing a more detailed blog with more samples show casing the features in the servlet 3.0 specification in the coming days so stay tuned.&lt;/p&gt;</description>
         <guid isPermaLink="false">241225 at http://www.java.net</guid>
         <pubDate>Tue, 02 Dec 2008 19:24:22 +0000</pubDate>
      </item>
      <item>
         <title>jMaki 1.8.1  and GlassFish V3 released</title>
         <link>http://www.java.net/blog/carlavmott/archive/2008/11/jmaki_181_and_g.html</link>
         <description>&lt;p&gt;You may be seen the announcement yesterday about the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://developers.sun.com/appserver/reference/techart/glassfishv3prelude/&quot;&gt;GlassFish V3 Prelude&lt;/a&gt; release.  At the same time, we released jMaki 1.8.1. jMaki provides a framework for building Ajax applications and was fully tested on GlassFish V3 Prelude.   &lt;/p&gt;
&lt;p&gt;
Highlights of the new features in jMaki include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; Drag and Drop widget support into HTML, PHP, Ruby pages
&lt;li&gt; Performance enhancer
&lt;li&gt; Widget Customizer
&lt;li&gt; jMaki CSS Page Templates
&lt;li&gt; Yahoo UI 2.6 Widgets
&lt;li&gt; Dojo Dijit 1.2 Widgets
&lt;li&gt; Scriptaculous 1.8.1 Widgets
&lt;li&gt; jQuery UI 1.5b Widgets
&lt;li&gt; Google 1.8.1 Widgets
&lt;li&gt; jMaki 1.8.1 Widgets
&lt;li&gt; jMaki Extras 1.8.1 Widgets
&lt;/ul&gt;
&lt;p&gt;
You can get jMaki from the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/download.html&quot;&gt;download page&lt;/a&gt; or from the GlassFish update center.  Enjoy!&lt;/p&gt;</description>
         <guid isPermaLink="false">241119 at http://www.java.net</guid>
         <pubDate>Fri, 07 Nov 2008 17:50:54 +0000</pubDate>
      </item>
      <item>
         <title>GlassFish V3 logging changes</title>
         <link>http://www.java.net/blog/carlavmott/archive/2008/10/glassfish_v3_lo.html</link>
         <description>&lt;p&gt;
Logging in GlassFish V3 has undergone some changes to leverage the logging utility in JDK. This blogs reviews where we are with the logging mechanism in GlassFish Prelude and since not all of the features are implemented in the Prelude release yet, I'll go over how to make use of the functionality that is there. &lt;/p&gt;
&lt;p&gt;
The most significant change is that for now we don't have support in the Admin GUI or the command line tool asadmin.  That support will be provided in the final release of GlassFish V3.  For now, developers using Prelude will have to edit the &lt;b&gt;logging.properties&lt;/b&gt; file found in the domain config directory where you find the domain.xml file.  Let's take a look at what can be done.&lt;/p&gt;
&lt;p&gt;
Developers can update the logger level, change the log filename and set rotation of log files based on file size or a time limit.  Some of these changes require a restart of the server and some don't.  &lt;/p&gt;
&lt;p&gt;
First let's talk about setting log levels on loggers.  Changes to logger levels are dynamic and don't require a server restart.  At the end of the &lt;b&gt;logging.properties&lt;/b&gt; file you will find a list of loggers in GlassFish.  I have included the most common loggers so developers can easily find what they want.  Below is an excerpt from that file.&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;#Tools Logger&lt;br /&gt;#javax.enterprise.system.tools.level=FINE&lt;br /&gt;# EJB Logger&lt;br /&gt;#javax.enterprise.system.container.ejb.level=FINE&lt;br /&gt;#JAVAMAIL_LOGGER&lt;br /&gt;#javax.enterprise.resource.javamail.level=FINE&lt;br /&gt;#JMS_LOGGER&lt;br /&gt;#javax.enterprise.resource.jms.level=FINE&lt;br /&gt;#WEB LOGGER&lt;br /&gt;#javax.enterprise.system.container.web.level=FINE&lt;br /&gt;#CMP_LOGGER&lt;br /&gt;#javax.enterprise.system.container.cmp.level=FINE&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
By default all the logger levels are set to &lt;b&gt;INFO&lt;/b&gt; because the root level is set to &lt;b&gt;INFO&lt;/b&gt;.  If the log level is not set on a logger then it inherits the level of its parent going up the chain until it finds a logger with the level set or it reaches the root logger.  To set the level on a specific logger you simply uncomment the line in &lt;b&gt;logging.properties&lt;/b&gt; corresponding to the logger and set the level appropriately.  Upon saving the file the logging mechanism is notified of a change to the file and resets the log levels for all known loggers based on the information in the file.  Note that you can create your own logger, specify the level in the &lt;b&gt;logging.properties&lt;/b&gt; file and it will be updated too.&lt;/p&gt;
&lt;p&gt;
The log level values are &lt;b&gt;SEVERE, WARNING, INFO, CONFIG, FINE, FINER,&lt;/b&gt; and &lt;b&gt;FINEST&lt;/b&gt;.  Each level includes messages of the level above it so if you set a logger to level &lt;b&gt;INFO&lt;/b&gt; you will also get the &lt;b&gt;SEVERE&lt;/b&gt; and &lt;b&gt;WARNING&lt;/b&gt; messages in addition to the &lt;b&gt;INFO&lt;/b&gt;.  &lt;/p&gt;
&lt;p&gt;
One last note about log levels, it is valid to set the level of the loggers at any point in the logger name.  For example, say you want all the loggers under javax.enterprise.system.container to print at the &lt;b&gt;FINE&lt;/b&gt; level. You simply create a line as follows and save the file.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;javax.enterprise.system.container.level=FINE&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  Once set, the logger level must be explicitly reset to change the level.  &lt;/p&gt;
&lt;p&gt;
Setting file rotation is also done by changing properties in &lt;b&gt;logging.properties&lt;/b&gt;.  Changing these properties does require a server restart to take affect.  There are two ways to set file rotation in Prelude.  You can request files be rotated based on a file size or based on a time limit.  The properties associated with file rotation are below.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;# 0 for no rotation based on time&lt;br /&gt;com.sun.enterprise.server.logging.FileandSyslogHandler.rotationTimelimitInMinutes=0&lt;br /&gt;# rotation limit in bytes, 0 means no rotation, 500000 is the minimum&lt;br /&gt;com.sun.enterprise.server.logging.FileandSyslogHandler.rotationLimitInBytes=0&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
By default both are set to 0 or no file rotation. If both are set then rotation will be based on time.  You can specify the max size of the log file reached to rotate or create the next log file or the max elapsed time reached to rotate the log file.  &lt;/p&gt;
&lt;p&gt;
For now developers will need to edit the &lt;b&gt;logging.properties&lt;/b&gt; file and it should be pretty straight forward. But remember that the team is working on providing tool support for GlassFish V3 final so it will be easier soon.&lt;/p&gt;</description>
         <guid isPermaLink="false">241021 at http://www.java.net</guid>
         <pubDate>Tue, 28 Oct 2008 21:30:51 +0000</pubDate>
      </item>
      <item>
         <title>Ajax Waiter</title>
         <link>http://www.java.net/blog/gmurray71/archive/2008/10/ajax_waiter.html</link>
         <description>&lt;p id=&quot;block1&quot;&gt;
I came across a situation where I needed an Ajax style spinner but could not download any images. I extended concepts from the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/samples/&quot;&gt;jMaki Revolver&lt;/a&gt; to make an image free spinner all in JavaScript.
&lt;/p&gt;
&lt;div style=&quot;height:60px;width:100px;&quot; id=&quot;spinme&quot;&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;  window.waiter.show({ speed: 1,&lt;br /&gt;                       delay : 40,&lt;br /&gt;                       targetId : 'body',&lt;br /&gt;                       textColor : '#FFF',&lt;br /&gt;                       background: 'green',&lt;br /&gt;                       opacity : 85,&lt;br /&gt;                       message : 'Please wait 2'});&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot;&gt;Test on this page&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
For detailed documentation on all the properties and more examples see the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://gregmurray.org/waiter&quot;&gt;Ajax Waiter&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;If there are features or enhancements you would like to see let me know.&lt;/p&gt;</description>
         <guid isPermaLink="false">241061 at http://www.java.net</guid>
         <pubDate>Mon, 27 Oct 2008 00:28:42 +0000</pubDate>
      </item>
      <item>
         <title>Enabling performance feature in jMaki</title>
         <link>http://www.java.net/blog/carlavmott/archive/2008/10/enabling_perfor.html</link>
         <description>&lt;p&gt;
Last spring we added performance enhancements to jMaki based on well known guidelines for improving page load times.  The &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://developer.yahoo.com/performance/&quot;&gt;guidelines are from Yahoo&lt;/a&gt; and we have automated several of them.  Now developers can combine JavaScript code and place it at the end of the page, place combine CSS code and place it at the beginning of the page, use minified resources and set the max age header by simply setting some properties in their web app. For more information about the performance enhancements and what is happening under the hood, see the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/performance.html&quot;&gt;jMaki performance page&lt;/a&gt;.  This blog details how to take advantage of those performance enhancements in your application.  &lt;/p&gt;
&lt;p&gt;I used Netbeans to create the web application but you can use Eclispe or a plain editor. In this example, I have the jMaki menu, tag cloud and blocklist widgets.  You can use any jMaki wrapped widgets or custom jMaki widgets that you have created to take advantage of this feature. The page looks like:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;%@ taglib prefix=&quot;a&quot; uri=&quot;http://jmaki/v1.0/jsp&quot; %&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;&lt;br /&gt;&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;    &amp;lt;head&amp;gt;&lt;br /&gt;        &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;jmaki-2column-footer.css&quot; type=&quot;text/css&quot;&amp;gt;&amp;lt;/link&amp;gt;&lt;br /&gt;        &amp;lt;title&amp;gt;Page Title&amp;lt;/title&amp;gt;&lt;br /&gt;        &amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;a:page&amp;gt;&lt;br /&gt;    &amp;lt;/head&amp;gt;&lt;br /&gt;    &amp;lt;body&amp;gt;&lt;br /&gt;        &amp;lt;div id=&quot;border&quot;&amp;gt;&lt;br /&gt;            &lt;br /&gt;            &amp;lt;div id=&quot;header&quot;&amp;gt;&lt;br /&gt;                &amp;lt;div id=&quot;banner&quot;&amp;gt;Application Name&amp;lt;/div&amp;gt;&lt;br /&gt;                &lt;br /&gt;                &amp;lt;div id=&quot;subheader&quot;&amp;gt;&lt;br /&gt;                    &lt;br /&gt;                    &amp;lt;div&amp;gt;                      &lt;br /&gt;&amp;lt;a:widget name=&quot;jmaki.menu&quot;&lt;br /&gt;      value=&quot;{menu : [&lt;br /&gt;       {label: 'Links',&lt;br /&gt;            menu: [&lt;br /&gt;                { label : 'Sun.com',&lt;br /&gt;                  href : 'http://www.sun.com'},&lt;br /&gt;                { label : 'jMaki.com',&lt;br /&gt;                  href : 'http://www.jmaki.com'}&lt;br /&gt;                ]&lt;br /&gt;       },&lt;br /&gt;       {label: 'Actions',&lt;br /&gt;            menu: [&lt;br /&gt;                { label : 'Select',&lt;br /&gt;                  action :{topic: '/foo/select',&lt;br /&gt;                         message: { targetId : 'bar'}}&lt;br /&gt;                },&lt;br /&gt;                { label :'Set Content',&lt;br /&gt;                  action :{topic: '/foo/setContent',&lt;br /&gt;                         message: { value : 'test.jsp'}}&lt;br /&gt;                }&lt;br /&gt;                ]}&lt;br /&gt;                ]&lt;br /&gt;       }&quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                    &amp;lt;/div&amp;gt;&lt;br /&gt;                    &lt;br /&gt;                &amp;lt;/div&amp;gt; &amp;lt;!-- sub-header --&amp;gt;&lt;br /&gt;            &amp;lt;/div&amp;gt; &amp;lt;!-- header --&amp;gt;&lt;br /&gt;&lt;br /&gt;            &amp;lt;div id=&quot;main&quot;&amp;gt;&lt;br /&gt;                &amp;lt;div id=&quot;rightColumn&quot; style=&quot;height:400px&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;a:widget name=&quot;jmaki.blockList&quot; value=&quot;[&lt;br /&gt;        {title : 'jMaki Project Home', link : 'https://ajax.dev.java.net', description : 'Where to go for the latest jMaki.' },&lt;br /&gt;        {title : 'jMaki Widgets Home', link : 'https://widgets.dev.java.net', description : 'The source for the latest jMaki widgets.' },&lt;br /&gt;        {title : 'jMaki-Charting Home', link : 'https://jmaki-charting.dev.java.net', description : 'Enables complex charts rendered on the client in any modern browser.' }&lt;br /&gt;    ]&quot;  /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                &amp;lt;/div&amp;gt; &amp;lt;!-- end leftColumn --&amp;gt;&lt;br /&gt;&lt;br /&gt;                &amp;lt;div id=&quot;leftColumn&quot; style=&quot;height:400px&quot;&amp;gt;&lt;br /&gt;&amp;lt;a:widget name=&quot;jmaki.tagcloud&quot; value=&quot;{&lt;br /&gt;  items : [&lt;br /&gt;      { label : 'jMaki', weight : 70},&lt;br /&gt;      { label : 'Web2.0', weight : 150},&lt;br /&gt;      { label : 'JSON', weight : 80},&lt;br /&gt;      { label : 'JavaScript', weight : 145},&lt;br /&gt;      { label : 'Java', weight : 100},&lt;br /&gt;      { label : 'RSS', weight : 85},&lt;br /&gt;      { label : 'Autocomplete', weight : 75},&lt;br /&gt;      { label : 'Sun', weight : 65, href : 'http://www.sun.com'},&lt;br /&gt;      { label : 'jMaki', weight : 150},&lt;br /&gt;      { label : 'Web3.0', weight : 70},&lt;br /&gt;      { label : 'Phobos', weight : 105},&lt;br /&gt;      { label : 'Glassfish', weight : 120},&lt;br /&gt;      { label : 'RSS2.0', weight : 75},&lt;br /&gt;      { label : 'Web1.0', weight : 50},&lt;br /&gt;      { label : 'JavaEE', weight : 75},&lt;br /&gt;      { label : 'Jersey', weight : 115},&lt;br /&gt;      { label : 'Roller', weight : 150},&lt;br /&gt;      { label : 'CSS', weight : 105},&lt;br /&gt;      { label : 'DHTML', weight : 65},&lt;br /&gt;      { label : 'Netbeans', weight : 115, href : 'http://www.netbeans.com'}&lt;br /&gt;  ]&lt;br /&gt;}&quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;                &amp;lt;/div&amp;gt; &amp;lt;!-- leftColumn --&amp;gt;&lt;br /&gt;&lt;br /&gt;            &amp;lt;/div&amp;gt; &amp;lt;!-- main --&amp;gt;&lt;br /&gt;            &amp;lt;div id=&quot;footer&quot;&amp;gt;Footer&amp;lt;/div&amp;gt;&lt;br /&gt;        &amp;lt;/div&amp;gt; &amp;lt;!-- border --&amp;gt;&lt;br /&gt;        &amp;lt;/a:page&amp;gt;&lt;br /&gt;    &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
This is a typical jMaki page expect I added 2 new tags.  The  tag at the beginning tells the jMaki performance code to drop the CSS code and should be in the header.  The closing  tag tells jMaki where to drop the combined JavaScript code and should be the last line in the body typically.&lt;/p&gt;
&lt;p&gt;
One other change required is to the web.xml file.  You will need to set some properties to true and to configure the servlet that does the work.  The following needs to be added to the web.xml file.  &lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;   &amp;lt;context-param&amp;gt;&lt;br /&gt;        &amp;lt;param-name&amp;gt;jmaki-combinescripts&amp;lt;/param-name&amp;gt;&lt;br /&gt;        &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;br /&gt;    &amp;lt;/context-param&amp;gt;&lt;br /&gt;    &amp;lt;context-param&amp;gt;&lt;br /&gt;        &amp;lt;param-name&amp;gt;jmaki-combinestyles&amp;lt;/param-name&amp;gt;&lt;br /&gt;        &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;br /&gt;    &amp;lt;/context-param&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;servlet&amp;gt;&lt;br /&gt;        &amp;lt;servlet-name&amp;gt;Combined Resource Servlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;        &amp;lt;servlet-class&amp;gt;jmaki.runtime.CombinedResourceServlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;        &amp;lt;load-on-startup&amp;gt;2&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;        &amp;lt;/servlet&amp;gt;&lt;br /&gt;        &lt;br /&gt;    &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;        &amp;lt;servlet-name&amp;gt;Combined Resource Servlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;        &amp;lt;url-pattern&amp;gt;/cr&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;    &amp;lt;/servlet-mapping&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
That's it.  Look at the page source of the deployed application and you will see that things have been moved around.  One application reported a 30% improvement in page load time by simply setting these properties.  &lt;/p&gt;
&lt;p&gt;
Try it out and let us know what improvements you see.&lt;/p&gt;</description>
         <guid isPermaLink="false">241044 at http://www.java.net</guid>
         <pubDate>Thu, 23 Oct 2008 03:48:29 +0000</pubDate>
      </item>
      <item>
         <title>Happy Birthday NetBeans from jMaki</title>
         <link>http://www.java.net/blog/carlavmott/archive/2008/10/happy_birthday.html</link>
         <description>&lt;p&gt;
I was happy to see that the NetBeans birthday celebration page uses the jMaki revolver widget.   Go to &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.netbeans.org/birthday/&quot;&gt;netbeans.org/birthday&lt;/a&gt; and you will find the revolver used to easily access an interview with James Gosling, pages pointing to community members, a contest and more. It's a great use of the widget.&lt;/p&gt;
&lt;p&gt;
Happy Birthday NetBeans!&lt;/p&gt;</description>
         <guid isPermaLink="false">241046 at http://www.java.net</guid>
         <pubDate>Wed, 22 Oct 2008 00:00:41 +0000</pubDate>
      </item>
      <item>
         <title>&quot;JSF and Ajax Past, Present and Future&quot; @ AjaxWorld</title>
         <link>http://www.java.net/blog/rogerk/archive/2008/10/jsf_and_ajax_pa.html</link>
         <description>&lt;p&gt;Andy Schwartz (Oracle Corp/JSF 2.0 EG member) and I will be speaking at &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://ajaxworld.com&quot;&gt;Ajax World&lt;/a&gt; next week on &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://ajaxworld.com/event/session/47&quot;&gt;JSF and Ajax Past, Present and Future&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;
The session will explore the variety of JSF Ajax frameworks available today.  Then you will get a preview of the Ajax work that is being standardized in the JSF 2.0 specification.
&lt;/p&gt;</description>
         <guid isPermaLink="false">241016 at http://www.java.net</guid>
         <pubDate>Fri, 17 Oct 2008 14:13:34 +0000</pubDate>
      </item>
      <item>
         <title>JavaServer Faces 2.0 Early Draft Review 2 And JavaScript?</title>
         <link>http://www.java.net/blog/rogerk/archive/2008/09/javaserver_face.html</link>
         <description>&lt;p&gt;
The JavaScript public API is the beginnings of the client side portion of&lt;br /&gt;
the JavaServer Faces / Ajax standard.  The JavaServer Faces 2.0 Expert Group includes members representing other JavaServer Faces / Ajax frameworks such as RichFaces, ADF Faces (Trinidad) and ICEfaces.
&lt;/p&gt;
&lt;p&gt;
We're definitely exploring new territory here, as this is the first time&lt;br /&gt;
that a public JavaScript API has been introduced with JavaServer Faces to  the JCP.  It may be the first time a public JavaScript API has been&lt;br /&gt;
introduced to the JCP, period.&lt;/p&gt;</description>
         <guid isPermaLink="false">240863 at http://www.java.net</guid>
         <pubDate>Mon, 15 Sep 2008 13:41:20 +0000</pubDate>
      </item>
      <item>
         <title>Getting server side data into a jMaki widget</title>
         <link>http://www.java.net/blog/carlavmott/archive/2008/08/getting_server.html</link>
         <description>&lt;img border=&quot;0&quot; align=&quot;left&quot;/&gt;&lt;p&gt;I got to help out with the EJB 3.1 keynote demo for JavaOne.  Although the demo shows how simple it is to perform CRUD operations using EJB 3.1, this blog focuses on the communication between the client side jMaki components and server side servlet.  &lt;/p&gt;
&lt;p&gt;
For more information on the new EJB features in &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://glassfish.dev.java.net//downloads/v3-techPreview-2.html&quot;&gt;GlassFish v3&lt;/a&gt; see &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blogs.sun.com/MaheshKannan/&quot;&gt;Mahesh's blog&lt;/a&gt;.   The demo uses some of the latest features in EJB 3.1 and MySQL for a backend data store. I will discuss the client side code for passing data to the server and getting data from the server and displaying it in a widget.  The demo shows how simple it is to perform CRUD operations using EJB 3.1. &lt;/p&gt;
&lt;p&gt;
One requirement was to use the Dojo's Fisheye widget since it looks cool and so I created a set of pages, one each for the operations create, update and delete.  The appropriate page is selected using the fisheye widget so the user could provide the necessary data.  Once the user submitted the data I could then send the request to the server to update the database.  &lt;/p&gt;
&lt;p&gt;
In this demo, I used the Dojo fisheye widget for navigation, html forms for collecting data from the user, Yahoo dialog for displaying errors and a Dojo table to display the data.  The server side code is specific to EJB 3.1 and so must run on GlassFish V3 with the EJB module installed.  MySQL data base is used for storing data.
&lt;p&gt;
A screen shot of the demo:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;crudapp.jpeg&quot; src=&quot;http://weblogs.java.net/blog/carlavmott/archive/crudapp.jpeg&quot; width=&quot;823&quot; height=&quot;350&quot;/&gt;&lt;/p&gt;
&lt;p&gt;
Let's look at some of the details. The code for the index.jsp page follows.  Notice that the table is getting data from the servlet &quot;/AuthorServlet&quot; which is returning data in JSON format.  The data base is prepopulated with data so the table is rendered with some rows of data.  I dropped the Yahoo dialogs in the page and made them not visible. The fisheye widget is used for navigation and there are three other pages in the application which are loaded by the dcontainer based on the selection by the fisheye.  More details on that below.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;%@ taglib prefix=&quot;a&quot; uri=&quot;http://jmaki/v1.0/jsp&quot; %&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;&lt;br /&gt;&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;    &amp;lt;head&amp;gt;&lt;br /&gt;        &amp;lt;link rel=&quot;stylesheet&quot; href=&quot;jmaki-2column-footer.css&quot; type=&quot;text/css&quot;&amp;gt;&amp;lt;/link&amp;gt;&lt;br /&gt;        &amp;lt;title&amp;gt;Page Title&amp;lt;/title&amp;gt;&lt;br /&gt;        &amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/head&amp;gt;&lt;br /&gt;    &amp;lt;body&amp;gt;&lt;br /&gt;        &amp;lt;div id=&quot;border&quot;&amp;gt;&lt;br /&gt;            &lt;br /&gt;            &amp;lt;div id=&quot;header&quot;&amp;gt;&lt;br /&gt;                &amp;lt;div id=&quot;banner&quot;&amp;gt;CRUD operations using EJB 3.1 &amp;lt;/div&amp;gt;&lt;br /&gt;                               &lt;br /&gt;            &amp;lt;/div&amp;gt; &amp;lt;!-- header --&amp;gt;&lt;br /&gt;&lt;br /&gt;            &amp;lt;div id=&quot;main&quot;&amp;gt;&lt;br /&gt;                &amp;lt;div id=&quot;rightColumn&quot; style=&quot;height:600px&quot;&amp;gt;&lt;br /&gt;                    &amp;lt;div id=&quot;rightColumnTop&quot; style=&quot;height:180px&quot;&amp;gt;&lt;br /&gt;                        &amp;lt;div id=&quot;rightColunmTopTable&quot; style=&quot;height:180px&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;             &amp;lt;a:widget&lt;br /&gt;                      name=&quot;jmaki.dcontainer&quot;&lt;br /&gt;                      subscribe=&quot;/jmaki/forms&quot;&lt;br /&gt;                      value=&quot;{&lt;br /&gt;                            items : [&lt;br /&gt;                              { id : 'create',include : 'create.jsp', overflow : 'hidden'}, &lt;br /&gt;                              { id : 'update', include : 'update.jsp', overflow : 'hidden', lazyLoad : true},&lt;br /&gt;                              { id : 'delete', include : 'delete.jsp', overflow : 'hidden', lazyLoad : true}&lt;br /&gt;                             ]&lt;br /&gt;                          }&quot;/&amp;gt;  &lt;br /&gt;                  &amp;lt;/div&amp;gt;&lt;br /&gt;                  &amp;lt;div id=&quot;rightColumnTopImages&quot; style=&quot;height:180px&quot;&amp;gt;&lt;br /&gt;                      Powered by:&lt;br /&gt;                      &amp;lt;div&amp;gt;&lt;br /&gt;                      &amp;lt;img src=&quot;images/glassfish-logo.jpg&quot;&amp;gt;&lt;br /&gt;                  &amp;lt;/div&amp;gt;&lt;br /&gt;                  &amp;lt;div&amp;gt;&lt;br /&gt;                      &amp;lt;img src=&quot;images/jmaki-seal.png&quot;&amp;gt;&lt;br /&gt;                  &amp;lt;/div&amp;gt;&lt;br /&gt;                  &amp;lt;/div&amp;gt;&lt;br /&gt;                &amp;lt;/div&amp;gt; &amp;lt;!-- end leftColumn --&amp;gt;&lt;br /&gt;                &amp;lt;div id=&quot;rightColumnBottom&quot; style=&quot;height:415px&quot;&amp;gt;&lt;br /&gt;             &lt;br /&gt;             &amp;lt;!--&amp;lt;center&amp;gt;Author Table &amp;lt;/center&amp;gt;--&amp;gt;&lt;br /&gt;             &lt;br /&gt;             &amp;lt;a:widget name=&quot;dojo.table&quot;&lt;br /&gt;            service=&quot;/AuthorServlet&quot; /&amp;gt;&lt;br /&gt;                    &lt;br /&gt;                &amp;lt;/div&amp;gt; &amp;lt;!-- end leftColumn --&amp;gt;&lt;br /&gt;                                 &lt;br /&gt;                &amp;lt;/div&amp;gt; &amp;lt;!-- end leftColumn --&amp;gt;&lt;br /&gt;&lt;br /&gt;                &amp;lt;div id=&quot;leftColumn&quot; style=&quot;height:600px&quot;&amp;gt;&lt;br /&gt;                    &amp;lt;a:widget name=&quot;dojo.fisheye&quot; args=&quot;{orientation:'vertical'}&quot; value=&quot;[ &lt;br /&gt;     {iconSrc:'images/document-new.png',&lt;br /&gt;      label : 'Create',&lt;br /&gt;      action : { topic : '/jmaki/forms/select', message : {targetId : 'create'}}&lt;br /&gt;     },&lt;br /&gt;     {iconSrc:'images/edit-find-replace.png',&lt;br /&gt;      label : 'Update',&lt;br /&gt;      action : { topic : '/jmaki/forms/select', message : {targetId : 'update'}}&lt;br /&gt;      },&lt;br /&gt;      {iconSrc:'images/edit-delete.png',&lt;br /&gt;      label : 'Delete',&lt;br /&gt;      action : { topic : '/jmaki/forms/select', message : {targetId : 'delete'}}&lt;br /&gt;      }&lt;br /&gt;     ]&quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;a:widget id=&quot;dialog1&quot; name=&quot;yahoo.simpledlg&quot;args=&quot;{header : 'Error Found', visible: false, text: 'Duplicate Author Id entry found.  Provide a unique Author Id'}&quot;&lt;br /&gt;                    value=&quot;{buttons: [ &lt;br /&gt;        { label:'ok', isDefault:true }&lt;br /&gt;        ] }&quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;a:widget id=&quot;dialog2&quot; name=&quot;yahoo.simpledlg&quot;args=&quot;{header : 'Error Found', visible: false, text:  'Author Id entry not found.  Provide a Author Id'}&quot;&lt;br /&gt;                    value=&quot;{buttons: [ &lt;br /&gt;        { label:'ok', isDefault:true }&lt;br /&gt;        ] }&quot;/&amp;gt;&lt;br /&gt;          &lt;br /&gt;                &amp;lt;/div&amp;gt; &amp;lt;!-- leftColumn --&amp;gt;&lt;br /&gt;&lt;br /&gt;            &amp;lt;/div&amp;gt; &amp;lt;!-- main --&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;/div&amp;gt; &amp;lt;!-- border --&amp;gt;&lt;br /&gt;    &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Now lets look at how to create an entry in the data which will be reflected in the table.  First let's look at the page create.jsp.&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt; Enter Data to Create Author Entry: &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;                  &amp;lt;form name=&quot;create&quot;  &amp;gt;&lt;br /&gt;  Author Id: &amp;lt;input type=&quot;text&quot; id=&quot;authorId&quot; name=authorId/&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;  Author: &amp;lt;input type=&quot;text&quot; id=&quot;authorName&quot; name=authorName/&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;  Organization: &amp;lt;input type=&quot;text&quot; id=&quot;organization&quot; name=organization/&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;  &amp;lt;br&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;   &amp;lt;input type=&quot;hidden&quot;  id=&quot;hidden&quot; name=&quot;create&quot; value=&quot;create&quot;&amp;gt;&lt;br /&gt;   &amp;lt;input type=&quot;button&quot; onclick=&quot;doCreate()&quot; name=&quot;submit&quot; value=&quot;create&quot;&amp;gt;&lt;br /&gt;  &amp;lt;/form&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
As you can see this is a simple form which calls the doCreate function to extract the data.  The doCreate function is in glue.js.  &lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;var Service=&quot;/crud/AuthorServlet&quot;;&lt;br /&gt;var rowId;&lt;br /&gt;&lt;br /&gt;function doCreate(){&lt;br /&gt;    var opName = &quot;create&quot;;&lt;br /&gt;    &lt;br /&gt;    var authorName = document.getElementById(&quot;authorName&quot;).value;&lt;br /&gt;    var authorId = document.getElementById(&quot;authorId&quot;).value;&lt;br /&gt;    var orgName = document.getElementById(&quot;organization&quot;).value;&lt;br /&gt;       &lt;br /&gt;      jmaki.doAjax({method: &quot;POST&quot;,&lt;br /&gt;        url: &quot;/crud/AuthorServlet&quot;,&lt;br /&gt;        content :  { authorName: authorName, authorId : authorId, orgName : orgName, opName: opName }, &lt;br /&gt;        callback: function(_req) {&lt;br /&gt;            var tmp = _req.responseText;&lt;br /&gt;	    if(!tmp)  {&lt;br /&gt;                 var a = jmaki.getWidget(&quot;dialog1&quot;);&lt;br /&gt;                 a.setVisible(true);&lt;br /&gt;            }  else {&lt;br /&gt;	       var obj = eval(&quot;(&quot; + tmp + &quot;)&quot;);&lt;br /&gt;                if ( opName == &quot;create&quot;)&lt;br /&gt;                     jmaki.publish('/table/addRow', obj);&lt;br /&gt;		else {&lt;br /&gt;		    jmaki.publish('/table/updateRow', obj);&lt;br /&gt;	       }&lt;br /&gt;	   }&lt;br /&gt;        },&lt;br /&gt;        onerror: function() {&lt;br /&gt;                 var a = jmaki.getWidget(&quot;dialog1&quot;);&lt;br /&gt;                 a.setVisible(true);            &lt;br /&gt;                    }&lt;br /&gt;     });&lt;br /&gt;     document.forms.create.reset();&lt;br /&gt;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; After extracting the data from the form I use jmaki.doAjax to send the data to the server.  I use the property &quot;content&quot; with the values I extracted because this property will pass the data to the server correctly regardless of the platform.  In other words the right thing happens if the server is Java or PHP.  The callback function is called if there were no errors on the server and if so the data received is passed to the table using the standard jMaki publish and subscribe mechanism.  If there was an error on the server the onerror function is called and in this case I set the error dialog to visible.  &lt;/p&gt;
&lt;p&gt;Here is a screen shot of the application with the error dialog:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;cruderror.jpeg&quot; src=&quot;http://weblogs.java.net/blog/carlavmott/archive/cruderror.jpeg&quot; width=&quot;824&quot; height=&quot;359&quot;/&gt;&lt;/p&gt;
&lt;p&gt;
Finally I wanted to describe how the fisheye is used to display the correct form.  Looking at the fisheye widget tag you see that each icon will publish to the &quot;/jmaki/forms/select&quot; and the payload contains a string used to identify the operation selected.   The dcontainer subscribes the the &quot;/jmaki/forms&quot; topic.  The dcontainer contains a select handler which looks up the id that it was passed, in this case 'create' and the includes the page create.jsp.  &lt;/p&gt;
&lt;p&gt;
I have posted the war file on the documents and files &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/servlets/ProjectDocumentList?folderID=9263&quot;&gt; demo area&lt;/a&gt;.  I also have the processRequest method from the AuthorServlet code below so it is easier to see what the server is doing.  There are several helper classes that update the data base or convert Java objects into JSON that are not shown.  &lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;@PersistenceUnit(name=&quot;myAuthorEMF&quot;, unitName = &quot;WebEjbJpaPU&quot;)&lt;br /&gt;public class AuthorServlet extends HttpServlet {&lt;br /&gt;   &lt;br /&gt;    @EJB private AuthorBean authorRef;&lt;br /&gt;    &lt;br /&gt;    //private AuthorHelper authorRef = new AuthorHelper();&lt;br /&gt;    &lt;br /&gt;    /**         &lt;br /&gt;    * Processes requests for both HTTP [prettify]GET&lt;/code&gt;&lt;/pre&gt; and &lt;code class=&quot;prettyprint&quot;&gt;POST&lt;/code&gt; methods.
    * @param request servlet request
    * @param response servlet response
    */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        try {
            String opName = request.getParameter(&quot;opName&quot;);
            
            int matchID = -1;
            
            Author author = null;
            
            if (opName == null) {
                opName = &quot;list&quot;;
            } else {
                author = new Author();
                author.setAuthorId(
                        Integer.valueOf(request.getParameter(&quot;authorId&quot;)));
                author.setName(request.getParameter(&quot;authorName&quot;));
                author.setOrganisation(request.getParameter(&quot;orgName&quot;));
            }
            
            if (&quot;update&quot;.equals(opName)) {                
                authorRef.updateAuthor(author);
            } else  if (&quot;create&quot;.equals(opName)) {
                authorRef.createAuthor(author);
            } else if (&quot;delete&quot;.equals(opName)) {
                authorRef.deleteAuthor(author);
            }
            
            sendOutData(author, opName, out);
        } finally { 
            out.close();
        }
    }
    
[/prettify]
&lt;p&gt;
That's it.&lt;/p&gt;</description>
         <guid isPermaLink="false">240230 at http://www.java.net</guid>
         <pubDate>Mon, 25 Aug 2008 16:53:15 +0000</pubDate>
      </item>
      <item>
         <title>Writing jMaki widgets in the real world</title>
         <link>http://www.java.net/blog/carlavmott/archive/2008/08/writing_jmaki_w.html</link>
         <description>&lt;p&gt;
I found that &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.travelmuse.com/&quot;&gt;TravelMuse&lt;/a&gt; is a great site to help plan vacations and I was excited to learn that they use jMaki to build the site.   &lt;/p&gt;
&lt;p&gt;
Daniel Ziaoure is the lead Web developer for TravelMuse and uses jMaki extensively.  We were lucky enough to have him join us during our Community One day presentation on jMaki.  He recently started a series of articles explaining how he uses the jMaki widget model and communication mechanism to build the useful and impressive site. His first article &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://cybergeniusdz.wordpress.com/2008/07/14/building-an-ajax-login-with-jmaki/&quot;&gt;Building an Ajax Login with jMaki&lt;/a&gt; shows how he used jMaki to build an Ajax enable login widget.  &lt;/p&gt;
&lt;p&gt;</description>
         <guid isPermaLink="false">240733 at http://www.java.net</guid>
         <pubDate>Wed, 20 Aug 2008 21:00:34 +0000</pubDate>
      </item>
      <item>
         <title>irc channel for GlassFish webtier</title>
         <link>http://www.java.net/blog/mode/archive/2008/08/irc_channel_for.html</link>
         <description>&lt;p&gt;We now have a dedicated irc channel for the GlassFish webtier where you can chat with the engineering team members. It is on irc.freenode.net. For help on how to use irc, the clients for the various OS  &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://irchelp.org&quot;&gt;click here&lt;/a&gt;.&lt;br /&gt;
There is also a FAQ for freenode that you  should refer to for any questions regarding usage of freenode. It is located &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://freenode.net/faq.shtml&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt; Update&lt;/b&gt;: Someone pointed out that I forgot to put the channel name - it is glassfish-webtier.&lt;/p&gt;</description>
         <guid isPermaLink="false">240649 at http://www.java.net</guid>
         <pubDate>Tue, 05 Aug 2008 17:51:58 +0000</pubDate>
      </item>
      <item>
         <title>jMaki and GWT : Kissing Cousins</title>
         <link>http://www.java.net/blog/gmurray71/archive/2007/12/jmaki_and_gwt_k.html</link>
         <description>&lt;img border=&quot;0&quot; align=&quot;left&quot;/&gt;&lt;p&gt;
Sun has been providing GWT support with the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://gwt4nb.dev.java.net/&quot;&gt;GWT For Netbeans plugin&lt;/a&gt; for some time now. The plugin allows you to very easily create GWT applications that can run on Tomcat and Glassfish. The plugin allows you to easily integrate servlets and other Java EE components in an IDE environment.
&lt;/p&gt;
&lt;p&gt;With my Ajax dealings over the past few years I have been asked about jMaki and GWT integration. For some time I had thought that GWT was a competing technology but I have come to realize that while jMaki and GWT are truly cousins whose marriage is in this case a good thing.
&lt;/p&gt;
&lt;p&gt;
When integrating jMaki with GWT jMaki provides a well defined model for interacting with JavaScript and GWT provides a model for interacting with Java. jMaki can open up the JavaScript universe to GWT in a well controlled manner.
&lt;/p&gt;
&lt;p&gt;
As a start the jMaki team would like to introduce the GWT community to &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jmaki-charting.dev.java.net&quot;&gt;jMaki Charting&lt;/a&gt;. jMaki charting provides dynamic charting capabilities where charts can be manipulated on the client without round trips to the server.
&lt;/p&gt;
&lt;p&gt;Integrating jMaki charting with GWT has helped us develop a really good integration strategy for GWT and JavaScript for which we created an &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/gwt-charting.html&quot;&gt;architecture document&lt;/a&gt;. The integration can be summarized by the graphic below.
&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://jmaki.com/images/gwt-jmaki-component.jpg&quot; height=&quot;302&quot; width=&quot;300&quot;/&gt;&lt;/p&gt;
&lt;p&gt;
With the GWT jMaki integration we are exposing the charting  functionality including Axes creation and updates, DataSets, and Markers through a set of Java APIs. See the JavaDoc APIs &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jmaki-charting.dev.java.net/nonav/javadoc/index.html&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
All the resources needed for the component are provided in a single jar file that you simply place in your classpath and include the &lt;code class=&quot;prettyprint&quot;&gt;jmaki.charting.Widgets&lt;/code&gt; inherits statement in your gwt.xml file. jMaki charting may be &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://jmaki-charting.dev.java.net/servlets/ProjectDocumentList?folderID=8494&amp;amp;expandFolder=8494&amp;amp;folderID=0&quot;&gt;downloaded&lt;/a&gt;  from the jMaki Charting homepage. It supports both Hosted or Web mode.
&lt;/p&gt;
&lt;p&gt;We have also created a sample application to show how to use and modify a chart. You can see the application &lt;a rel=&quot;nofollow&quot;&gt;live&lt;/a&gt; here.&lt;/p&gt;
&lt;p&gt;
Charting is just the beginning. We are now working on providing access to the jMaki widgets and would love to have the community get involved. Would you like to join us?
&lt;/p&gt;</description>
         <guid isPermaLink="false">239363 at http://www.java.net</guid>
         <pubDate>Sat, 22 Dec 2007 03:41:21 +0000</pubDate>
      </item>
      <item>
         <title>jMaki and the Open Ajax 1.0 Hub</title>
         <link>http://www.java.net/blog/gmurray71/archive/2007/10/jmaki_and_the_o.html</link>
         <description>&lt;p&gt;Now that jMaki 1.0 is out we have time to look at integration with our JavaScript functionality like the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.openajax.org/OpenAjax%20Hub.html&quot;&gt;Open Ajax 1.0 Hub&lt;/a&gt;. The integration was done using a simple jMaki extension which takes the events from jMaki and republishes them on the hub. jMaki is also capable of registering libraries as they are being loaded.
&lt;/p&gt;
&lt;p&gt;
To show the integration we have published a version of the application running with Dojo, Yahoo, and jMaki integrated along with the Open Ajax Hubs components on &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jmaki.com/oaa&quot;&gt;http://jmaki.com/oaa&lt;/a&gt;. You can find out more about the details on what we did in the description tab of the example.&lt;/p&gt;
&lt;p&gt;&lt;p&gt;How will you use the hub?&lt;/p&gt;</description>
         <guid isPermaLink="false">238840 at http://www.java.net</guid>
         <pubDate>Mon, 01 Oct 2007 22:14:16 +0000</pubDate>
      </item>
      <item>
         <title>jMaki 1.0 is Live</title>
         <link>http://www.java.net/blog/gmurray71/archive/2007/09/jmaki_10_is_liv.html</link>
         <description>&lt;p&gt;Having experienced continuous development for over 2 years it is time to put a stake in the ground and call jMaki 1.0 ready for general use. &lt;/p&gt;
&lt;p&gt;Included in the bundles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The core jMaki framework.&lt;/li&gt;
&lt;li&gt;Sample applications.&lt;/li&gt;
&lt;li&gt;Ant task for creating applications and adding widgets and necessary dependencies to those applications.&lt;/li&gt;
&lt;li&gt;All the scripts and widget libraries.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We provide bundles for both PHP and Java. The ant task for application creation allows you to create applications rapidly from the command line.&lt;/p&gt;
&lt;p&gt;We also provide plugins for both Netbeans 5.x and 6.0 that will create jMaki applications with all the necessary resources in the correct places. Included support is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The core jMaki Framework.&lt;/li&gt;
&lt;li&gt;Templates to start out with.&lt;/li&gt;
&lt;li&gt;Drag and drop widgets with templates.&lt;/li&gt;
&lt;li&gt;Theming support.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
How you experience jMaki is up to you. Find the bundles on the &lt;a rel=&quot;nofollow&quot;&gt;downloads&lt;/a&gt; page.
&lt;/p&gt;
&lt;p&gt;We have also started work on consolidating all the blogs, documents, and form posts on using jMaki into an online book. This is a work in progress and you can find the starting &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/book/toc.html&quot;&gt;table of contents&lt;/a&gt; on our developer site.&lt;/p&gt;
&lt;p&gt;I would like to thank everyone on the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/contributor-highlight.html&quot;&gt;team&lt;/a&gt; and others not listed on the team page for their hard work in putting this release together. I like to encourage would encourage you to join the effort. jMaki is going places and we would love to have you along for the ride.&lt;/p&gt;</description>
         <guid isPermaLink="false">238812 at http://www.java.net</guid>
         <pubDate>Wed, 26 Sep 2007 00:45:03 +0000</pubDate>
      </item>
      <item>
         <title>jMaki 1.0 is fast approaching</title>
         <link>http://www.java.net/blog/gmurray71/archive/2007/09/jmaki_10_is_fas.html</link>
         <description>&lt;p&gt;
&lt;br /&gt;
After over a year in community development we are preparing to release jMaki 1.0 on September 25.
&lt;/p&gt;
&lt;p&gt;
jMaki has stabilized over the past few months especially with the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://wiki.java.net/bin/view/Projects/jMakiDataModels&quot;&gt;data models&lt;/a&gt; which allow you to create some very sophisticated user interfaces.  As proof we have created &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://jmaki.com&quot;&gt;jmaki.com&lt;/a&gt; where we are hosting many of our samples and recent blog postings using jMaki.
&lt;/p&gt;
&lt;p&gt;How are you using jMaki and if not what are we missing?&lt;/p&gt;</description>
         <guid isPermaLink="false">238740 at http://www.java.net</guid>
         <pubDate>Fri, 14 Sep 2007 21:41:17 +0000</pubDate>
      </item>
      <item>
         <title>Re-Namespacing Dojo</title>
         <link>http://www.java.net/blog/gmurray71/archive/2007/08/renamespacing_d.html</link>
         <description>&lt;p&gt;
The motivation behind re-namespacing Dojo for jMaki was simple. We want to have both Dojo 0.4.3 and Dojo .9 running in the same web application and we also want to give our users the ability to use jMaki many years in the future. So I undertook the task of re-namespacing Dojo by hand and quickly found out that it was a involved task. Reason being there are 27350 instances of the word Dojo spread across 1013 files in the standard Dojo 0.4.3 Ajax release.To make things easier I have created a configurable ant task that will do the work.
&lt;/p&gt;
&lt;p&gt;Why ant? We figure it's the easiest to integrate with a build process and it's pretty easy to do string replacements that can be configured.&lt;br /&gt;
You can see the &lt;code class=&quot;prettyprint&quot;&gt;RenamespaceTask.java&lt;/code&gt; &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://widgets.dev.java.net/source/browse/*checkout*/widgets/trunk/code/tools/src/java/org/jmaki/ant/ReNamespaceTask.java?rev=521&quot;&gt;here&lt;/a&gt;. You can find a compiled version of the jar file &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://widgets.dev.java.net/servlets/ProjectDocumentList?folderID=7890&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;We have provided a simple ant file that will compile the task and run it which you can get &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://widgets.dev.java.net/source/browse/*checkout*/widgets/trunk/code/tools/namespace-dojo.xml?rev=521&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p style=&quot;font-weight:bold;&quot;&gt;Before using this task I strongly recommend you backup your files as this task will overwrite your existing files.&lt;/p&gt;
&lt;p&gt;Here are the arguments I give to the task to re-namespace dojo and all of the occurrences in all js, css, and html files. This is the the most thorough and best option as it will re-namespace all dojo files and the dojo styles.
&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;target name=&amp;quot;ns&amp;quot; description=&amp;quot;Namespace Dojo Task&amp;quot; depends=&amp;quot;jar&amp;quot;&amp;gt;&lt;br /&gt;  &amp;lt;taskdef name=&amp;quot;renamespace&amp;quot; classname=&amp;quot;org.jmaki.ant.ReNamespaceTask&amp;quot;&lt;br /&gt;                 classpath=&amp;quot;dist/ns-dojo.jar&amp;quot;/&amp;gt;&lt;br /&gt;  &amp;lt;renamespace &lt;br /&gt;       ns=&amp;quot;gojo&amp;quot;&lt;br /&gt;       tokens=&amp;quot;dojo&amp;quot; renameFile=&amp;quot;dojo.js&amp;quot; &amp;gt;&lt;br /&gt;    &amp;lt;fileset dir=&amp;quot;/Users/gmurray/Desktop/dojo-0.4.3-ajax&amp;quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/renamespace&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;   &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You simple need to provide a one or more filesets to files containing references to dojo. This simply replaces all the strings. Containing dojo.
&lt;/p&gt;
&lt;p&gt;
 You can do more advanced token sets that will not replace the styles and target only the dojo instances like the following.
&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;target name=&amp;quot;ns&amp;quot; description=&amp;quot;Namespace Dojo Task&amp;quot; depends=&amp;quot;jar&amp;quot;&amp;gt;&lt;br /&gt;  &amp;lt;taskdef name=&amp;quot;renamespace&amp;quot; classname=&amp;quot;org.jmaki.ant.ReNamespaceTask&amp;quot;&lt;br /&gt;                 classpath=&amp;quot;dist/ns-dojo.jar&amp;quot;/&amp;gt;&lt;br /&gt;  &amp;lt;renamespace&lt;br /&gt;             ns=&amp;quot;gojo&amp;quot;&lt;br /&gt;             tokens=&amp;quot;dojo.,{dojo},dojo=,dojo =,dojo:,(dojo,dojo[,/dojo,|dojo,&amp;amp;quot;dojo&amp;amp;quot;&amp;quot;&lt;br /&gt;             renameFile=&amp;quot;dojo.js&amp;quot;&lt;br /&gt;             extensions=&amp;quot;js,json,html&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;fileset dir=&amp;quot;/Users/gmurray/Desktop/dojo-0.4.3-ajax&amp;quot; /&amp;gt;&lt;br /&gt;  &amp;lt;/renamespace&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You may notice the &lt;code class=&quot;prettyprint&quot;&gt;renameFile&lt;/code&gt; attribute. This option will rename the &lt;code class=&quot;prettyprint&quot;&gt;dojo.js&lt;/code&gt; file to the same name as the namepace. &lt;/p&gt;
&lt;p&gt;
You need to rename the dojo.js to the same name as the namespace. If you leave the task defaults this will be automatically done. If you do not rename the dojo.js the dojo package loader will not look in the correct place for the dojo resources (I'm not clear why this was done but if the file names are not the same dojo will look up two directories for dojo resources). The re-namespace won't work if you don't rename.
&lt;/p&gt;
&lt;p&gt;
You will also need to re-namespace your code that uses Dojo. You can add multiple filesets so this can be done in one sweep.
&lt;/p&gt;
&lt;p&gt;When choosing a name to re-namespace to you need a valid JavaScript identifier so you can not include &quot;.&quot; or &quot;-&quot; in the name. For jMaki we chose &quot;dj4d3&quot; which is a bit cryptic but it is short and will not conflict with a future version of dojo or another library.
&lt;/p&gt;
&lt;p&gt;The beauty of re-namespacing is that you can now use two versions of Dojo in the same application and in the same page without conflicts. Both versions will share the same &lt;code class=&quot;prettyprint&quot;&gt;djConfig&lt;/code&gt; object which you may chose to also rename.
&lt;/p&gt;
&lt;p&gt;The ant task was tested with the Dojo .0.4.3 Ajax release. You can test it by simply downloading Dojo from the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://dojotoolkit.org/downloads&quot;&gt;Dojo downloads&lt;/a&gt; page and run it against the release. Then check out the samples and tests.
&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Once again make sure to backup your work before running task&lt;/span&gt;. Let me know what what you think.&lt;/p&gt;</description>
         <guid isPermaLink="false">238518 at http://www.java.net</guid>
         <pubDate>Fri, 10 Aug 2007 23:36:07 +0000</pubDate>
      </item>
      <item>
         <title>jMaki Actions</title>
         <link>http://www.java.net/blog/gmurray71/archive/2007/07/jmaki_actions.html</link>
         <description>&lt;img border=&quot;0&quot; align=&quot;left&quot;/&gt;&lt;p&gt;In &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://weblogs.java.net/blog/carlavmott/archive/2007/07/jmaki_widgets_t.html&quot;&gt;Widgets talking to Widgets&lt;/a&gt; Carla describes how widgets from different toolkits can easily communicate. There is a more basic level of communication which you can do declaratively which we call jMaki Actions&lt;/p&gt;
&lt;p&gt;
&lt;span style=&quot;font-weight:bold;&quot;&gt; jMaki Actions&lt;/span&gt; are a declarative way of associating widget behavior.
&lt;/p&gt;
&lt;p&gt;Consider a case where you have a Dojo Fisheye and you simply want it to select a tab or URL when an item is clicked. The Dojo Fisheye is in essence provides the same behavior as a menu. You may notice that the models for the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://wiki.java.net/bin/view/Projects/jMakiFisheyeModel&quot;&gt;Fisheye Model&lt;/a&gt; and the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://wiki.java.net/bin/view/Projects/jMakiMenuDataModel&quot;&gt;jMaki Menu Model&lt;/a&gt; are very similar. A Fisheye widget as a JSP tag would look as follows:
&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;a:widget name=&quot;dojo.fisheye&quot;&lt;br /&gt;             args=&quot;{labelEdge:'bottom', orientation:'vertical'}&quot;&lt;br /&gt;             value=&quot;[&lt;br /&gt;             { iconSrc:'https://ajax.dev.java.net/images/blog_murray.jpg',&lt;br /&gt;               label : 'Greg Tab',&lt;br /&gt;               action : { topic : '/yahoo/tabbedview/select',&lt;br /&gt;                          message : {targetId : 'tab1'}} },&lt;br /&gt;             { iconSrc:'https://ajax.dev.java.net/images/chinnici.jpg',&lt;br /&gt;               label : 'Roberto Tab',&lt;br /&gt;               action : { topic : '/yahoo/tabbedview/select',&lt;br /&gt;                          message : {targetId : 'tab2'}}&lt;br /&gt;             },&lt;br /&gt;             { iconSrc:'https://ajax.dev.java.net/images/JayashriVisvanathan.jpg',&lt;br /&gt;               href : 'http://jmaki.com',&lt;br /&gt;               label : 'test4'&lt;br /&gt;             }&lt;br /&gt;             ]&quot;/&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With jMaki Actions you can associate an action to be published on a given Fisheye icon. The action property will publish a message that can be picked up by another widget in the page. Let's use a Yahoo Tabbed View which is by default mapped to the topic &quot;/yahoo/tabbedview&quot;. The different action you can perform on a tabbedview are described in the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://wiki.java.net/bin/view/Projects/jMakiTabbedViewDataModel&quot;&gt;Tabbed View Data Model&lt;/a&gt;. Here is the portion of the relevant code that is the &lt;span style=&quot;font-weight:bold;&quot;&gt;action&lt;/span&gt; that occurs when item labeled 'Greg Tab' is clicked.&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;action : { topic : '/yahoo/tabbedview/select', message : {targetId : 'tab1'}}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code class=&quot;prettyprint&quot;&gt;targetId&lt;/code&gt; refers to a tab with the &lt;code class=&quot;prettyprint&quot;&gt;id&lt;/code&gt; property used by a given tab. The &lt;code class=&quot;prettyprint&quot;&gt;message&lt;/code&gt; property is included as part of the payload of a message published to the &lt;code class=&quot;prettyprint&quot;&gt;topic&lt;/code&gt; used. Clicking on the item 'Greg Tab' will end up in the 'Greg Tab' being selected and the same for the 'Roberto Tab'.
&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;a:widget name=&quot;yahoo.tabbedview&quot;&lt;br /&gt;          value=&quot;{tabs:[&lt;br /&gt;          {id : 'tab1', label : 'My Tab', content : 'Some Content'},&lt;br /&gt;          {id : 'tab2', label : 'My Tab 2', content : 'Tab 2 Content'}&lt;br /&gt;          ]&lt;br /&gt;          }&quot; /&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The end result is using the default template looks as follows:
&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://ajax.dev.java.net/images/action.jpg&quot;&gt;&lt;/p&gt;
&lt;p&gt;
jMaki models uses general conventions for behaviors and properties you can easily swap widgets. For example you could easily use a Dojo Tabbed View or even swap the FishEye for a menu or tree widget.
&lt;/p&gt;
&lt;p&gt;
jMaki actions are great for general interactions like this and makes it really easy to do basic things like this. More advanced interactions should still be done in glue code as described in &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://weblogs.java.net/blog/carlavmott/archive/2007/07/jmaki_widgets_t.html&quot;&gt;Widgets talking to Widgets&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;How will you use actions?&lt;/p&gt;</description>
         <guid isPermaLink="false">238449 at http://www.java.net</guid>
         <pubDate>Sun, 29 Jul 2007 19:01:27 +0000</pubDate>
      </item>
      <item>
         <title>jMaki Revolver Widget</title>
         <link>http://www.java.net/blog/gmurray71/archive/2007/06/jmaki_revolver.html</link>
         <description>&lt;p&gt;A few months ago I created the revolver as a weekend project to provide an alternative way of providing top level navigation on your web size. I thought I would share this with everyone as a jMaki widget.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt; 
&lt;style type=&quot;text/css&quot;&gt;
.arrowRight {}&lt;/style&gt;&lt;p&gt;&lt;br /&gt;
&lt;/p&gt; 
&lt;style type=&quot;text/css&quot;&gt;
.logo {background:none;cursor:pointer;}
.arrowRight {background:none;cursor:pointer;}
.arrowLeft {background:none;cursor:pointer;}
&lt;/style&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt; 
&lt;div id=&quot;jmaki-revolver&quot; class=&quot;revolver&quot;&gt;
&lt;div id=&quot;jmaki-revolver-content-pane&quot; class=&quot;revolverContent&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;jmaki-revolver-title-pane&quot; class=&quot;revolverTitle&quot;&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt; 
&lt;h2&gt;How to use it with jMaki&lt;/h2&gt;
&lt;h3&gt;In Netbeans&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Install the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/jmaki-plugin.html&quot;&gt;jMaki Netbeans plugin&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;Download the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://widgets.dev.java.net/servlets/ProjectDocumentList?folderID=7693&amp;expandFolder=7693&amp;folderID=0&quot;&gt;jMaki Revolver widget library&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;In Netbeans select &lt;code class=&quot;prettyprint&quot;&gt;Tools-&amp;gt;Palette-&amp;gt;Add jMaki Library&lt;/code&gt; from the menu and choose the jmaki-revolver-x.x.zip file you downloaded. A new palette named &quot;jMaki Extras&quot; will appear.
&lt;li&gt;
&lt;li&gt;From the jMaki Extras palette drag the widget into the page.
&lt;/li&gt;
&lt;li&gt;Deploy the application.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the page you will see the following:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;a:widget name=&quot;jmaki.revolver&quot;&lt;br /&gt;            value=&quot;[&lt;br /&gt;                   {title : 'Amsterdam',&lt;br /&gt;                              imgSrc : 'http://farm1.static.flickr.com/67/227194339_551e710acb_m.jpg',&lt;br /&gt;                              href : 'http://www.flickr.com/photos/44399047@N00/sets/72157594254916360/'&lt;br /&gt;                              },&lt;br /&gt;                   {title : 'Paris',&lt;br /&gt;                              imgSrc : 'http://farm1.static.flickr.com/129/319228860_23770c66d3_m.jpg',&lt;br /&gt;                              href : 'http://www.flickr.com/photos/44399047@N00/sets/72157594414671044/'&lt;br /&gt;                              },&lt;br /&gt;                   {title : 'Seoul',&lt;br /&gt;                              imgSrc : 'http://farm1.static.flickr.com/106/294268722_662da2ef5a_m.jpg',&lt;br /&gt;                              href : 'http://www.flickr.com/photos/44399047@N00/sets/72157594370026444/'&lt;br /&gt;                              }&lt;br /&gt;                   ]&quot;/&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use the jMaki customizer (context click-&amp;gt;jMaki) to customize the revolver or modify the &lt;code class=&quot;prettyprint&quot;&gt;/resources/jmaki/revolver/component.css&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;For Eclipse or Stand Alone Applications&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Install the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/eclipse&quot;&gt;jMaki Eclipse plugin&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;Download the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://widgets.dev.java.net/servlets/ProjectDocumentList?folderID=7693&amp;expandFolder=7693&amp;folderID=0&quot;&gt;jMaki Revolver widget library&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;Unzip th jmaki-revolver-x.x.zip file you downloaded and copy the contents of the resources of zip file into the resources directory of your web application..
&lt;li&gt;Add the widget to your page.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;a:widget name=&quot;jmaki.revolver&quot;&lt;br /&gt;            value=&quot;[&lt;br /&gt;                   {title : 'Amsterdam',&lt;br /&gt;                              imgSrc : 'http://farm1.static.flickr.com/67/227194339_551e710acb_m.jpg',&lt;br /&gt;                              href : 'http://www.flickr.com/photos/44399047@N00/sets/72157594254916360/'&lt;br /&gt;                              },&lt;br /&gt;                   {title : 'Paris',&lt;br /&gt;                              imgSrc : 'http://farm1.static.flickr.com/129/319228860_23770c66d3_m.jpg',&lt;br /&gt;                              href : 'http://www.flickr.com/photos/44399047@N00/sets/72157594414671044/'&lt;br /&gt;                              },&lt;br /&gt;                   {title : 'Seoul',&lt;br /&gt;                              imgSrc : 'http://farm1.static.flickr.com/106/294268722_662da2ef5a_m.jpg',&lt;br /&gt;                              href : 'http://www.flickr.com/photos/44399047@N00/sets/72157594370026444/'&lt;br /&gt;                              }&lt;br /&gt;                   ]&quot;/&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Find out more about the customizable properties that may be passed in as the &lt;code class=&quot;prettyprint&quot;&gt;args&lt;/code&gt; attribute from the &lt;code class=&quot;prettyprint&quot;&gt;docs/index.html&lt;/code&gt; file inside the jMaki Revolver widget library.&lt;br /&gt;
&lt;h3&gt;Non jMaki Usage&lt;/h3&gt;
&lt;p&gt;You will need to provide the template text, CSS, and JavaScript.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://widgets.dev.java.net/servlets/ProjectDocumentList?folderID=7693&amp;expandFolder=7693&amp;folderID=0&quot;&gt;jMaki Revolver widget library&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;Unzip th jmaki-revolver-x.x.zip file you downloaded and copy the contents of the &lt;code class=&quot;prettyprint&quot;&gt;jmaki/revolver&lt;/code&gt; directory to your web application.
&lt;li&gt;Add links to the script and css.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;component.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;component.css&quot;&amp;gt;&amp;lt;/link&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Add the template where you want the revolver to appear.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&amp;lt;!-- Revolver Template --!&amp;gt;&lt;br /&gt;&amp;lt;div id=&quot;jmaki-revolver&quot; class=&quot;revolver&quot; &amp;gt;&lt;br /&gt; &amp;lt;div id=&quot;jmaki-revolver-content-pane&quot; class=&quot;revolverContent&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;div id=&quot;jmaki-revolver-title-pane&quot; class=&quot;revolverTitle&quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Add the JavaScript initialization code.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;script&amp;gt;&lt;br /&gt;window.onload = function() {&lt;br /&gt;    var wargs = {uuid : 'jmaki-revolver'};&lt;br /&gt;    wargs.value = [&lt;br /&gt;                   {title : 'Amsterdam',&lt;br /&gt;                              imgSrc : 'http://farm1.static.flickr.com/67/227194339_551e710acb_m.jpg',&lt;br /&gt;                              href : 'http://www.flickr.com/photos/44399047@N00/sets/72157594254916360/'&lt;br /&gt;                              },&lt;br /&gt;                   {title : 'Paris',&lt;br /&gt;                              imgSrc : 'http://farm1.static.flickr.com/129/319228860_23770c66d3_m.jpg',&lt;br /&gt;                              href : 'http://www.flickr.com/photos/44399047@N00/sets/72157594414671044/'&lt;br /&gt;                              },&lt;br /&gt;                   {title : 'Seoul',&lt;br /&gt;                              imgSrc : 'http://farm1.static.flickr.com/106/294268722_662da2ef5a_m.jpg',&lt;br /&gt;                              href : 'http://www.flickr.com/photos/44399047@N00/sets/72157594370026444/'&lt;br /&gt;                              }&lt;br /&gt;                   ];&lt;br /&gt;   var revolver = new jmaki.widgets.jmaki.revolver.Widget(wargs);&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/ol&gt;
&lt;p&gt;
Find out more about the customizable properties from the &lt;code class=&quot;prettyprint&quot;&gt;docs/index.html&lt;/code&gt; file inside the jMaki Revolver widget library.
&lt;p&gt;This example shows the benefits of using a framework like jMaki to reduce the need of the steps you see with the non-jMaki usage.&lt;/p&gt;
&lt;p&gt;
Enjoy the widget. If you have any requests, comments or issues, please feel free to ask them here.&lt;/p&gt;&lt;/pre&gt;</description>
         <guid isPermaLink="false">238247 at http://www.java.net</guid>
         <pubDate>Mon, 25 Jun 2007 05:44:07 +0000</pubDate>
      </item>
      <item>
         <title>jMaki Extension for Google Gears</title>
         <link>http://www.java.net/blog/gmurray71/archive/2007/06/jmaki_extension_1.html</link>
         <description>&lt;p&gt;
With little effort I was able to get up and running with Google Gears very easily and integrate it with other jMaki components as an extension. Here is what I did to use the local Google database.
&lt;/p&gt;
&lt;p&gt;
Using the latest &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/download.html&quot;&gt;jMaki .9.3&lt;/a&gt; I added the following to my &lt;code class=&quot;prettyprint&quot;&gt;config.json&lt;/code&gt; file:&lt;/p&gt;

&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;{&lt;br /&gt;  'config': {&lt;br /&gt;    'version': '.9',&lt;br /&gt;    'glue' : {&lt;br /&gt;         'includes': ['/glue.js', '/resources/system-glue.js']&lt;br /&gt;       },&lt;br /&gt;    &lt;span style=&quot;color:red;&quot;&gt;'extensions': [{url : '/*', 'name' : 'google.gears'}]&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
The extension is loaded for all urls and is named &lt;code class=&quot;prettyprint&quot;&gt;google.gears&lt;/code&gt;.&lt;br /&gt;
Now for the extension that will interact with Google Gears. No other JavaScript code is needed.
&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;jmaki.namespace(&quot;jmaki.extensions.google.gears&quot;);&lt;br /&gt;&lt;br /&gt;jmaki.extensions.google.gears.Extension = function(args) {&lt;br /&gt;&lt;br /&gt;  var self = this;&lt;br /&gt;  var topic = &quot;/google/gears&quot;;&lt;br /&gt;  var db = null;&lt;br /&gt;  var factory = null;&lt;br /&gt;  &lt;br /&gt;  this.postLoad = function() {&lt;br /&gt;     self.init();&lt;br /&gt;     jmaki.subscribe(topic + &quot;/execute&quot;, self.execute);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  this.init = function() {&lt;br /&gt;      jmaki.log(&quot;Google Gears jMaki Extension intialized&quot;);&lt;br /&gt;&lt;br /&gt;      // Firefox&lt;br /&gt;      if (typeof GearsFactory != 'undefined') {&lt;br /&gt;          factory = new GearsFactory();&lt;br /&gt;      } else {&lt;br /&gt;          // IE&lt;br /&gt;          try {&lt;br /&gt;              factory = new ActiveXObject('Gears.Factory');&lt;br /&gt;          } catch (e) {&lt;br /&gt;              // Safari&lt;br /&gt;              if (navigator.mimeTypes[&quot;application/x-googlegears&quot;]) {&lt;br /&gt;                  factory = document.createElement(&quot;object&quot;);&lt;br /&gt;                  factory.style.display = &quot;none&quot;;&lt;br /&gt;                  factory.width = 0;&lt;br /&gt;                  factory.height = 0;&lt;br /&gt;                  factory.type = &quot;application/x-googlegears&quot;;&lt;br /&gt;                  document.documentElement.appendChild(factory);&lt;br /&gt;              }&lt;br /&gt;          }&lt;br /&gt;      }&lt;br /&gt;      // Now set up the objects, being careful not to overwrite anything.&lt;br /&gt;      if (!window.google) {&lt;br /&gt;          window.google = {};&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;      if (!google.gears) {&lt;br /&gt;          google.gears = {factory: factory};&lt;br /&gt;      }      &lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  // Open this page's local database.&lt;br /&gt;  function initDB() {&lt;br /&gt;      if (!window.google || !google.gears) {&lt;br /&gt;          jmaki.log(&quot;Google Gears not found.&quot;);&lt;br /&gt;          return;&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;      try {&lt;br /&gt;          db = google.gears.factory.create('beta.database', '1.0');&lt;br /&gt;      } catch (ex) {&lt;br /&gt;          jmaki.log('Could not create database: ' + ex.message);&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;      if (db) {&lt;br /&gt;          db.open('beta-database');&lt;br /&gt;          db.execute('create table if not exists jmaki' +&lt;br /&gt;          ' (obj varchar(2048), Timestamp int)');  &lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  this.execute = function(args) {&lt;br /&gt;    this.query = args.query;&lt;br /&gt;    var _callback = args.callback;&lt;br /&gt;    this.qargs = args.args;&lt;br /&gt;    if (!db) initDB();&lt;br /&gt;    if (!db) {&lt;br /&gt;      jmaki.log(&quot;Google Gears Extension: Unable to find database&quot;);&lt;br /&gt;      return;&lt;br /&gt;    }&lt;br /&gt;   var rs =  db.execute(query, qargs);&lt;br /&gt;    // execture callback if it's there&lt;br /&gt;    if (typeof _callback != 'undefined') _callback.call(this,rs);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This file will need to be in a file named &lt;code class=&quot;prettyprint&quot;&gt;extension.js&lt;/code&gt; in the &lt;code class=&quot;prettyprint&quot;&gt;/resources/google/gears&lt;/code&gt; directory of your web application. Now that the extension has been enabled all you need is to publish to the topic &lt;code class=&quot;prettyprint&quot;&gt;/google/gears/execute&lt;/code&gt; with the data base calls you want to make from your glue code. Here is an example of mapping the save button for the Dojo Editor and Dojo Inline Edit components which publish to the topic &quot;*onSave&quot;. &lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;jmaki.subscribe(&quot;*onSave&quot;, function(args) {&lt;br /&gt;    // empty the table then save it&lt;br /&gt;    jmaki.publish(&quot;/google/gears/execute&quot;,&lt;br /&gt;    { query : 'delete from jmaki',&lt;br /&gt;     callback : function() {&lt;br /&gt;       jmaki.log(&quot;Removing Previous Values&quot;);&lt;br /&gt;       jmaki.publish(&quot;/google/gears/execute&quot;,&lt;br /&gt;          { query : 'insert into jmaki values (?, ?)',&lt;br /&gt;             args : [args.value, new Date()],&lt;br /&gt;         callback : function() {&lt;br /&gt;             jmaki.log(&quot;Saved &quot; + args.value);&lt;br /&gt;         }&lt;br /&gt;        });&lt;br /&gt;       }&lt;br /&gt;    });&lt;br /&gt;});&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I used callbacks much like the &lt;code class=&quot;prettyprint&quot;&gt;XMLHttpRequest&lt;/code&gt; object to keep the design simple and make it easy to associate post processing code with a given event.&lt;/p&gt;
&lt;p&gt;
To display the data you need to load data from Google Gears as well. Here is the glue listener to load some text from the Google Gears data base and assign it to a JavaScript variable.&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;jmaki.subscribe(&quot;/jmaki/runtime/extensionsLoaded&quot;, function() {&lt;br /&gt;&lt;br /&gt;  jmaki.publish(&quot;/google/gears/execute&quot;, &lt;br /&gt;    { query : 'select * from jmaki order by Timestamp desc',&lt;br /&gt;     callback : function(_rs) {&lt;br /&gt;         if (typeof _rs != &quot;undefined&quot; &amp;&amp;&lt;br /&gt;             typeof _rs.isValidRow != &quot;undefined&quot; &amp;&amp;&lt;br /&gt;             _rs.isValidRow()) {&lt;br /&gt;             // set data on the global window object for later access&lt;br /&gt;             if (typeof _rs.field != &quot;undefined&quot;) window.editorData = _rs.field(0);&lt;br /&gt;             else window.editorData = &quot;&quot;;&lt;br /&gt;             jmaki.log(&quot;Loaded Editor Data: &quot; + editorData);&lt;br /&gt;         } else {&lt;br /&gt;             window.editorData = &quot;&quot;;&lt;br /&gt;             jmaki.log(&quot;No data available&quot;);&lt;br /&gt;         }&lt;br /&gt;         jmaki.log('done');&lt;br /&gt;     }&lt;br /&gt;    });&lt;br /&gt;});&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This code is executed after the extensions has loaded and will do a database using a sql statement. The returned value is assigned to the global variable &lt;code class=&quot;prettyprint&quot;&gt;window.editorData&lt;/code&gt; which you can then assign to your widget. For a Editor you can assign a JavaScript variable as the value using a client side value binding which starts with an '@{' and contains the package and variable name and ends with an '}'. For this &lt;code class=&quot;prettyprint&quot;&gt;window.editorData&lt;/code&gt; the client side value binding is &lt;code class=&quot;prettyprint&quot;&gt;@{window.editorData}&lt;/code&gt;. With a JSP / JSF widget the tag in a JSP page would look like the following:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt; 
&lt;p&gt;
As we can see it's pretty easy to integrate Google Gears in your jMaki application. There are many other areas to explore including easier JSON serialization using gears. This is starting to like &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://java.sun.com/javaee/technologies/jdo/index.jsp&quot;&gt;JDO&lt;/a&gt; all over again but in this case &quot;J&quot; is for JavaScript. Rest assured we will try to make this easier in jMaki.
&lt;/p&gt;
&lt;p&gt;What would you like to do with Google Gears?&lt;/p&gt;</description>
         <guid isPermaLink="false">238134 at http://www.java.net</guid>
         <pubDate>Mon, 11 Jun 2007 23:33:20 +0000</pubDate>
      </item>
      <item>
         <title>jMaki Extensions</title>
         <link>http://www.java.net/blog/gmurray71/archive/2007/06/jmaki_extension.html</link>
         <description>&lt;p&gt;Just when we thought it was safe to call jMaki feature complete we got a lot of feedback for various features that could all be handled by a single extension feature.&lt;/p&gt;
&lt;p&gt;What are extensions in jMaki?&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Extensions are behavior / functionality that are shared across widgets. Extensions are loaded after the &lt;code class=&quot;prettyprint&quot;&gt;jmaki.js&lt;/code&gt;  and before glue (your application logic). Examples may include enhanced debugging support, sound, or controllers that are specific to an individual application.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;What does an extension look like?&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;jmaki.namespace(&quot;jmaki.extensions.jmaki.ext.bar&quot;);&lt;br /&gt;&lt;br /&gt;jmaki.extensions.jmaki.ext.bar.Extension = function(args) {&lt;br /&gt;  jmaki.debug = true;&lt;br /&gt;  jmaki.log(&quot;jMaki bar Extension intialized&quot;);&lt;br /&gt;  jmaki.log(&quot;jMaki bar : extensionDir=&quot; + args.extensionDir);&lt;br /&gt; }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Extensions are namespaced JavaScript objects that are mapped in the &lt;code class=&quot;prettyprint&quot;&gt;config.json&lt;/code&gt; file like the following:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;{&lt;br /&gt;  'config': {&lt;br /&gt;    'version': '.9.3',&lt;br /&gt;    'extensions' : [&lt;br /&gt;          'jmaki.ext.foo' &lt;br /&gt;         ]&lt;br /&gt;    }    &lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Extensions are like widgets in that the application will look under &lt;code class=&quot;prettyprint&quot;&gt;/resources/jmaki/ext/bar&lt;/code&gt; for a file called &lt;code class=&quot;prettyprint&quot;&gt;extension.js&lt;/code&gt;. The contents are like the file above. The extensions will be located in the resources directory and located using the extension name. The extension 'jmaki.ext.foo' would be located in the following directory:
&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;resources&lt;br /&gt;    |&lt;br /&gt;    +jmaki&lt;br /&gt;       |&lt;br /&gt;       +ext&lt;br /&gt;          |&lt;br /&gt;          +foo&lt;br /&gt;             |&lt;br /&gt;             +extension.js&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Extensions can also be loaded on a per URL basis or based on a wildcard like you may see in the code below:
&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;code&gt;{&lt;br /&gt;  'config': {&lt;br /&gt;    'version': '.9.3',&lt;br /&gt;    'extensions' : [&lt;br /&gt;          { url : '/basicArgs.jsp',  name : 'jmaki.ext.foo' },&lt;br /&gt;          { url : '*.jsp', name : 'jmaki.ext.bar'},&lt;br /&gt;          { url : '/relativedir/*', name : 'jmaki.ext.foo', args : { 'topic' : 'footopic'}}&lt;br /&gt;         ]&lt;br /&gt;    }    &lt;br /&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice the &lt;code class=&quot;prettyprint&quot;&gt;url&lt;/code&gt; property can be a URL or contain a '*'. The mappings  can also provide an &lt;code class=&quot;prettyprint&quot;&gt;args&lt;/code&gt; property containing default data that is accessible in the extension (&lt;code class=&quot;prettyprint&quot;&gt;extension.js&lt;/code&gt;).
&lt;/p&gt;
&lt;p&gt;We also plan on adding a page level tag and or function for adding functions in the next release. It is our hope to keep the core of jMaki small and nimble. At the same time we want to future proof jMaki.Extensions are available in the PHP, Phobos, and Java versions of jMaki and may be found at the &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;https://ajax.dev.java.net/download.html&quot;&gt;jMaki Downloads&lt;/a&gt; page.&lt;/p&gt;
&lt;p&gt;Here are some extensions we are thinking about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Back/Forward button tracking&lt;/li&gt;
&lt;li&gt;Sound&lt;/li&gt;
&lt;li&gt;Bookmarking&lt;/li&gt;
&lt;li&gt;Google Gears Integration&lt;/li&gt;
&lt;li&gt;Cross Widget Drag and Drop&lt;/li&gt;
&lt;li&gt;JavaScript controllers&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What kind of extensions would you like to see for jMaki?&lt;/p&gt;</description>
         <guid isPermaLink="false">238118 at http://www.java.net</guid>
         <pubDate>Thu, 07 Jun 2007 22:37:53 +0000</pubDate>
      </item>
   </channel>
</rss>
<!-- fe8.yql.bf1.yahoo.com compressed/chunked Thu Oct  1 22:33:01 UTC 2015 -->
