<?xml version="1.0" encoding='utf-8'?>
<?xml-stylesheet type="text/xsl" href="https://raibledesigns.com/roller-ui/styles/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:app="http://www.w3.org/2007/app"
      xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">

    <title type="html">Search for [beans] in weblog rd</title>
    <subtitle type="html">Search results for [beans] within weblog Raible Designs</subtitle>
    <id>https://raibledesigns.com/rd/feed/entries/atom?q=beans&amp;cat=%2FJava</id>

    <link rel="self" type="application/atom+xml" 
        href="https://raibledesigns.com/rd/feed/entries/atom?q=beans&amp;cat=%2FJava" />

    <link rel="alternate" type="text/html" 
        href="https://raibledesigns.com/rd/search?q=beans&amp;cat=%2FJava" />

    <link rel="search" type="application/opensearchdescription+xml" 
        href="https://raibledesigns.com/roller-services/opensearch/rd" />
    <opensearch:Query role="request" searchTerms="beans" startPage="1" />

    <link rel="first" type="application/atom+xml" href="https://raibledesigns.com/rd/feed/entries/atom?q=beans&amp;cat=%2FJava" />
    <link rel="next" type="application/atom+xml" href="https://raibledesigns.com/rd/feed/entries/atom?q=beans&amp;cat=%2FJava&amp;page=1" />
    <updated>2026-05-25T13:53:18-06:00</updated>
    <generator uri="http://roller.apache.org" version="5.0.3 (1388864191739:dave)">Apache Roller</generator>

        <entry>
        <id>https://raibledesigns.com/rd/entry/converting_an_application_to_jhipster</id>
        <title type="html">Converting an Application to JHipster</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/converting_an_application_to_jhipster"/>
        <published>2015-02-12T09:28:59-07:00</published>
        <updated>2015-02-12T15:29:50-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="groovy" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jhipster" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jpa" scheme="http://roller.apache.org/ns/tags/" />
        <category term="scala" scheme="http://roller.apache.org/ns/tags/" />
        <category term="springboot" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <category term="angularjs" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="dosug" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">&lt;p&gt;&lt;a href=&quot;http://jhipster.github.io/&quot;&gt;&lt;img src=&quot;http://jhipster.github.io/images/logo-jhipster.png&quot; class=&quot;picture&quot; width=&quot;94&quot;&gt;&lt;/a&gt;
I&apos;ve been intrigued by &lt;a href=&quot;http://jhipster.github.io/&quot;&gt;JHipster&lt;/a&gt; ever since I first tried it &lt;a href=&quot;http://raibledesigns.com/rd/entry/getting_started_with_jhipster_on&quot;&gt;last September&lt;/a&gt;. I&apos;d worked with AngularJS and Spring Boot quite a bit, and I liked the idea that someone had combined them, adding some nifty features along the way. When I &lt;a href=&quot;http://raibledesigns.com/rd/entry/the_art_of_angularjs_in&quot;&gt;spoke about AngularJS&lt;/a&gt; earlier this month, I included &lt;a href=&quot;http://www.slideshare.net/mraible/the-art-of-angularjs-in-2015/67&quot;&gt;a few slides on JHipster&lt;/a&gt; near the end of the presentation.&lt;/p&gt;
&lt;p&gt;This week, I received an email from someone who attended that presentation. &lt;/p&gt;
&lt;blockquote class=&quot;quote&quot;&gt;
&lt;p style=&quot;margin-top: 0&quot;&gt;Hey Matt,&lt;br&gt;
We met a few weeks back when you presented at DOSUG. You were talking about JHipster which I had been eyeing for a few months and wanted your quick .02 cents.&lt;/p&gt;
&lt;p&gt;
I have built a pretty heavy application over the last 6 months that is using mostly the same tech as JHipster. 
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Java&lt;/li&gt;
&lt;li&gt;Spring&lt;/li&gt;
&lt;li&gt;JPA&lt;/li&gt;
&lt;li&gt;AngularJS&lt;/li&gt;
&lt;li&gt;Compass&lt;/li&gt;
&lt;li&gt;Grunt&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
It&apos;s ridiculously close for most of the tech stack. So, I was debating rolling it over into a JHipster app to make it a more familiar stack for folks. My concern is that it I will spend months trying to shoehorn it in for not much ROI. Any thoughts on going down this path?
What are the biggest issues you&apos;ve seen in using JHipster?
It seems pretty straightforward except for the entity generators. I&apos;m concerned they are totally different than what I am using. 
&lt;/p&gt;
&lt;p style=&quot;margin-bottom: 0&quot;&gt;
The main difference in what I&apos;m doing compared to JHipster is my almost complete use of groovy instead of old school Java in the app. I would have to be forced into going back to regular java beans...
Thoughts?&lt;/p&gt; 
&lt;/blockquote&gt;
&lt;p&gt;I replied with the following advice:&lt;/p&gt;
&lt;blockquote class=&quot;quote&quot;&gt;
&lt;p style=&quot;margin-top: 0&quot;&gt;
JHipster is great for starting a project, but I don&apos;t know that it buys you much value after the first few months. I would stick with your current setup and consider JHipster for your next project. I&apos;ve only prototyped with it, I haven&apos;t created any client apps or put anything in production. I have with Spring Boot and AngularJS though, so I like that JHipster combines them for me.
&lt;/p&gt;
&lt;p&gt;
JHipster doesn&apos;t generate Scala or Groovy code, but you could still use them in a project as long as you had Maven/Gradle configured properly. 
&lt;/p&gt;
&lt;p style=&quot;margin-bottom: 0&quot;&gt;
You might try generating a new app with JHipster and examine how they&apos;re doing this. At the very least, it can be a good learning tool, even if you&apos;re not using it directly.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Java Hipsters: Do you agree with this advice? Have you tried migrating an existing app to JHipster? Are any of you using Scala or Groovy in your JHipster projects?&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/developing_services_with_apache_camel2</id>
        <title type="html">Developing Services with Apache Camel - Part III: Integrating Spring 4 and Spring Boot</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/developing_services_with_apache_camel2"/>
        <published>2014-10-08T07:13:18-06:00</published>
        <updated>2014-10-15T19:00:44-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="apachecamel" scheme="http://roller.apache.org/ns/tags/" />
        <category term="tomcat" scheme="http://roller.apache.org/ns/tags/" />
        <category term="microservices" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring-boot" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="camel" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring4" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">&lt;p&gt;
&lt;a href=&quot;http://projects.spring.io/spring-boot/&quot;&gt;&lt;img src=&quot;//raibledesigns.com/repository/images/spring-boot-logo.png&quot; alt=&quot;Spring Boot&quot; height=&quot;108&quot; class=&quot;picture&quot;&gt;&lt;/a&gt;
    This article is the third in a series on Apache Camel and how I used it to replace IBM Message Broker for a client.
    I used Apache Camel for several months this summer to create a number of SOAP services. These services performed
    various third-party data lookups for our customers. For previous articles, see
    &lt;a href=&quot;http://raibledesigns.com/rd/entry/developing_services_with_apache_camel&quot;&gt;Part I: The Inspiration&lt;/a&gt;
    and &lt;a href=&quot;http://raibledesigns.com/rd/entry/developing_services_with_apache_camel1&quot;&gt;Part II: Creating and
    Testing Routes&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
    In late June, I sent an email to my client&apos;s engineering team. Its subject: &quot;External Configuration and
    Microservices&quot;.
    I recommended we integrate &lt;a href=&quot;http://projects.spring.io/spring-boot/&quot;&gt;Spring Boot&lt;/a&gt; into the
    Apache Camel project I was working on. I told them my main motivation was its
    &lt;a href=&quot;http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-external-config&quot;&gt;
        external configuration&lt;/a&gt; feature. I also pointed out its container-less WAR feature, where Tomcat (or Jetty)
    is embedded in the WAR and you can start your app with &quot;java -jar appname.war&quot;. I mentioned
    &lt;a href=&quot;http://martinfowler.com/articles/microservices.html&quot;&gt;microservices&lt;/a&gt;
    and that Spring Boot would make it easy to split the project into a project-per-service structure if we wanted
    to go that route. I then asked two simple questions:
&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Is it OK to integrate Spring Boot?&lt;/li&gt;
    &lt;li&gt;Should I split the project into microservices?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
    Both of these suggestions were well received, so I went to work.
&lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;
&lt;a href=&quot;http://projects.spring.io/spring-boot/&quot;&gt;&lt;img src=&quot;//raibledesigns.com/repository/images/spring-boot-logo.png&quot; alt=&quot;Spring Boot&quot; height=&quot;108&quot; class=&quot;picture&quot;&gt;&lt;/a&gt;
    This article is the third in a series on Apache Camel and how I used it to replace IBM Message Broker for a client.
    I used Apache Camel for several months this summer to create a number of SOAP services. These services performed
    various third-party data lookups for our customers. For previous articles, see
    &lt;a href=&quot;http://raibledesigns.com/rd/entry/developing_services_with_apache_camel&quot;&gt;Part I: The Inspiration&lt;/a&gt;
    and &lt;a href=&quot;http://raibledesigns.com/rd/entry/developing_services_with_apache_camel1&quot;&gt;Part II: Creating and
    Testing Routes&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
    In late June, I sent an email to my client&apos;s engineering team. Its subject: &quot;External Configuration and
    Microservices&quot;.
    I recommended we integrate &lt;a href=&quot;http://projects.spring.io/spring-boot/&quot;&gt;Spring Boot&lt;/a&gt; into the
    Apache Camel project I was working on. I told them my main motivation was its
    &lt;a href=&quot;http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-external-config&quot;&gt;
        external configuration&lt;/a&gt; feature. I also pointed out its container-less WAR feature, where Tomcat (or Jetty)
    is embedded in the WAR and you can start your app with &quot;java -jar appname.war&quot;. I mentioned
    &lt;a href=&quot;http://martinfowler.com/articles/microservices.html&quot;&gt;microservices&lt;/a&gt;
    and that Spring Boot would make it easy to split the project into a project-per-service structure if we wanted
    to go that route. I then asked two simple questions:
&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Is it OK to integrate Spring Boot?&lt;/li&gt;
    &lt;li&gt;Should I split the project into microservices?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
    Both of these suggestions were well received, so I went to work.
&lt;/p&gt;

&lt;h3 id=&quot;spring4&quot;&gt;Spring 4&lt;/h3&gt;

&lt;p&gt;
    Before I integrated Spring Boot, I knew I had to upgrade to &lt;a href=http://docs.spring.io/spring/docs/current/spring-framework-reference/html/new-in-4.0.html&quot;&gt;Spring 4&lt;/a&gt;. The version of Camel I was using (2.13.1)
    did not support Spring 4. I found issue CAMEL-7074 (Support spring 4.x) and
    &lt;a href=&quot;https://issues.apache.org/jira/browse/CAMEL-7074?focusedCommentId=14042668&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14042668&quot;&gt;
        added a comment&lt;/a&gt; to see when it would be fixed. After fiddling with dependencies and trying Camel
    2.14-SNAPSHOT,
    I was able to upgrade to CXF 3.0. However, this didn&apos;t solve my problem. There were some API uncompatible changes
    between
    Spring 3.3.x and Spring 4.0.x and the camel-test-spring module wouldn&apos;t work with both. I proposed the following:
&lt;/p&gt;

&lt;p class=&quot;quote&quot;&gt;
    I think the easiest way forward is to create two modules: camel-test-spring and camel-test-spring3. The former
    compiles against Spring 4 and the latter against Spring 3. You could switch it so camel-test-spring defaults to
    Spring 3, but camel-test-spring4 doesn&apos;t seem to be forward-looking, as you hopefully won&apos;t need a
    camel-test-spring5.
    &lt;br/&gt;&lt;br/&gt;
    I&apos;ve made this change in a fork and it works in my project. I can upgrade to Camel 2.14-SNAPSHOT and CXF 3.0 with
    Spring 3.2.8 (by using camel-test-spring3). I can also upgrade to Spring 4 if I use the upgraded camel-test-spring.
    &lt;br/&gt;&lt;br/&gt;
    Here&apos;s a pull request that has this change: &lt;a href=&quot;https://github.com/apache/camel/pull/199&quot;&gt;https://github.com/apache/camel/pull/199&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;The Camel team integrated my suggested change a couple weeks later. Unfortunately,
    &lt;a href=&quot;https://issues.apache.org/jira/browse/CAMEL-7835&quot;&gt;a similar situation happened with Spring 4.1&lt;/a&gt;, so
    you&apos;ll have to wait for Camel 2.15 if you want to use Spring 4.1.&lt;/p&gt;
&lt;p&gt;
    After making a patched 2.14-SNAPSHOT version available to my project, I was able to upgrade to Spring 4 and CXF 3
    with a few minor changes to my pom.xml.
&lt;/p&gt;
&lt;pre class=&quot;brush: diff&quot;&gt;
    &amp;lt;properties&amp;gt;
      &amp;lt;project.build.sourceEncoding&amp;gt;UTF-8&amp;lt;/project.build.sourceEncoding&amp;gt;
      &amp;lt;project.reporting.outputEncoding&amp;gt;UTF-8&amp;lt;/project.reporting.outputEncoding&amp;gt;
-     &amp;lt;camel.version&amp;gt;2.13.1&amp;lt;/camel.version&amp;gt;
-     &amp;lt;cxf.version&amp;gt;2.7.11&amp;lt;/cxf.version&amp;gt;
-     &amp;lt;spring.version&amp;gt;3.2.8.RELEASE&amp;lt;/spring.version&amp;gt;
+     &amp;lt;camel.version&amp;gt;2.14-SNAPSHOT&amp;lt;/camel.version&amp;gt;
+     &amp;lt;cxf.version&amp;gt;3.0.0&amp;lt;/cxf.version&amp;gt;
+     &amp;lt;spring.version&amp;gt;4.0.5.RELEASE&amp;lt;/spring.version&amp;gt;
    &amp;lt;/properties&amp;gt;
...
+      &amp;lt;!-- upgrade camel-spring dependencies --&amp;gt;
+      &amp;lt;dependency&amp;gt;
+         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
+         &amp;lt;artifactId&amp;gt;spring-context&amp;lt;/artifactId&amp;gt;
+         &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
+      &amp;lt;/dependency&amp;gt;
+      &amp;lt;dependency&amp;gt;
+         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
+         &amp;lt;artifactId&amp;gt;spring-aop&amp;lt;/artifactId&amp;gt;
+         &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
+      &amp;lt;/dependency&amp;gt;
+      &amp;lt;dependency&amp;gt;
+         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
+         &amp;lt;artifactId&amp;gt;spring-tx&amp;lt;/artifactId&amp;gt;
+         &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
+      &amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;p&gt;I also had to change some imports for CXF 3.0 since it &lt;a href=&quot;http://cxf.apache.org/docs/30-migration-guide.html&quot;&gt;
    includes a new major version of Apache WSS4J (2.0.0)&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&quot;brush: diff&quot;&gt;
-import org.apache.ws.security.handler.WSHandlerConstants;
+import org.apache.wss4j.dom.handler.WSHandlerConstants;
...
-import org.apache.ws.security.WSPasswordCallback;
+import org.apache.wss4j.common.ext.WSPasswordCallback;
&lt;/pre&gt;
&lt;p&gt;After getting everything upgraded, I continued developing services for the next couple weeks.&lt;/p&gt;
&lt;h3 id=&quot;spring-boot&quot;&gt;Spring Boot&lt;/h3&gt;
&lt;p&gt;In late July, I integrated Spring Boot. It was fairly straightforward and mostly consisted of adding/removing
    dependencies and removing versions already defined in Boot&apos;s starter-parent.
&lt;/p&gt;
&lt;pre class=&quot;brush: diff&quot;&gt;
+   &amp;lt;parent&amp;gt;
+      &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
+      &amp;lt;artifactId&amp;gt;spring-boot-starter-parent&amp;lt;/artifactId&amp;gt;
+      &amp;lt;version&amp;gt;1.1.4.RELEASE&amp;lt;/version&amp;gt;
+   &amp;lt;/parent&amp;gt;
...
       &amp;lt;cxf.version&amp;gt;3.0.1&amp;lt;/cxf.version&amp;gt;
+      &amp;lt;java.version&amp;gt;1.7&amp;lt;/java.version&amp;gt;
+      &amp;lt;servlet-api.version&amp;gt;3.1.0&amp;lt;/servlet-api.version&amp;gt;
       &amp;lt;spring.version&amp;gt;4.0.6.RELEASE&amp;lt;/spring.version&amp;gt;
...
-            &amp;lt;artifactId&amp;gt;maven-compiler-plugin&amp;lt;/artifactId&amp;gt;
-            &amp;lt;version&amp;gt;2.5.1&amp;lt;/version&amp;gt;
-            &amp;lt;configuration&amp;gt;
-               &amp;lt;source&amp;gt;1.7&amp;lt;/source&amp;gt;
-               &amp;lt;target&amp;gt;1.7&amp;lt;/target&amp;gt;
-            &amp;lt;/configuration&amp;gt;
-         &amp;lt;/plugin&amp;gt;
-         &amp;lt;plugin&amp;gt;
-            &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
             &amp;lt;artifactId&amp;gt;maven-resources-plugin&amp;lt;/artifactId&amp;gt;
          &amp;lt;/plugin&amp;gt;
+         &amp;lt;plugin&amp;gt;
+            &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
+            &amp;lt;artifactId&amp;gt;spring-boot-maven-plugin&amp;lt;/artifactId&amp;gt;
+         &amp;lt;/plugin&amp;gt;
       &amp;lt;/plugins&amp;gt;
    &amp;lt;/build&amp;gt;

    &amp;lt;dependencies&amp;gt;
+      &amp;lt;!-- spring boot --&amp;gt;
+      &amp;lt;dependency&amp;gt;
+         &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
+         &amp;lt;artifactId&amp;gt;spring-boot-starter-actuator&amp;lt;/artifactId&amp;gt;
+         &amp;lt;exclusions&amp;gt;
+            &amp;lt;exclusion&amp;gt;
+               &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
+               &amp;lt;artifactId&amp;gt;spring-boot-starter-logging&amp;lt;/artifactId&amp;gt;
+            &amp;lt;/exclusion&amp;gt;
+         &amp;lt;/exclusions&amp;gt;
+      &amp;lt;/dependency&amp;gt;
+      &amp;lt;dependency&amp;gt;
+         &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
+         &amp;lt;artifactId&amp;gt;spring-boot-starter-log4j&amp;lt;/artifactId&amp;gt;
+      &amp;lt;/dependency&amp;gt;
+      &amp;lt;dependency&amp;gt;
+         &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
+         &amp;lt;artifactId&amp;gt;spring-boot-starter-tomcat&amp;lt;/artifactId&amp;gt;
+         &amp;lt;scope&amp;gt;provided&amp;lt;/scope&amp;gt;
+      &amp;lt;/dependency&amp;gt;
+      &amp;lt;dependency&amp;gt;
+         &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
+         &amp;lt;artifactId&amp;gt;spring-boot-starter-web&amp;lt;/artifactId&amp;gt;
+      &amp;lt;/dependency&amp;gt;
       &amp;lt;!-- camel --&amp;gt;
...
-      &amp;lt;!-- upgrade camel-spring dependencies --&amp;gt;
-      &amp;lt;dependency&amp;gt;
-         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
-         &amp;lt;artifactId&amp;gt;spring-context&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
-      &amp;lt;/dependency&amp;gt;
-      &amp;lt;dependency&amp;gt;
-         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
-         &amp;lt;artifactId&amp;gt;spring-aop&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
-      &amp;lt;/dependency&amp;gt;
-      &amp;lt;dependency&amp;gt;
-         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
-         &amp;lt;artifactId&amp;gt;spring-tx&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
-      &amp;lt;/dependency&amp;gt;
...
-      &amp;lt;!-- logging --&amp;gt;
-      &amp;lt;dependency&amp;gt;
-         &amp;lt;groupId&amp;gt;org.slf4j&amp;lt;/groupId&amp;gt;
-         &amp;lt;artifactId&amp;gt;slf4j-api&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;1.7.6&amp;lt;/version&amp;gt;
-      &amp;lt;/dependency&amp;gt;
-      &amp;lt;dependency&amp;gt;
-         &amp;lt;groupId&amp;gt;org.slf4j&amp;lt;/groupId&amp;gt;
-         &amp;lt;artifactId&amp;gt;slf4j-log4j12&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;1.7.6&amp;lt;/version&amp;gt;
-      &amp;lt;/dependency&amp;gt;
-      &amp;lt;dependency&amp;gt;
-         &amp;lt;groupId&amp;gt;log4j&amp;lt;/groupId&amp;gt;
-         &amp;lt;artifactId&amp;gt;log4j&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;1.2.17&amp;lt;/version&amp;gt;
-      &amp;lt;/dependency&amp;gt;
-
       &amp;lt;!-- utilities --&amp;gt;
       &amp;lt;dependency&amp;gt;
          &amp;lt;groupId&amp;gt;joda-time&amp;lt;/groupId&amp;gt;
          &amp;lt;artifactId&amp;gt;joda-time&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;2.3&amp;lt;/version&amp;gt;
       &amp;lt;/dependency&amp;gt;
       &amp;lt;dependency&amp;gt;
          &amp;lt;groupId&amp;gt;commons-dbcp&amp;lt;/groupId&amp;gt;
          &amp;lt;artifactId&amp;gt;commons-dbcp&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;1.4&amp;lt;/version&amp;gt;
...
       &amp;lt;!-- testing --&amp;gt;
       &amp;lt;dependency&amp;gt;
+         &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
+         &amp;lt;artifactId&amp;gt;spring-boot-starter-test&amp;lt;/artifactId&amp;gt;
+         &amp;lt;exclusions&amp;gt;
+            &amp;lt;exclusion&amp;gt;
+               &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
+               &amp;lt;artifactId&amp;gt;spring-boot-starter-logging&amp;lt;/artifactId&amp;gt;
+            &amp;lt;/exclusion&amp;gt;
+         &amp;lt;/exclusions&amp;gt;
+      &amp;lt;/dependency&amp;gt;
+      &amp;lt;dependency&amp;gt;
-      &amp;lt;dependency&amp;gt;
-         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
-         &amp;lt;artifactId&amp;gt;spring-test&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
-         &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
-      &amp;lt;/dependency&amp;gt;
-      &amp;lt;dependency&amp;gt;
-         &amp;lt;groupId&amp;gt;org.mockito&amp;lt;/groupId&amp;gt;
-         &amp;lt;artifactId&amp;gt;mockito-core&amp;lt;/artifactId&amp;gt;
-         &amp;lt;version&amp;gt;1.9.5&amp;lt;/version&amp;gt;
-         &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
-      &amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Next, I deleted the &lt;code&gt;AppInitializer.java&lt;/code&gt; class I mentioned in
    &lt;a href=&quot;http://raibledesigns.com/rd/entry/developing_services_with_apache_camel1&quot;&gt;Part II&lt;/a&gt; and added an
    &lt;code&gt;Application.java&lt;/code&gt; class.&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.ErrorPage;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

@Configuration
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class})
@ComponentScan
public class Application extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        CXFServlet servlet = new CXFServlet();
        return new ServletRegistrationBean(servlet, &quot;/api/*&quot;);
    }

    @Bean
    public EmbeddedServletContainerCustomizer containerCustomizer() {
        return new EmbeddedServletContainerCustomizer() {
            @Override
            public void customize(ConfigurableEmbeddedServletContainer container) {
                ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, &quot;/401.html&quot;);
                ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, &quot;/404.html&quot;);
                ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, &quot;/500.html&quot;);
                container.addErrorPages(error401Page, error404Page, error500Page);
            }
        };
    }
}
&lt;/pre&gt;
&lt;p&gt;
    The error pages you see configured above were configured and copied from Tim Sporcic&apos;s
    &lt;a href=&quot;http://sporcic.org/2014/05/custom-error-pages-with-spring-boot/&quot;&gt;Custom Error Pages with Spring Boot&lt;/a&gt;.
&lt;/p&gt;
&lt;h4 id=&quot;dynamic-datasources&quot;&gt;Dynamic DataSources&lt;/h4&gt;
&lt;p&gt;I excluded the DataSource-related AutoConfiguration classes because this application had many datasources.
It also had a requirement to allow datasources to be added on-the-fly by simply editing application.properties.
I &lt;a href=&quot;http://stackoverflow.com/questions/25160221/how-do-i-create-beans-programmatically-in-spring-boot/25160828&quot;&gt;
asked how to do this on Stack Overflow&lt;/a&gt; and received an &lt;a href=&quot;http://stackoverflow.com/a/25160828/65681&quot;&gt;excellent
    answer&lt;/a&gt; from &lt;a href=&quot;http://stackoverflow.com/users/613628/st%C3%A9phane-nicoll&quot;&gt;St&#233;phane Nicoll&lt;/a&gt;.
&lt;/p&gt;
&lt;h4 id=&quot;spring-boot-issues&quot;&gt;Spring Boot Issues&lt;/h4&gt;
&lt;p&gt;
    I did encounter a couple issues after integrating Spring Boot. The first was that &lt;a href=&quot;https://github.com/spring-projects/spring-boot/issues/1316&quot;&gt;
    it was removing the content-* headers for CXF responses&lt;/a&gt;. This only happened when running the WAR in Tomcat and I
    was able to figure out a workaround with a custom ResponseWrapper and Filter. This issue was fixed in Spring Boot 1.1.6.
&lt;/p&gt;
&lt;p&gt;The other issue was that the property override feature didn&apos;t seem to work when setting environment variables. The workaround
was to create a &lt;code&gt;setenv.sh&lt;/code&gt; script in $CATALINA_HOME/bin and add the environment variables there. See section 3.4
of &lt;a href=&quot;http://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt&quot;&gt;Tomcat 7&apos;s RUNNING.txt&lt;/a&gt; for more information.&lt;/p&gt;

&lt;h4 id=&quot;soap-faults&quot;&gt;SOAP Faults&lt;/h4&gt;
&lt;p&gt;
    After upgrading to Spring 4 and integrating Spring Boot, I continued migrating IBM Message Broker flows. My goal
    was to make all new services backward compatible, but I ran into an issue. With the new services, SOAP Faults were
    sent back to the client instead of error messages in a SOAP Message. I suggested we fix it with one of two ways:
&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Modify the client so it looks for SOAP Faults and handles them appropriately.&lt;/li&gt;
    &lt;li&gt;Modify the new services so messages are returned instead of faults.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For #2, I learned how do to &lt;a href=&quot;http://camel.465427.n5.nabble.com/Convert-from-Fault-to-Message-td5754465.html&quot;&gt;convert from a fault to messages&lt;/a&gt;
on the Camel user mailing list. However, the team opted to improve the client and we added fault handling there instead.&lt;/p&gt;


&lt;h3 id=&quot;microservices&quot;&gt;Microservice Deployment&lt;/h3&gt;
&lt;p&gt;When I first integrated Spring Boot, I was planning on splitting our project into a project-per-service.
    This would allow each service to evolve on its own, instead of having a monolithic war that contains all the services.
    In team discussions, there was some concern about the memory overhead of running multiple instances instead of one.
    &lt;/p&gt;
&lt;p&gt;
    I pointed out an &lt;a href=&quot;http://camel.465427.n5.nabble.com/one-context-or-multiple-contexts-td5754635.html&quot;&gt;interesting thread&lt;/a&gt;
    on the Camel mailing list about deploying routes with a route-per-jvm or all in the same JVM.
    The recommendation from that thread was to bundle similar routes together if you were to split them.&lt;/p&gt;
&lt;p&gt;In the end, we decided to allow our Operations team decide how they wanted to manage/deploy everything. I mentioned that
    Spring Boot can work with &lt;a href=&quot;http://spring.io/blog/2014/03/07/deploying-spring-boot-applications&quot;&gt;
        Tomcat, Jetty, JBoss and even cloud providers like Heroku and Cloud Foundry&lt;/a&gt;. I estimated that splitting the project
    apart would take less than a day, as would making it back into a monolithic WAR.
&lt;/p&gt;

&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;
&lt;p&gt;This article explains how we upgraded our Apache Camel application to Spring 4 and integrated Spring Boot. There was
    a bit of pain getting things to work, but nothing a few pull requests and workarounds couldn&apos;t fix. We discovered
    some issues with setting environment variables for Tomcat and opted not to split our project into small microservices.
    Hopefully this article will help people trying to &lt;a href=&quot;http://stackoverflow.com/questions/25775418/camelize-a-spring-boot-application&quot;&gt;
        Camelize a Spring Boot application
    &lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;In the &lt;a href=&quot;//raibledesigns.com/rd/entry/developing_services_with_apache_camel3&quot;&gt;next article&lt;/a&gt;, I&apos;ll talk about load testing with &lt;a href=&quot;http://gatling.io&quot;&gt;Gatling&lt;/a&gt;, logging with
    &lt;a href=&quot;http://www.infoq.com/news/2014/07/apache-log4j2&quot;&gt;Log4j2&lt;/a&gt; and monitoring with
    &lt;a href=&quot;http://hawt.io/&quot;&gt;hawtio&lt;/a&gt; and &lt;a href=&quot;http://newrelic.com/&quot;&gt;New Relic&lt;/a&gt;. &lt;/p&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/developing_services_with_apache_camel1</id>
        <title type="html">Developing Services with Apache Camel - Part II: Creating and Testing Routes</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/developing_services_with_apache_camel1"/>
        <published>2014-09-30T10:05:38-06:00</published>
        <updated>2014-10-15T19:00:16-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="junit" scheme="http://roller.apache.org/ns/tags/" />
        <category term="testing" scheme="http://roller.apache.org/ns/tags/" />
        <category term="maven" scheme="http://roller.apache.org/ns/tags/" />
        <category term="tomcat" scheme="http://roller.apache.org/ns/tags/" />
        <category term="apachecamel" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <category term="microservices" scheme="http://roller.apache.org/ns/tags/" />
        <category term="camel" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jenkins" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">&lt;p&gt;
    &lt;a href=&quot;http://camel.apache.org&quot;&gt;&lt;img src=&quot;http://camel.apache.org/images/camel-box-small.png&quot; height=&quot;150&quot;
                                           alt=&quot;Apache Camel&quot; class=&quot;picture&quot;&gt;&lt;/a&gt;
    This article is the second in a series on Apache Camel and how I used it to replace IBM Message Broker for a client.
    The first article, &lt;a href=&quot;http://raibledesigns.com/rd/entry/developing_services_with_apache_camel&quot;&gt;
    Developing Services with Apache Camel - Part I: The Inspiration&lt;/a&gt;, describes why I chose Camel for this project.
&lt;/p&gt;

&lt;p&gt;

&lt;p&gt;To make sure these new services correctly replaced existing services, a 3-step approach was used:&lt;/p&gt;
&lt;ol class=&quot;task-list&quot;&gt;
    &lt;li&gt;Write an integration test pointing to the old service.&lt;/li&gt;
    &lt;li&gt;Write the implementation and a unit test to prove it works.&lt;/li&gt;
    &lt;li&gt;Write an integration test pointing to the new service.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
    I chose to start by replacing the simplest service first. It was a SOAP Service that talked to a database to
    retrieve
    a value based on an input parameter. To learn more about Camel and how it works, I started by looking at the
    &lt;a href=&quot;http://camel.apache.org/cxf-tomcat-example.html&quot;&gt;CXF Tomcat Example&lt;/a&gt;. I learned that
    Camel is used to provide &lt;em&gt;routing&lt;/em&gt; of requests. Using its &lt;a href=&quot;http://camel.apache.org/cxf.html&quot;&gt;CXF
    component&lt;/a&gt;, it can easily produce SOAP web service
    endpoints. An end point is simply an interface, and Camel takes care of producing the implementation.
&lt;/p&gt;</summary>
        <content type="html">&lt;p&gt;
    &lt;a href=&quot;http://camel.apache.org&quot;&gt;&lt;img src=&quot;http://camel.apache.org/images/camel-box-small.png&quot; height=&quot;150&quot;
                                           alt=&quot;Apache Camel&quot; class=&quot;picture&quot;&gt;&lt;/a&gt;
    This article is the second in a series on Apache Camel and how I used it to replace IBM Message Broker for a client.
    The first article, &lt;a href=&quot;http://raibledesigns.com/rd/entry/developing_services_with_apache_camel&quot;&gt;
    Developing Services with Apache Camel - Part I: The Inspiration&lt;/a&gt;, describes why I chose Camel for this project.
&lt;/p&gt;

&lt;p&gt;

&lt;p&gt;To make sure these new services correctly replaced existing services, a 3-step approach was used:&lt;/p&gt;
&lt;ol class=&quot;task-list&quot;&gt;
    &lt;li&gt;Write an integration test pointing to the old service.&lt;/li&gt;
    &lt;li&gt;Write the implementation and a unit test to prove it works.&lt;/li&gt;
    &lt;li&gt;Write an integration test pointing to the new service.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
    I chose to start by replacing the simplest service first. It was a SOAP Service that talked to a database to
    retrieve
    a value based on an input parameter. To learn more about Camel and how it works, I started by looking at the
    &lt;a href=&quot;http://camel.apache.org/cxf-tomcat-example.html&quot;&gt;CXF Tomcat Example&lt;/a&gt;. I learned that
    Camel is used to provide &lt;em&gt;routing&lt;/em&gt; of requests. Using its &lt;a href=&quot;http://camel.apache.org/cxf.html&quot;&gt;CXF
    component&lt;/a&gt;, it can easily produce SOAP web service
    endpoints. An end point is simply an interface, and Camel takes care of producing the implementation.
&lt;/p&gt;

&lt;h3 id=&quot;legacy-integration-test&quot;&gt;Legacy Integration Test&lt;/h3&gt;

&lt;p&gt;I started by writing a &lt;code&gt;LegacyDrugServiceTests&lt;/code&gt; integration test for the old drug service.
    I tried two different ways of testing, using WSDL-generated Java classes, as well as using JAX-WS&apos;s SOAP API.
    Finding the WSDL for the legacy service was difficult because IBM Message Broker doesn&apos;t expose it when adding
    &quot;?wsdl&quot; to the service&apos;s URL. Instead, I had to dig through the project files until I found it. Then I
    used the &lt;a href=&quot;http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html&quot;&gt;cxf-codegen-plugin&lt;/a&gt;
    to generate the web service client. Below is what one of the tests looked like that uses the JAX-WS API.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@Test
public void sendGPIRequestUsingSoapApi() throws Exception {
    SOAPElement bodyChildOne = getBody(message).addChildElement(&quot;gpiRequest&quot;, &quot;m&quot;);
    SOAPElement bodyChildTwo = bodyChildOne.addChildElement(&quot;args0&quot;, &quot;m&quot;);
    bodyChildTwo.addChildElement(&quot;NDC&quot;, &quot;ax22&quot;).addTextNode(&quot;54561237201&quot;);
    SOAPMessage reply = connection.call(message, getUrlWithTimeout(SERVICE_NAME));
    if (reply != null) {
        Iterator itr = reply.getSOAPBody().getChildElements();
        Map resultMap = TestUtils.getResults(itr);
        assertEquals(&quot;66100525123130&quot;, resultMap.get(&quot;GPI&quot;));
    }
}
&lt;/pre&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementing the Drug Service&lt;/h3&gt;

&lt;p&gt;In the last article, I mentioned I wanted no XML in the project. To facilitate this, I used Camel&apos;s
    &lt;a href=&quot;http://camel.apache.org/java-dsl.html&quot;&gt;Java DSL&lt;/a&gt; to define routes and Spring&apos;s
    &lt;a href=&quot;http://docs.spring.io/spring/docs/4.0.6.RELEASE/spring-framework-reference/htmlsingle/#beans-java&quot;&gt;JavaConfig&lt;/a&gt;
    to configure dependencies.
&lt;/p&gt;

&lt;p&gt;The first route I wrote was one that looked up a GPI (Generic Product Identifier) by NDC (National Drug Code).&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@WebService
public interface DrugService {
    @WebMethod(operationName = &quot;gpiRequest&quot;)
    GpiResponse findGpiByNdc(GpiRequest request);
}
&lt;/pre&gt;
&lt;p&gt;
    To expose this as a web service endpoint with CXF, I needed to do two things:
&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Tell Spring how to configure CXF by importing &quot;classpath:META-INF/cxf/cxf.xml&quot; into a @Configuration class.&lt;/li&gt;
    &lt;li&gt;Configure CXF&apos;s Servlet so endpoints can be served up at a particular URL.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To satisfy item #1, I created a &lt;code&gt;CamelConfig&lt;/code&gt; class that extends &lt;a
        href=&quot;http://camel.apache.org/maven/camel-2.14.0/camel-spring-javaconfig/apidocs/org/apache/camel/spring/javaconfig/CamelConfiguration.html&quot;&gt;CamelConfiguration&lt;/a&gt;.
    This class allows Camel to be configured by Spring&apos;s JavaConfig. In it, I imported the CXF configuration, allowed
    tracing to be
    configured dynamically, and exposed my &lt;code&gt;application.properties&lt;/code&gt; to Camel. I also set it up (with &lt;code&gt;@ComponentScan&lt;/code&gt;)
    to look
    for Camel routes annotated with &lt;code&gt;@Component&lt;/code&gt;.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@Configuration
@ImportResource(&quot;classpath:META-INF/cxf/cxf.xml&quot;)
@ComponentScan(&quot;com.raibledesigns.camel&quot;)
public class CamelConfig extends CamelConfiguration {
    @Value(&quot;${logging.trace.enabled}&quot;)
    private Boolean tracingEnabled;

    @Override
    protected void setupCamelContext(CamelContext camelContext) throws Exception {
        PropertiesComponent pc = new PropertiesComponent();
        pc.setLocation(&quot;classpath:application.properties&quot;);
        camelContext.addComponent(&quot;properties&quot;, pc);
        // see if trace logging is turned on
        if (tracingEnabled) {
            camelContext.setTracing(true);
        }
        super.setupCamelContext(camelContext);
    }

    @Bean
    public Tracer camelTracer() {
        Tracer tracer = new Tracer();
        tracer.setTraceExceptions(false);
        tracer.setTraceInterceptors(true);
        tracer.setLogName(&quot;com.raibledesigns.camel.trace&quot;);
        return tracer;
    }
}
&lt;/pre&gt;
&lt;p&gt;CXF has a servlet that&apos;s responsible for serving up its services at common path. To map CXF&apos;s servlet, I leveraged
    Spring&apos;s
    &lt;a href=&quot;http://docs.spring.io/autorepo/docs/spring-framework/4.0.x/javadoc-api/org/springframework/web/WebApplicationInitializer.html&quot;&gt;
        WebApplicationInitializer&lt;/a&gt; in an &lt;code&gt;AppInitializer&lt;/code&gt; class. I decided to serve up everything from a
    &lt;code&gt;/api/*&lt;/code&gt; base URL.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
package com.raibledesigns.camel.config;

import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;

public class AppInitializer implements WebApplicationInitializer {

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        servletContext.addListener(new ContextLoaderListener(getContext()));
        ServletRegistration.Dynamic servlet = servletContext.addServlet(&quot;CXFServlet&quot;, new CXFServlet());
        servlet.setLoadOnStartup(1);
        servlet.setAsyncSupported(true);
        servlet.addMapping(&quot;/api/*&quot;);
    }

    private AnnotationConfigWebApplicationContext getContext() {
        AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        context.setConfigLocation(&quot;com.raibledesigns.camel.config&quot;);
        return context;
    }
}
&lt;/pre&gt;
&lt;p&gt;
    To implement this web service with Camel, I created a &lt;code&gt;DrugRoute&lt;/code&gt; class that extends Camel&apos;s
    &lt;code&gt;RouteBuilder&lt;/code&gt;.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@Component
public class DrugRoute extends RouteBuilder {
    private String uri = &quot;cxf:/drugs?serviceClass=&quot; + DrugService.class.getName();

    @Override
    public void configure() throws Exception {
        from(uri)
            .recipientList(simple(&quot;direct:${header.operationName}&quot;));
        from(&quot;direct:gpiRequest&quot;).routeId(&quot;gpiRequest&quot;)
            .process(new Processor() {
                public void process(Exchange exchange) throws Exception {
                    // get the ndc from the input
                    String ndc = exchange.getIn().getBody(GpiRequest.class).getNDC();
                    exchange.getOut().setBody(ndc);
                }
            })
            .to(&quot;sql:{{sql.selectGpi}}&quot;)
            .to(&quot;log:output&quot;)
            .process(new Processor() {
                public void process(Exchange exchange) throws Exception {
                    // get the gpi from the input
                    List&amp;lt;HashMap&amp;gt; data = (ArrayList&amp;lt;HashMap&amp;gt;) exchange.getIn().getBody();
                    DrugInfo drug = new DrugInfo();
                    if (data.size() &amp;gt; 0) {
                        drug = new DrugInfo(String.valueOf(data.get(0).get(&quot;GPI&quot;)));
                    }
                    GpiResponse response = new GpiResponse(drug);
                    exchange.getOut().setBody(response);
                }
            });
    }
}
&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;sql.selectGpi&lt;/code&gt; property is read from &lt;code&gt;src/main/resources/application.properties&lt;/code&gt; and looks
    as follows:&lt;/p&gt;
&lt;pre&gt;sql.selectGpi=select GPI from drugs where ndc = #?dataSource=ds.drugs&lt;/pre&gt;
&lt;p&gt;The &quot;ds.drugs&quot; reference is to a datasource that&apos;s created by Spring. From my
    &lt;code&gt;AppConfig&lt;/code&gt; class:&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@Configuration
@PropertySource(&quot;classpath:application.properties&quot;)
public class AppConfig {

    @Value(&quot;${ds.driver.db2}&quot;)
    private String jdbcDriverDb2;

    @Value(&quot;${ds.password}&quot;)
    private String jdbcPassword;

    @Value(&quot;${ds.url}&quot;)
    private String jdbcUrl;

    @Value(&quot;${ds.username}&quot;)
    private String jdbcUsername;

    @Bean(name = &quot;ds.drugs&quot;)
    public DataSource drugsDataSource() {
        return createDataSource(jdbcDriverDb2, jdbcUsername, jdbcPassword, jdbcUrl);
    }

    private BasicDataSource createDataSource(String driver, String username, String password, String url) {
        BasicDataSource ds = new BasicDataSource();
        ds.setDriverClassName(driver);
        ds.setUsername(username);
        ds.setPassword(password);
        ds.setUrl(url);
        ds.setMaxActive(100);
        ds.setMaxWait(1000);
        ds.setPoolPreparedStatements(true);
        return ds;
    }
}
&lt;/pre&gt;

&lt;h3 id=&quot;unit-testing&quot;&gt;Unit Testing&lt;/h3&gt;

&lt;p&gt;
    The hardest part about unit testing this route was figuring out how to use Camel&apos;s
    &lt;a href=&quot;http://camel.apache.org/testing.html&quot;&gt;testing support&lt;/a&gt;. I posted
    &lt;a href=&quot;http://camel.465427.n5.nabble.com/Mocking-SQL-results-in-a-route-td5752169.html&quot;&gt;a question&lt;/a&gt; to the
    Camel users mailing list in early June. Based on advice received, I bought
    &lt;a href=&quot;http://www.manning.com/ibsen/&quot;&gt;Camel in Action&lt;/a&gt;, read chapter 6 on testing and went to work.
    I wanted to eliminate the dependency on a datasource, so I used Camel&apos;s
    &lt;a href=&quot;http://camel.apache.org/advicewith.html&quot;&gt;AdviceWith&lt;/a&gt; feature to modify my route and intercept the
    SQL call. This allowed me to return pre-defined results and verify everything worked.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@RunWith(CamelSpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = CamelSpringDelegatingTestContextLoader.class, classes = CamelConfig.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
@UseAdviceWith
public class DrugRouteTests {

    @Autowired
    CamelContext camelContext;

    @Produce
    ProducerTemplate template;

    @EndpointInject(uri = &quot;mock:result&quot;)
    MockEndpoint result;

    static List&amp;lt;Map&amp;gt; results = new ArrayList&amp;lt;Map&amp;gt;() {{
        add(new HashMap&amp;lt;String, String&amp;gt;() {{
            put(&quot;GPI&quot;, &quot;123456789&quot;);
        }});
    }};

    @Before
    public void before() throws Exception {
        camelContext.setTracing(true);

        ModelCamelContext context = (ModelCamelContext) camelContext;
        RouteDefinition route = context.getRouteDefinition(&quot;gpiRequest&quot;);
        route.adviceWith(context, new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                interceptSendToEndpoint(&quot;sql:*&quot;).skipSendToOriginalEndpoint().process(new Processor() {
                    @Override
                    public void process(Exchange exchange) throws Exception {
                        exchange.getOut().setBody(results);
                    }
                });
            }
        });
        route.to(result);
        camelContext.start();
    }

    @Test
    public void testMockSQLEndpoint() throws Exception {
        result.expectedMessageCount(1);
        GpiResponse expectedResult = new GpiResponse(new DrugInfo(&quot;123456789&quot;));
        result.allMessages().body().contains(expectedResult);

        GpiRequest request = new GpiRequest();
        request.setNDC(&quot;123&quot;);
        template.sendBody(&quot;direct:gpiRequest&quot;, request);

        MockEndpoint.assertIsSatisfied(camelContext);
    }
}
&lt;/pre&gt;
&lt;p&gt;
    I found AdviceWith to be extremely useful as I developed more routes and tests in this project. I used its
    &lt;a href=&quot;http://camel.apache.org/advicewith.html#AdviceWith-UsingweaveById&quot;&gt;weaveById&lt;/a&gt; feature to intercept
    calls to stored procedures, replace steps in my routes and remove steps I didn&apos;t want to test. For example,
    in one route, there was a complicated workflow to interact with a customer&apos;s data.
&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Call a stored procedure in a remote database, which then inserts a record into a temp table.&lt;/li&gt;
    &lt;li&gt;Lookup that data using the value returned from the stored procedure.&lt;/li&gt;
    &lt;li&gt;Delete the record from the temp table.&lt;/li&gt;
    &lt;li&gt;Parse the data (as CSV) since the returned value is ~ delimited.&lt;/li&gt;
    &lt;li&gt;Convert the parsed data into objects, then do database inserts in a local database (if data doesn&apos;t exist).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To make matters worse, remote database access was restricted by IP address. This meant that, while developing, I
    couldn&apos;t
    even manually test from my local machine. To solve this, I used the following:
&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;code&gt;interceptSendToEndpoint(&quot;bean:*&quot;)&lt;/code&gt; to intercept the call to my stored procedure bean.&lt;/li&gt;
    &lt;li&gt;&lt;code&gt;weaveById(&quot;myJdbcProcessor&quot;).before()&lt;/code&gt; to replace the temp table lookup with a CSV file.&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://code.google.com/p/mockito/&quot;&gt;Mockito&lt;/a&gt; to mock a JdbcTemplate that does the inserts.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
    To figure out how to configure and execute stored procedures in a route, I used the &lt;a
        href=&quot;https://github.com/quephird/camel-stored-procedure&quot;&gt;
    camel-store-procedure project on GitHub&lt;/a&gt;. Mockito&apos;s
    &lt;a href=&quot;http://docs.mockito.googlecode.com/hg/org/mockito/ArgumentCaptor.html&quot;&gt;ArgumentCaptor&lt;/a&gt; also became very
    useful
    when developing a route that called a 3rd-party web service within a route. James Carr has
    &lt;a href=&quot;http://blog.james-carr.org/2009/09/28/mockito-verifying-details-of-an-object-passed-to-a-collaborator/&quot;&gt;more
        information&lt;/a&gt;
    on how you might use this to verify values on an argument.
&lt;/p&gt;

&lt;p&gt;
    To see if my tests were hitting all aspects of the code, I integrated the
    &lt;a href=&quot;http://mojo.codehaus.org/cobertura-maven-plugin/&quot;&gt;cobertura-maven-plugin&lt;/a&gt; for code coverage
    reports (generated by running &lt;code&gt;mvn site&lt;/code&gt;).
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;build&amp;gt;
    &amp;lt;plugins&amp;gt;
        &amp;lt;plugin&amp;gt;
            &amp;lt;groupId&amp;gt;org.codehaus.mojo&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;cobertura-maven-plugin&amp;lt;/artifactId&amp;gt;
            &amp;lt;configuration&amp;gt;
                &amp;lt;instrumentation&amp;gt;
                    &amp;lt;excludes&amp;gt;
                        &amp;lt;exclude&amp;gt;**/model/*.class&amp;lt;/exclude&amp;gt;
                        &amp;lt;exclude&amp;gt;**/AppInitializer.class&amp;lt;/exclude&amp;gt;
                        &amp;lt;exclude&amp;gt;**/StoredProcedureBean.class&amp;lt;/exclude&amp;gt;
                        &amp;lt;exclude&amp;gt;**/SoapActionInterceptor.class&amp;lt;/exclude&amp;gt;
                    &amp;lt;/excludes&amp;gt;
                &amp;lt;/instrumentation&amp;gt;
                &amp;lt;check/&amp;gt;
            &amp;lt;/configuration&amp;gt;
            &amp;lt;version&amp;gt;2.6&amp;lt;/version&amp;gt;
        &amp;lt;/plugin&amp;gt;
...
&amp;lt;reporting&amp;gt;
    &amp;lt;plugins&amp;gt;
        &amp;lt;plugin&amp;gt;
            &amp;lt;groupId&amp;gt;org.codehaus.mojo&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;cobertura-maven-plugin&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;2.6&amp;lt;/version&amp;gt;
        &amp;lt;/plugin&amp;gt;
&lt;/pre&gt;
&lt;h3 id=&quot;integration-testing&quot;&gt;Integration Testing&lt;/h3&gt;

&lt;p&gt;
    Writing an integration test was fairly straightforward. I created a &lt;code&gt;DrugRouteITest&lt;/code&gt; class, a
    client using CXF&apos;s &lt;a href=&quot;https://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxws/JaxWsProxyFactoryBean.html&quot;&gt;JaxWsProxyFactoryBean&lt;/a&gt;
    and called the method on the service.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
public class DrugRouteITest {

    private static final String URL = &quot;http://localhost:8080/api/drugs&quot;;

    protected static DrugService createCXFClient() {
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setBindingId(&quot;http://schemas.xmlsoap.org/wsdl/soap12/&quot;);
        factory.setServiceClass(DrugService.class);
        factory.setAddress(getTestUrl(URL));
        return (DrugService) factory.create();
    }

    @Test
    public void findGpiByNdc() throws Exception {
        // create input parameter
        GpiRequest input = new GpiRequest();
        input.setNDC(&quot;54561237201&quot;);

        // create the webservice client and send the request
        DrugService client = createCXFClient();
        GpiResponse response = client.findGpiByNdc(input);

        assertEquals(&quot;66100525123130&quot;, response.getDrugInfo().getGPI());
    }
}
&lt;/pre&gt;
&lt;p&gt;This integration test is only run after Tomcat has started and deployed the app. Unit tests are run by Maven&apos;s
    &lt;a href=&quot;http://maven.apache.org/surefire/maven-surefire-plugin/&quot;&gt;surefire-plugin&lt;/a&gt;, while integration tests are
    run by the &lt;a href=&quot;http://maven.apache.org/surefire/maven-failsafe-plugin/&quot;&gt;failsafe-plugin&lt;/a&gt;. An available
    Tomcat port is determined by the &lt;a href=&quot;http://mojo.codehaus.org/build-helper-maven-plugin/&quot;&gt;
        build-helper-maven-plugin&lt;/a&gt;. This port is set as a system property and read by the &lt;code&gt;getTestUrl()&lt;/code&gt;
    method call above.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
public static String getTestUrl(String url) {
    if (System.getProperty(&quot;tomcat.http.port&quot;) != null) {
        url = url.replace(&quot;8080&quot;, System.getProperty(&quot;tomcat.http.port&quot;));
    }
    return url;
}
&lt;/pre&gt;
&lt;p&gt;Below are the relevant bits from
    &lt;code&gt;pom.xml&lt;/code&gt; that determines when to start/stop Tomcat, as well as which tests to run. &lt;/p&gt;

&lt;p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;plugin&amp;gt;
    &amp;lt;groupId&amp;gt;org.apache.tomcat.maven&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;tomcat7-maven-plugin&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;2.2&amp;lt;/version&amp;gt;
    &amp;lt;configuration&amp;gt;
        &amp;lt;path&amp;gt;/&amp;lt;/path&amp;gt;
    &amp;lt;/configuration&amp;gt;
    &amp;lt;executions&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;id&amp;gt;start-tomcat&amp;lt;/id&amp;gt;
            &amp;lt;phase&amp;gt;pre-integration-test&amp;lt;/phase&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;run&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
            &amp;lt;configuration&amp;gt;
                &amp;lt;fork&amp;gt;true&amp;lt;/fork&amp;gt;
                &amp;lt;port&amp;gt;${tomcat.http.port}&amp;lt;/port&amp;gt;
            &amp;lt;/configuration&amp;gt;
        &amp;lt;/execution&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;id&amp;gt;stop-tomcat&amp;lt;/id&amp;gt;
            &amp;lt;phase&amp;gt;post-integration-test&amp;lt;/phase&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;shutdown&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
        &amp;lt;/execution&amp;gt;
    &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;
&amp;lt;plugin&amp;gt;
    &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;maven-surefire-plugin&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;2.17&amp;lt;/version&amp;gt;
    &amp;lt;configuration&amp;gt;
        &amp;lt;excludes&amp;gt;
            &amp;lt;exclude&amp;gt;**/*IT*.java&amp;lt;/exclude&amp;gt;
            &amp;lt;exclude&amp;gt;**/Legacy**.java&amp;lt;/exclude&amp;gt;
        &amp;lt;/excludes&amp;gt;
        &amp;lt;includes&amp;gt;
            &amp;lt;include&amp;gt;**/*Tests.java&amp;lt;/include&amp;gt;
            &amp;lt;include&amp;gt;**/*Test.java&amp;lt;/include&amp;gt;
        &amp;lt;/includes&amp;gt;
    &amp;lt;/configuration&amp;gt;
&amp;lt;/plugin&amp;gt;
&amp;lt;plugin&amp;gt;
    &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;maven-failsafe-plugin&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;2.17&amp;lt;/version&amp;gt;
    &amp;lt;configuration&amp;gt;
        &amp;lt;includes&amp;gt;
            &amp;lt;include&amp;gt;**/*IT*.java&amp;lt;/include&amp;gt;
        &amp;lt;/includes&amp;gt;
        &amp;lt;systemProperties&amp;gt;
            &amp;lt;tomcat.http.port&amp;gt;${tomcat.http.port}&amp;lt;/tomcat.http.port&amp;gt;
        &amp;lt;/systemProperties&amp;gt;
    &amp;lt;/configuration&amp;gt;
    &amp;lt;executions&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;integration-test&amp;lt;/goal&amp;gt;
                &amp;lt;goal&amp;gt;verify&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
        &amp;lt;/execution&amp;gt;
    &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The most useful part of integration testing came when I copied one of my legacy tests into it and started verifying
    backwards compatibility. Since we wanted to replace existing services, and require no client changes, I had to make
    the XML request and response match. &lt;a href=&quot;http://www.charlesproxy.com&quot;&gt;Charles&lt;/a&gt; was very useful for this
    exercise,
    letting me inspect the request/response and tweak things to match. The following JAX-WS annotations allowed me to
    change the XML
    element names and achieve backward compatibility.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;code&gt;@BindingType(SOAPBinding.SOAP12HTTP_BINDING)&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;&lt;code&gt;@WebResult(name = &quot;return&quot;, targetNamespace = &quot;...&quot;)&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;&lt;code&gt;@ResponseWrapper(localName = &quot;gpiResponse&quot;)&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;&lt;code&gt;@WebParam(name = &quot;args0&quot;, targetNamespace = &quot;...&quot;)&lt;/code&gt;&lt;/li&gt;
    &lt;li&gt;&lt;code&gt;@XmlElement(name = &quot;...&quot;)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;jenkins-and-continuous-deployment&quot;&gt;Continuous Integration and Deployment&lt;/h3&gt;

&lt;p&gt;My next item of business was configuring a job in &lt;a href=&quot;http://jenkins-ci.org/&quot;&gt;Jenkins&lt;/a&gt; to continually test
    and deploy. Getting all the tests to pass was easy, and deploying to Tomcat was simple enough thanks to the
    &lt;a href=&quot;https://wiki.jenkins-ci.org/display/JENKINS/Deploy+Plugin&quot;&gt;Deploy Plugin&lt;/a&gt; and
    &lt;a href=&quot;http://paxcel.net/blog/automation-of-warear-deployment-using-jenkins/&quot;&gt;this article&lt;/a&gt;. However, after a
    few deploys, Tomcat would throw OutOfMemory exceptions. Therefore, I ended up creating a second &quot;deploy&quot; job that
    stops Tomcat, copies the successfully-built WAR to $CATALINA_HOME/webapps, removes $CATALINA_HOME/webapps/ROOT and
    restarts Tomcat. I used Jenkins &quot;Execute shell&quot; feature to configure these three steps.
    I was pleased to find my &lt;a
            href=&quot;http://raibledesigns.com/tomcat/boot-howto.html&quot;&gt;&lt;code&gt;/etc/init.d/tomcat&lt;/code&gt;&lt;/a&gt;
    script still worked for starting Tomcat at boot time and providing convenient start/stop commands.
&lt;/p&gt;

&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;

&lt;p&gt;
    This article shows you how I implemented and tested a simple Apache Camel route. The route described
    only does a simple database lookup, but you can see how Camel&apos;s testing support allows you to mock results and concentrate
    on developing your route logic. I found its testing framework very useful and not well documented, so hopefully this
    article helps to fix that. In the &lt;a href=&quot;http://raibledesigns.com/rd/entry/developing_services_with_apache_camel2&quot;&gt;next article&lt;/a&gt;, I&apos;ll talk about upgrading to Spring 4, integrating Spring Boot and
    our team&apos;s microservice deployment discussions.
&lt;/p&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/a_webapp_makeover_with_spring</id>
        <title type="html">A Webapp Makeover with Spring 4 and Spring Boot</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/a_webapp_makeover_with_spring"/>
        <published>2013-12-11T12:47:15-07:00</published>
        <updated>2013-12-13T14:54:52-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="spring4" scheme="http://roller.apache.org/ns/tags/" />
        <category term="maven" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jersey" scheme="http://roller.apache.org/ns/tags/" />
        <category term="springboot" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <summary type="html">&lt;p&gt;A typical Maven and Spring web application has a fair amount of XML and 
verbosity to it. Add in Jersey and Spring Security and you can have hundreds of lines of 
XML before you even start to write your Java code. As part of a recent project,
I was tasked with upgrading a webapp like this to use Spring 4 and 
&lt;a href=&quot;http://projects.spring.io/spring-boot/&quot;&gt;Spring Boot&lt;/a&gt;. I also figured I&apos;d try to minimize the XML.&lt;/p&gt; 
&lt;p&gt;This is my story on how I upgraded to Spring 4, Jersey 2, Java 8 and Spring Boot 0.5.0 M6. 
&lt;/p&gt;
&lt;p&gt;When I started, the app was using Spring 3.2.5, Spring Security 3.1.4 and Jersey 1.18. The
pom.xml had four Jersey dependencies, three Spring dependencies and three Spring Security
dependencies, along with a number of exclusions for &quot;jersey-spring&quot;.&lt;/p&gt;
&lt;p id=&quot;spring4&quot;&gt;&lt;strong&gt;Upgrading to Spring 4&lt;/strong&gt;&lt;br/&gt;
Upgrading to Spring 4 was easy, I changed the version property to 4.0.0.RC2 and added the new 
Spring &lt;a href=&quot;http://spring.io/blog/2013/12/03/spring-framework-4-0-rc2-available&quot;&gt;bill of materials&lt;/a&gt;
to my pom.xml. I also add the Spring milestone repo since Spring 4 won&apos;t be released to Maven central
until tomorrow.&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;dependencyManagement&amp;gt;
    &amp;lt;dependencies&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-framework-bom&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;${spring.framework.version}&amp;lt;/version&amp;gt;
            &amp;lt;type&amp;gt;pom&amp;lt;/type&amp;gt;
            &amp;lt;scope&amp;gt;import&amp;lt;/scope&amp;gt;
        &amp;lt;/dependency&amp;gt;
    &amp;lt;/dependencies&amp;gt;
&amp;lt;/dependencyManagement&amp;gt;

&amp;lt;repositories&amp;gt;
    &amp;lt;repository&amp;gt;
        &amp;lt;id&amp;gt;spring-milestones&amp;lt;/id&amp;gt;
        &amp;lt;url&amp;gt;http://repo.spring.io/milestone&amp;lt;/url&amp;gt;
        &amp;lt;snapshots&amp;gt;
            &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;
        &amp;lt;/snapshots&amp;gt;
    &amp;lt;/repository&amp;gt;
&amp;lt;/repositories&amp;gt;
&lt;/pre&gt;</summary>
        <content type="html">&lt;p&gt;A typical Maven and Spring web application has a fair amount of XML and 
verbosity to it. Add in Jersey and Spring Security and you can have hundreds of lines of 
XML before you even start to write your Java code. As part of a recent project,
I was tasked with upgrading a webapp like this to use Spring 4 and 
&lt;a href=&quot;http://projects.spring.io/spring-boot/&quot;&gt;Spring Boot&lt;/a&gt;. I also figured I&apos;d try to minimize the XML.&lt;/p&gt; 
&lt;p&gt;This is my story on how I upgraded to Spring 4, Jersey 2, Java 8 and Spring Boot 0.5.0 M6. 
&lt;/p&gt;
&lt;p&gt;When I started, the app was using Spring 3.2.5, Spring Security 3.1.4 and Jersey 1.18. The
pom.xml had four Jersey dependencies, three Spring dependencies and three Spring Security
dependencies, along with a number of exclusions for &quot;jersey-spring&quot;.&lt;/p&gt;
&lt;p id=&quot;spring4&quot;&gt;&lt;strong&gt;Upgrading to Spring 4&lt;/strong&gt;&lt;br/&gt;
Upgrading to Spring 4 was easy, I changed the version property to 4.0.0.RC2 and added the new 
Spring &lt;a href=&quot;http://spring.io/blog/2013/12/03/spring-framework-4-0-rc2-available&quot;&gt;bill of materials&lt;/a&gt;
to my pom.xml. I also add the Spring milestone repo since Spring 4 won&apos;t be released to Maven central
until tomorrow.&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;dependencyManagement&amp;gt;
    &amp;lt;dependencies&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-framework-bom&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;${spring.framework.version}&amp;lt;/version&amp;gt;
            &amp;lt;type&amp;gt;pom&amp;lt;/type&amp;gt;
            &amp;lt;scope&amp;gt;import&amp;lt;/scope&amp;gt;
        &amp;lt;/dependency&amp;gt;
    &amp;lt;/dependencies&amp;gt;
&amp;lt;/dependencyManagement&amp;gt;

&amp;lt;repositories&amp;gt;
    &amp;lt;repository&amp;gt;
        &amp;lt;id&amp;gt;spring-milestones&amp;lt;/id&amp;gt;
        &amp;lt;url&amp;gt;http://repo.spring.io/milestone&amp;lt;/url&amp;gt;
        &amp;lt;snapshots&amp;gt;
            &amp;lt;enabled&amp;gt;true&amp;lt;/enabled&amp;gt;
        &amp;lt;/snapshots&amp;gt;
    &amp;lt;/repository&amp;gt;
&amp;lt;/repositories&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Next, I removed all the references to ${spring.framework.version} in dependencies since it&apos;d 
be controlled by &lt;a href=&quot;http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management&quot;&gt;
Maven&apos;s dependency management feature&lt;/a&gt;. 
&lt;/p&gt;
&lt;pre class=&quot;brush: diff&quot;&gt;
     &amp;lt;dependency&amp;gt;
         &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
         &amp;lt;artifactId&amp;gt;spring-web&amp;lt;/artifactId&amp;gt;
-        &amp;lt;version&amp;gt;${spring.framework.version}&amp;lt;/version&amp;gt;
     &amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
I also changed to use Maven 3&apos;s &lt;a href=&quot;http://maven.apache.org/pom.html#Exclusions&quot;&gt;wildcard syntax&lt;/a&gt; to exclude multiple 
dependencies.&lt;/p&gt;
&lt;pre class=&quot;brush: diff&quot;&gt;
    &amp;lt;dependency&amp;gt;
        &amp;lt;groupId&amp;gt;com.sun.jersey.contribs&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;jersey-spring&amp;lt;/artifactId&amp;gt;
        &amp;lt;exclusions&amp;gt;
             &amp;lt;exclusion&amp;gt;
                 &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
-                    &amp;lt;artifactId&amp;gt;spring&amp;lt;/artifactId&amp;gt;
-                &amp;lt;/exclusion&amp;gt;
-                &amp;lt;exclusion&amp;gt;
-                    &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
-                    &amp;lt;artifactId&amp;gt;spring-core&amp;lt;/artifactId&amp;gt;
-                &amp;lt;/exclusion&amp;gt;
-                &amp;lt;exclusion&amp;gt;
-                    &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
-                    &amp;lt;artifactId&amp;gt;spring-web&amp;lt;/artifactId&amp;gt;
-                &amp;lt;/exclusion&amp;gt;
-                &amp;lt;exclusion&amp;gt;
-                    &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
-                    &amp;lt;artifactId&amp;gt;spring-beans&amp;lt;/artifactId&amp;gt;
-                &amp;lt;/exclusion&amp;gt;
-                &amp;lt;exclusion&amp;gt;
-                    &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
-                    &amp;lt;artifactId&amp;gt;spring-context&amp;lt;/artifactId&amp;gt;
+                    &amp;lt;artifactId&amp;gt;*&amp;lt;/artifactId&amp;gt;
             &amp;lt;/exclusion&amp;gt;
         &amp;lt;/exclusions&amp;gt;
     &amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;p&gt;I confirmed the upgrade worked by running &quot;mvn dependency:tree | grep spring&quot;, followed by &quot;mvn jetty:run&quot; and viewing the app in my browser. &lt;/p&gt;
&lt;p id=&quot;jersey2&quot;&gt;&lt;strong&gt;Upgrading to Jersey 2&lt;/strong&gt;&lt;br/&gt;
The next item I tackled was upgrading to Jersey 2.4.1. I changed the version number in my pom.xml, then added the Jersey BOM.&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.glassfish.jersey&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;jersey-bom&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;${jersey.version}&amp;lt;/version&amp;gt;
    &amp;lt;type&amp;gt;pom&amp;lt;/type&amp;gt;
    &amp;lt;scope&amp;gt;import&amp;lt;/scope&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
You might ask &quot;why Jersey?&quot; if we already have Spring MVC and its REST support? You might also ask why not Play or Grails instead of a Java + Spring stack? For this particular project, I recommended technology options, and these were certainly among them. However, the team chose differently and I support their decision. The project is 
creating an iOS app, as well as a responsive HTML5 mobile/desktop app. We figured we had enough risk with new technologies on the front-end that we should play it a bit safer on the backend. To make the backend work a bit sexier, we&apos;ve decided to allow Spring 4, Java 8 and possibly some reactive principles.&lt;/p&gt;
&lt;p&gt;Next, I changed from the old &lt;i&gt;com.sun.jersey&lt;/i&gt; dependencies to &lt;i&gt;org.glassfish.jersey&lt;/i&gt; and removed jersey-spring. &lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.glassfish.jersey.containers&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;jersey-container-servlet&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.glassfish.jersey.media&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;jersey-media-json-jackson&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
The last thing I needed to do was change the servlet-class and param-name in web.xml:&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;servlet&amp;gt;
    &amp;lt;servlet-name&amp;gt;jersey-servlet&amp;lt;/servlet-name&amp;gt;
    &amp;lt;servlet-class&amp;gt;org.glassfish.jersey.servlet.ServletContainer&amp;lt;/servlet-class&amp;gt;
    &amp;lt;init-param&amp;gt;
        &amp;lt;param-name&amp;gt;jersey.config.server.provider.packages&amp;lt;/param-name&amp;gt;
        &amp;lt;param-value&amp;gt;com.raibledesigns.boot.service&amp;lt;/param-value&amp;gt;
    &amp;lt;/init-param&amp;gt;
    &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;
&amp;lt;/servlet&amp;gt;
&lt;/pre&gt;
&lt;p id=&quot;java8&quot;&gt;&lt;strong&gt;Requiring Java 8&lt;/strong&gt;&lt;br/&gt;
Requiring Java 8 to compile was easy enough. I added the maven-compiler-plugin to enforce a minimum version.&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;plugin&amp;gt;
    &amp;lt;artifactId&amp;gt;maven-compiler-plugin&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;3.1&amp;lt;/version&amp;gt;
    &amp;lt;configuration&amp;gt;
        &amp;lt;source&amp;gt;1.8&amp;lt;/source&amp;gt;
        &amp;lt;target&amp;gt;1.8&amp;lt;/target&amp;gt;
    &amp;lt;/configuration&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/pre&gt;&lt;p&gt;I &lt;a href=&quot;https://jdk8.java.net/download.html&quot;&gt;downloaded the latest Java 8 SDK&lt;/a&gt; and installed it. Then I set my JAVA_HOME to use it.&lt;/p&gt;
&lt;pre class=&quot;brush: shell&quot;&gt;
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
&lt;/pre&gt;
&lt;p id=&quot;boot&quot;&gt;&lt;strong&gt;Integrating Spring Boot&lt;/strong&gt;&lt;br/&gt;
I learned about Spring Boot a few weeks ago &lt;a href=&quot;http://raibledesigns.com/rd/entry/devoxx_2013_a_nordic_countries&quot;&gt;at Devoxx&lt;/a&gt;. &lt;a href=&quot;http://www.joshlong.com/&quot;&gt;Josh Long&lt;/a&gt; gave me a 3-minute demo at the speaker&apos;s dinner and showed me enough to pique my interest. To integrate it into my project, I started with the &lt;a href=&quot;http://projects.spring.io/spring-boot/#quick-start&quot;&gt;Quick Start&lt;/a&gt;. I added the boot-parent, dependencies for web, security and actuator (logging, metrics, etc.) and the Maven plugin. I removed all the Spring and Spring Security dependencies.
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;parent&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-boot-starter-parent&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;0.5.0.M6&amp;lt;/version&amp;gt;
&amp;lt;/parent&amp;gt;
...
&amp;lt;pluginRepositories&amp;gt;
    &amp;lt;pluginRepository&amp;gt;
        &amp;lt;id&amp;gt;spring-milestones&amp;lt;/id&amp;gt;
        &amp;lt;url&amp;gt;http://repo.spring.io/milestone&amp;lt;/url&amp;gt;
    &amp;lt;/pluginRepository&amp;gt;
&amp;lt;/pluginRepositories&amp;gt;
...
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-boot-starter-web&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-boot-starter-security&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-boot-starter-actuator&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
...
&amp;lt;plugin&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-boot-maven-plugin&amp;lt;/artifactId&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Upon restarting my app, I got an error about spring-security.xml using a 3.1 XSD. I fixed it by changing to 3.2. Next, I wanted to eliminate web.xml. First of all, I created an &lt;code&gt;ApplicationInitializer&lt;/code&gt; so the WAR could be started from the command line.&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
package com.raibledesigns.boot.config;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableAutoConfiguration
@ComponentScan
public class ApplicationInitializer extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ApplicationInitializer.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(ApplicationInitializer.class, args);
    }
}
&lt;/pre&gt;
&lt;p&gt;However, after adding this, I received the following error on startup:&lt;/p&gt;
&lt;pre class=&quot;brush: shell&quot;&gt;
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
&apos;org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor&apos;: 
Invocation of init method failed; nested exception is 
java.lang.AbstractMethodError: org.hibernate.validator.internal.engine.ConfigurationImpl
.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
&lt;/pre&gt;
&lt;p&gt;Adding hibernate-validator as a dependency solved this problem:&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.hibernate&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;hibernate-validator&amp;lt;/artifactId&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;p&gt;To configure Spring Security without web.xml and spring-security.xml, I created &lt;code&gt;WebSecurityConfig.java&lt;/code&gt;:
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
package com.raibledesigns.boot.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
@EnableWebSecurity
@Order(Ordered.LOWEST_PRECEDENCE - 6)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .antMatchers(&quot;/&quot;, &quot;/home&quot;).permitAll()
                .antMatchers(&quot;/v1.0/**&quot;).hasRole(&quot;USER&quot;)
                .anyRequest().authenticated();
        http.httpBasic().realmName(&quot;My API&quot;);
    }

    @Override
    protected void configure(AuthenticationManagerBuilder authManagerBuilder) throws Exception {
        authManagerBuilder.inMemoryAuthentication()
                .withUser(&quot;test&quot;).password(&quot;test123&quot;).roles(&quot;USER&quot;);
    }
}
&lt;/pre&gt;
&lt;p&gt;To configure Jersey without web.xml, I created a &lt;code&gt;JerseyConfig&lt;/code&gt; class:&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
package com.raibledesigns.boot.config;

import org.glassfish.jersey.filter.LoggingFilter;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.ServerProperties;

import javax.ws.rs.ApplicationPath;

@ApplicationPath(&quot;/v1.0&quot;)
public class JerseyConfig extends ResourceConfig {

    public JerseyConfig() {
        packages(&quot;com.raibledesigns.boot.service&quot;);
        property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
        property(ServerProperties.JSON_PROCESSING_FEATURE_DISABLE, false);
        property(ServerProperties.MOXY_JSON_FEATURE_DISABLE, true);
        property(ServerProperties.WADL_FEATURE_DISABLE, true);
        register(LoggingFilter.class);
        register(JacksonFeature.class);
    }
}
&lt;/pre&gt;
&lt;p&gt;Finally, I created &lt;code&gt;MvcConfig.java&lt;/code&gt; to set the welcome page.&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
package com.raibledesigns.boot.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController(&quot;/&quot;).setViewName(&quot;index&quot;);
    }
}
&lt;/pre&gt;
&lt;p&gt;To cleanup, I deleted &lt;code&gt;src/main/webapp/WEB-INF&lt;/code&gt; and created &lt;code&gt;src/main/resources/logback.xml&lt;/code&gt;:
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;configuration&amp;gt;
    &amp;lt;include resource=&quot;org/springframework/boot/logging/logback/base.xml&quot;/&amp;gt;
    &amp;lt;logger name=&quot;org.springframework.boot&quot; level=&quot;INFO&quot;/&amp;gt;
    &amp;lt;logger name=&quot;org.springframework.security&quot; level=&quot;ERROR&quot;/&amp;gt;
&amp;lt;/configuration&amp;gt;
&lt;/pre&gt;&lt;p&gt;Since Boot doesn&apos;t support JSP out-of-the-box, I renamed my index.jsp file to index.html and changed the URL in it to point to &quot;/v1.0/hello&quot;. I was pleased to see that everything worked nicely. I learned shortly after that I could remove the Spring BOM since Spring Boot &lt;a href=&quot;https://twitter.com/rob_winch/status/410609696639184896&quot;&gt;uses a &amp;lt;spring.version&amp;gt; property to control its Spring version&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;The only issue I found is when started the app with &quot;mvn package &amp;&amp; java -jar target/app.war&quot;, it failed to initialize Jersey. I tried adding a @Bean for the servlet:&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@Bean
public ServletRegistrationBean jerseyServlet() {
    ServletRegistrationBean registration = new ServletRegistrationBean(new ServletContainer(), &quot;/v1.0/*&quot;);
    registration.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, JerseyConfig.class.getName());
    return registration;
}
&lt;/pre&gt;
&lt;p&gt;Unfortunately, when running it using &quot;java -jar&quot;, I get the following error:
&lt;/p&gt;
&lt;pre class=&quot;brush: shell&quot;&gt;
org.glassfish.hk2.api.MultiException: A MultiException has 1 exceptions.  They are:
1. org.glassfish.jersey.server.internal.scanning.ResourceFinderException: 
java.io.FileNotFoundException: /.../target/app.war!/WEB-INF/classes (No such file or directory)
	at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:869)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:814)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:906)
	at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:898)
	at org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:300)
	at org.glassfish.jersey.server.ApplicationHandler.&amp;lt;init&amp;gt;(ApplicationHandler.java:279)
	at org.glassfish.jersey.servlet.WebComponent.&amp;lt;init&amp;gt;(WebComponent.java:302)
&lt;/pre&gt;
&lt;p&gt;
This seems strange since there is a WEB-INF/classes in my WAR. Regardless, this is not a Boot problem per se, but more of a Jersey issue. From one of the Boot developers:&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
The whole idea with Boot is that servlets are just a transport - they are a means to an end, and hopefully not the only one - the &quot;container&quot; is Spring, not the servlet container. We probably could add some form of support for SCI but only by hacking the containers since the spec really doesn&apos;t allow for much control of their lifecycle. It hasn&apos;t been a priority so far.
&lt;/p&gt;
&lt;p id=&quot;summary&quot;&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br/&gt;
I hope this article is useful to see how you to upgrade your Java webapps to use Spring 4 and Spring Boot. I&apos;ve created a &lt;a href=&quot;https://github.com/mraible/boot-makeover&quot;&gt;boot-makeover project on GitHub&lt;/a&gt; with all the code mentioned. You can also &lt;a href=&quot;https://github.com/mraible/boot-makeover/commits/master&quot;&gt;view the commits&lt;/a&gt; for each step. &lt;/p&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/integrating_oauth_with_appfuse_and</id>
        <title type="html">Integrating OAuth with AppFuse and its REST API</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/integrating_oauth_with_appfuse_and"/>
        <published>2011-07-05T10:56:48-06:00</published>
        <updated>2014-05-08T19:47:19-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="appfuse" scheme="http://roller.apache.org/ns/tags/" />
        <category term="springsecurity" scheme="http://roller.apache.org/ns/tags/" />
        <category term="rest" scheme="http://roller.apache.org/ns/tags/" />
        <category term="oauth" scheme="http://roller.apache.org/ns/tags/" />
        <category term="enunciate" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">One of the new features in &lt;a href=&quot;http://raibledesigns.com/rd/entry/appfuse_2_1_released&quot;&gt;AppFuse 2.1&lt;/a&gt; is an &lt;a href=&quot;http://issues.appfuse.org/browse/APF-897&quot;&gt;appfuse-ws&lt;/a&gt; archetype. This archetype leverages &lt;a href=&quot;http://enunciate.codehaus.org/&quot;&gt;Enunciate&lt;/a&gt; and &lt;a href=&quot;http://cxf.apache.org/&quot;&gt;CXF&lt;/a&gt; to create a project with a REST API and generated HTML documentation. Enunciate is a very useful tool, allowing you to develop web services with JAX-RS and JAX-WS annotations and have all types of client libraries generated. For me, it seems very useful for developing the backend of &lt;abbr title=&quot;Service Oriented Front End Applications&quot;&gt;SOFEA&lt;/abbr&gt; (a.k.a. modern) applications. &lt;/p&gt;
&lt;p&gt;Back in March, &lt;a href=&quot;http://www.java.net/blogs/stoicflame/&quot;&gt;Ryan Heaton&lt;/a&gt; published a nice article on &lt;a href=&quot;http://docs.codehaus.org/display/ENUNCIATE/Securing+Web+Services&quot;&gt;Securing Web Services&lt;/a&gt; in an Enunciate application. I decided to take his tutorial a step further and not only secure my web services, but also to integrate with  OAuth 2. In this tutorial, I&apos;ll show you how to create a new application with AppFuse WS, secure it, add OAuth support, and then use a client app to authenticate and retrieve data.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#create-appfuse-ws&quot;&gt;Create a New AppFuse WS Project&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#integrate-oauth&quot;&gt;Integrate Spring Security and OAuth&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#oauth-client&quot;&gt;Authenticate and Retrieve Data with Client&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p id=&quot;create-appfuse-ws&quot;&gt;
&lt;strong&gt;Create a New AppFuse WS Project&lt;/strong&gt;&lt;br/&gt;
To begin, I visited the &lt;a href=&quot;http://static.appfuse.org/archetypes.html&quot;&gt;Create AppFuse Archetypes&lt;/a&gt; page and created a new application using the &quot;Web Services Only&quot; option in the &lt;em&gt;Web Framework&lt;/em&gt; dropdown. Below is the command I used to create the &quot;appfuse-oauth&quot; project.
&lt;/p&gt;
&lt;pre&gt;
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes \
-DarchetypeArtifactId=appfuse-ws-archetype -DarchetypeVersion=2.1.0 \
-DgroupId=org.appfuse.example -DartifactId=appfuse-oauth 
&lt;/pre&gt;
&lt;p&gt;After doing this, I started the app using &lt;strong&gt;mvn jetty:run&lt;/strong&gt; and confirmed it started OK. At this point, I was able to view the generated documentation for the application at &lt;a href=&quot;http://localhost:8080&quot;&gt;http://localhost:8080&lt;/a&gt;. The screenshot below shows what the app looks like at this point.
&lt;/p&gt;
&lt;p style=&quot;text-align: center&quot;&gt;
&lt;a href=&quot;http://farm7.static.flickr.com/6004/5891597325_7f9829e158.jpg&quot; title=&quot;AppFuse WS Homepage&quot; rel=&quot;lightbox[appfuse-oauth]&quot;&gt;&lt;img src=&quot;//farm7.static.flickr.com/6004/5891597325_7f9829e158_m.jpg&quot; width=&quot;240&quot; height=&quot;198&quot; alt=&quot;AppFuse WS Homepage&quot;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p style=&quot;font-weight: italic; color: #666; margin-left: 10px&quot;&gt;
NOTE: You might notice the REST endpoint of /{username}. This is &lt;a href=&quot;http://issues.appfuse.org/browse/APF-1246&quot; style=&quot;color: #666&quot;&gt;a bug&lt;/a&gt; in AppFuse 2.1.0 and has been fixed in SVN. It does not affect this tutorial.&lt;/p&gt;
&lt;p id=&quot;integrate-oauth&quot;&gt;
&lt;strong&gt;Integrate Spring Security and OAuth&lt;/strong&gt;&lt;br/&gt;
I originally tried to integrate Spring Security with Enunciate&apos;s &lt;a href=&quot;http://docs.codehaus.org/display/ENUNCIATE/Securing+Web+Services&quot;&gt;Securing Web Services Tutorial&lt;/a&gt;. However, it only secures endpoints and doesn&apos;t do enough filtering for OAuth support, so I ended up using a custom web.xml. I put this file in &lt;em&gt;src/main/resources&lt;/em&gt; and loaded it in my &lt;em&gt;enunciate.xml&lt;/em&gt; file. I also upgraded Spring Security and imported my security.xml file.
&lt;/p&gt;
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
  &amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;
  &amp;lt;enunciate xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
             xsi:noNamespaceSchemaLocation=&quot;http://enunciate.codehaus.org/schemas/enunciate-1.22.xsd&quot;&amp;gt;
      ...
      &amp;lt;webapp mergeWebXML=&quot;src/main/resources/web.xml&quot;/&amp;gt;
      &amp;lt;modules&amp;gt;
      ...
          &amp;lt;spring-app disabled=&quot;false&quot; springVersion=&quot;3.0.5.RELEASE&quot;&amp;gt;
              &amp;lt;springImport uri=&quot;classpath:/applicationContext-resources.xml&quot;/&amp;gt;
              &amp;lt;springImport uri=&quot;classpath:/applicationContext-dao.xml&quot;/&amp;gt;
              &amp;lt;springImport uri=&quot;classpath:/applicationContext-service.xml&quot;/&amp;gt;
              &amp;lt;springImport uri=&quot;classpath:/applicationContext.xml&quot;/&amp;gt;
              &amp;lt;springImport uri=&quot;classpath:/security.xml&quot;/&amp;gt;
          &amp;lt;/spring-app&amp;gt;
      &amp;lt;/modules&amp;gt;
  &amp;lt;/enunciate&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Then I created &lt;em&gt;src/main/resources/web.xml&lt;/em&gt; with a filter for Spring Security and a DispatcherServlet for OAuth support.
&lt;/p&gt;
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;web-app xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;
         xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
         xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&quot;
         version=&quot;3.0&quot;&amp;gt;

    &amp;lt;filter&amp;gt;
        &amp;lt;filter-name&amp;gt;securityFilter&amp;lt;/filter-name&amp;gt;
        &amp;lt;filter-class&amp;gt;org.springframework.web.filter.DelegatingFilterProxy&amp;lt;/filter-class&amp;gt;
        &amp;lt;init-param&amp;gt;
            &amp;lt;param-name&amp;gt;targetBeanName&amp;lt;/param-name&amp;gt;
            &amp;lt;param-value&amp;gt;springSecurityFilterChain&amp;lt;/param-value&amp;gt;
        &amp;lt;/init-param&amp;gt;
    &amp;lt;/filter&amp;gt;

    &amp;lt;filter-mapping&amp;gt;
        &amp;lt;filter-name&amp;gt;securityFilter&amp;lt;/filter-name&amp;gt;
        &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;
    &amp;lt;/filter-mapping&amp;gt;

    &amp;lt;servlet&amp;gt;
        &amp;lt;servlet-name&amp;gt;appfuse-oauth&amp;lt;/servlet-name&amp;gt;
        &amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&amp;lt;/servlet-class&amp;gt;
        &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;
    &amp;lt;/servlet&amp;gt;

    &amp;lt;servlet-mapping&amp;gt;
        &amp;lt;servlet-name&amp;gt;appfuse-oauth&amp;lt;/servlet-name&amp;gt;
        &amp;lt;url-pattern&amp;gt;/oauth/*&amp;lt;/url-pattern&amp;gt;
    &amp;lt;/servlet-mapping&amp;gt;
&amp;lt;/web-app&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Next, I created a &lt;em&gt;src/main/resources/security.xml&lt;/em&gt; and used it to secure my API, specify a login page, supply the users and integrate OAuth (see the last 4 beans below). &lt;/p&gt;
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;beans:beans xmlns=&quot;http://www.springframework.org/schema/security&quot;
             xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
             xmlns:beans=&quot;http://www.springframework.org/schema/beans&quot;
             xmlns:oauth=&quot;http://www.springframework.org/schema/security/oauth2&quot;
             xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
                           http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2.xsd&quot;&amp;gt;

    &amp;lt;http auto-config=&quot;true&quot;&amp;gt;
        &amp;lt;intercept-url pattern=&quot;/api/**&quot; access=&quot;ROLE_USER&quot;/&amp;gt;
        &amp;lt;intercept-url pattern=&quot;/oauth/**&quot; access=&quot;ROLE_USER&quot;/&amp;gt;
        &amp;lt;intercept-url pattern=&quot;/**&quot; access=&quot;IS_AUTHENTICATED_ANONYMOUSLY&quot;/&amp;gt;
        &amp;lt;form-login login-page=&quot;/login.jsp&quot; authentication-failure-url=&quot;/login.jsp?error=true&quot;
                    login-processing-url=&quot;/j_security_check&quot;/&amp;gt;
    &amp;lt;/http&amp;gt;

    &amp;lt;authentication-manager&amp;gt;
        &amp;lt;authentication-provider&amp;gt;
            &amp;lt;user-service&amp;gt;
                &amp;lt;user name=&quot;admin&quot; password=&quot;admin&quot; authorities=&quot;ROLE_USER,ROLE_ADMIN&quot;/&amp;gt;
                &amp;lt;user name=&quot;user&quot; password=&quot;user&quot; authorities=&quot;ROLE_USER&quot;/&amp;gt;
            &amp;lt;/user-service&amp;gt;
        &amp;lt;/authentication-provider&amp;gt;
    &amp;lt;/authentication-manager&amp;gt;

    &amp;lt;!--hook up the spring security filter chain--&amp;gt;
    &amp;lt;beans:alias name=&quot;springSecurityFilterChain&quot; alias=&quot;securityFilter&quot;/&amp;gt;

    &amp;lt;beans:bean id=&quot;tokenServices&quot;
                class=&quot;org.springframework.security.oauth2.provider.token.InMemoryOAuth2ProviderTokenServices&quot;&amp;gt;
        &amp;lt;beans:property name=&quot;supportRefreshToken&quot; value=&quot;true&quot;/&amp;gt;
    &amp;lt;/beans:bean&amp;gt;

    &amp;lt;oauth:provider client-details-service-ref=&quot;clientDetails&quot; token-services-ref=&quot;tokenServices&quot;&amp;gt;
        &amp;lt;oauth:verification-code user-approval-page=&quot;/oauth/confirm_access&quot;/&amp;gt;
    &amp;lt;/oauth:provider&amp;gt;

    &amp;lt;oauth:client-details-service id=&quot;clientDetails&quot;&amp;gt;
        &amp;lt;!--&amp;lt;oauth:client clientId=&quot;my-trusted-client&quot; authorizedGrantTypes=&quot;password,authorization_code,refresh_token&quot;/&amp;gt;
        &amp;lt;oauth:client clientId=&quot;my-trusted-client-with-secret&quot;
                      authorizedGrantTypes=&quot;password,authorization_code,refresh_token&quot; secret=&quot;somesecret&quot;/&amp;gt;
        &amp;lt;oauth:client clientId=&quot;my-less-trusted-client&quot; authorizedGrantTypes=&quot;authorization_code&quot;/&amp;gt;--&amp;gt;
        &amp;lt;oauth:client clientId=&quot;ajax-login&quot; authorizedGrantTypes=&quot;authorization_code&quot;/&amp;gt;
    &amp;lt;/oauth:client-details-service&amp;gt;
&amp;lt;/beans:beans&amp;gt;
&lt;/pre&gt;
&lt;p&gt;I used the &lt;a href=&quot;http://static.springsource.org/spring-security/oauth/tutorial.html&quot;&gt;OAuth for Spring Security sample apps&lt;/a&gt; to figure this out. In this example, I used authorizedGrantTypes=&quot;authorization_code&quot;, but you can see from the commented &amp;lt;oauth:client&gt; elements above that there&apos;s a few different options. You should also note that the clientId is hard-coded to &quot;ajax-login&quot;, signifying I only want to allow a single application to authenticate.
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;At this point, I&apos;d like to give a shoutout to Ryan Heaton for creating &lt;em&gt;both&lt;/em&gt; Enunciate and Spring Security&apos;s OAuth support. Nice work Ryan!&lt;/p&gt;
&lt;p&gt;At this point, I needed to do a number of additional tasks to finish integrating oauth. The first was to modify the Jetty Plugin&apos;s configuration to 1) run on port 9000, 2) load my custom files and 3) allow jetty:run to recognize Enunciate&apos;s generated files. Below is the final configuration in my pom.xml.
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;plugin&amp;gt;
    &amp;lt;groupId&amp;gt;org.mortbay.jetty&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;maven-jetty-plugin&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;6.1.26&amp;lt;/version&amp;gt;
    &amp;lt;configuration&amp;gt;
        &amp;lt;connectors&amp;gt;
            &amp;lt;connector implementation=&quot;org.mortbay.jetty.nio.SelectChannelConnector&quot;&amp;gt;
                &amp;lt;port&amp;gt;9000&amp;lt;/port&amp;gt;
                &amp;lt;maxIdleTime&amp;gt;60000&amp;lt;/maxIdleTime&amp;gt;
            &amp;lt;/connector&amp;gt;
        &amp;lt;/connectors&amp;gt;
        &amp;lt;webAppConfig&amp;gt;
            &amp;lt;baseResource implementation=&quot;org.mortbay.resource.ResourceCollection&quot;&amp;gt;
                &amp;lt;resourcesAsCSV&amp;gt;
                    ${basedir}/src/main/webapp,
                    ${project.build.directory}/${project.build.finalName}
                &amp;lt;/resourcesAsCSV&amp;gt;
            &amp;lt;/baseResource&amp;gt;
            &amp;lt;contextPath&amp;gt;/appfuse-oauth&amp;lt;/contextPath&amp;gt;
        &amp;lt;/webAppConfig&amp;gt;
        &amp;lt;webXml&amp;gt;${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml&amp;lt;/webXml&amp;gt;
    &amp;lt;/configuration&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Next, I added the necessary OAuth dependencies for Spring Security to my pom.xml. Since the latest release is a milestone release, I had to add Spring&apos;s milestone repo too. 
&lt;/p&gt;
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
&amp;lt;repository&amp;gt;
    &amp;lt;id&amp;gt;spring-milestone&amp;lt;/id&amp;gt;
    &amp;lt;url&amp;gt;http://s3.amazonaws.com/maven.springframework.org/milestone&amp;lt;/url&amp;gt;
&amp;lt;/repository&amp;gt;
...
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework.security&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-security-taglibs&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
    &amp;lt;exclusions&amp;gt;
        &amp;lt;exclusion&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-web&amp;lt;/artifactId&amp;gt;
        &amp;lt;/exclusion&amp;gt;
        &amp;lt;exclusion&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-support&amp;lt;/artifactId&amp;gt;
        &amp;lt;/exclusion&amp;gt;
    &amp;lt;/exclusions&amp;gt;
&amp;lt;/dependency&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework.security.oauth&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-security-oauth&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.0.0.M3&amp;lt;/version&amp;gt;
    &amp;lt;exclusions&amp;gt;
        &amp;lt;exclusion&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-beans&amp;lt;/artifactId&amp;gt;
        &amp;lt;/exclusion&amp;gt;
        &amp;lt;exclusion&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-context&amp;lt;/artifactId&amp;gt;
        &amp;lt;/exclusion&amp;gt;
        &amp;lt;exclusion&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-core&amp;lt;/artifactId&amp;gt;
        &amp;lt;/exclusion&amp;gt;
    &amp;lt;/exclusions&amp;gt;
&amp;lt;/dependency&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-webmvc&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;${spring.version}&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;javax.servlet&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;servlet-api&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;2.5&amp;lt;/version&amp;gt;
    &amp;lt;scope&amp;gt;provided&amp;lt;/scope&amp;gt;
&amp;lt;/dependency&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;javax.servlet&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;jstl&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.1.2&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;taglibs&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;standard&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.1.2&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Since I named my DispatcherServlet &quot;appfuse-oauth&quot; in web.xml, I created a &lt;em&gt;src/main/webapp/WEB-INF/appfuse-oauth-servlet.xml&lt;/em&gt; to configure Spring MVC. I had to create the &lt;em&gt;src/main/webapp/WEB-INF&lt;/em&gt; directory. &lt;/p&gt;
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
       xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
       xmlns:mvc=&quot;http://www.springframework.org/schema/mvc&quot;
       xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
                http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd&quot;&amp;gt;

    &amp;lt;!-- Scans the classpath of this application for @Components to deploy as beans --&amp;gt;
    &amp;lt;context:component-scan base-package=&quot;org.appfuse.examples.webapp&quot;/&amp;gt;

    &amp;lt;!-- Configures the @Controller programming model --&amp;gt;
    &amp;lt;mvc:annotation-driven/&amp;gt;

    &amp;lt;!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory --&amp;gt;
    &amp;lt;bean class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;&amp;gt;
        &amp;lt;property name=&quot;viewClass&quot; value=&quot;org.springframework.web.servlet.view.JstlView&quot;/&amp;gt;
        &amp;lt;property name=&quot;prefix&quot; value=&quot;/&quot;/&amp;gt;
        &amp;lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot;/&amp;gt;
    &amp;lt;/bean&amp;gt;
&amp;lt;/beans&amp;gt;
&lt;/pre&gt;
&lt;p&gt;In order to show the OAuth confirmation page, I needed to create &lt;em&gt;src/main/java/org/appfuse/examples/webapp/AccessConfirmationController.java&lt;/em&gt; and map it to /oauth/confirm_access. I copied this from one of the sample projects and modified to use Spring&apos;s annotations.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
package org.appfuse.examples.webapp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.provider.ClientAuthenticationToken;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.security.oauth2.provider.verification.ClientAuthenticationCache;
import org.springframework.security.oauth2.provider.verification.DefaultClientAuthenticationCache;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.TreeMap;

/**
 * Controller for retrieving the model for and displaying the confirmation page
 * for access to a protected resource.
 *
 * @author Ryan Heaton
 */
@Controller
@RequestMapping(&quot;/confirm_access&quot;)
public class AccessConfirmationController {

    private ClientAuthenticationCache authenticationCache = new DefaultClientAuthenticationCache();
    @Autowired
    private ClientDetailsService clientDetailsService;

    @RequestMapping(method = RequestMethod.GET)
    protected ModelAndView confirm(HttpServletRequest request, HttpServletResponse response) throws Exception {
        ClientAuthenticationToken clientAuth = authenticationCache.getAuthentication(request, response);
        if (clientAuth == null) {
            throw new IllegalStateException(&quot;No client authentication request to authorize.&quot;);
        }

        TreeMap&amp;lt;String, Object&amp;gt; model = new TreeMap&amp;lt;String, Object&amp;gt;();
        ClientDetails client = clientDetailsService.loadClientByClientId(clientAuth.getClientId());
        model.put(&quot;auth_request&quot;, clientAuth);
        model.put(&quot;client&quot;, client);

        return new ModelAndView(&quot;access_confirmation&quot;, model);
    }
}
&lt;/pre&gt;
&lt;p&gt;This controller delegates to &lt;em&gt;src/main/webapp/access_confirmation.jsp&lt;/em&gt;. I created this file and filled it with code to display Accept and Deny buttons.
&lt;/p&gt;
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
&amp;lt;%@ page import=&quot;org.springframework.security.core.AuthenticationException&quot; %&amp;gt;
&amp;lt;%@ page import=&quot;org.springframework.security.oauth2.common.exceptions.UnapprovedClientAuthenticationException&quot; %&amp;gt;
&amp;lt;%@ page import=&quot;org.springframework.security.oauth2.provider.verification.BasicUserApprovalFilter&quot; %&amp;gt;
&amp;lt;%@ page import=&quot;org.springframework.security.oauth2.provider.verification.VerificationCodeFilter&quot; %&amp;gt;
&amp;lt;%@ page import=&quot;org.springframework.security.web.WebAttributes&quot; %&amp;gt;
&amp;lt;%@ taglib prefix=&quot;authz&quot; uri=&quot;http://www.springframework.org/security/tags&quot; %&amp;gt;
&amp;lt;%@ taglib uri=&quot;http://java.sun.com/jsp/jstl/core&quot; prefix=&quot;c&quot; %&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Confirm Access&amp;lt;/title&amp;gt;
    &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;all&quot;
          href=&quot;http://demo.appfuse.org/appfuse-struts/styles/simplicity/theme.css&quot;/&amp;gt;
    &amp;lt;style type=&quot;text/css&quot;&amp;gt;
        h1 {
            margin-left: -300px;
            margin-top: 50px
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;

&amp;lt;h1&amp;gt;Confirm Access&amp;lt;/h1&amp;gt;

&amp;lt;div id=&quot;content&quot;&amp;gt;

    &amp;lt;% if (session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION) != null &amp;amp;&amp;amp; 
                 !(session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION) instanceof UnapprovedClientAuthenticationException)) { %&amp;gt;
    &amp;lt;div class=&quot;error&quot;&amp;gt;
        &amp;lt;h2&amp;gt;Woops!&amp;lt;/h2&amp;gt;

        &amp;lt;p&amp;gt;Access could not be granted.
            (&amp;lt;%= ((AuthenticationException) session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION)).getMessage() %&amp;gt;)&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;% } %&amp;gt;
    &amp;lt;c:remove scope=&quot;session&quot; var=&quot;SPRING_SECURITY_LAST_EXCEPTION&quot;/&amp;gt;

    &amp;lt;authz:authorize ifAnyGranted=&quot;ROLE_USER,ROLE_ADMIN&quot;&amp;gt;
        &amp;lt;h2&amp;gt;Please Confirm&amp;lt;/h2&amp;gt;

        &amp;lt;p&amp;gt;You hereby authorize &quot;&amp;lt;c:out value=&quot;${client.clientId}&quot; escapeXml=&quot;true&quot;/&amp;gt;&quot; to access your protected resources.&amp;lt;/p&amp;gt;

        &amp;lt;form id=&quot;confirmationForm&quot; name=&quot;confirmationForm&quot;
              action=&quot;&amp;lt;%=request.getContextPath() + VerificationCodeFilter.DEFAULT_PROCESSING_URL%&amp;gt;&quot; method=&quot;POST&quot;&amp;gt;
            &amp;lt;input name=&quot;&amp;lt;%=BasicUserApprovalFilter.DEFAULT_APPROVAL_REQUEST_PARAMETER%&amp;gt;&quot;
                   value=&quot;&amp;lt;%=BasicUserApprovalFilter.DEFAULT_APPROVAL_PARAMETER_VALUE%&amp;gt;&quot; type=&quot;hidden&quot;/&amp;gt;
            &amp;lt;label&amp;gt;&amp;lt;input name=&quot;authorize&quot; value=&quot;Authorize&quot; type=&quot;submit&quot;&amp;gt;&amp;lt;/label&amp;gt;
        &amp;lt;/form&amp;gt;
        &amp;lt;form id=&quot;denialForm&quot; name=&quot;denialForm&quot;
              action=&quot;&amp;lt;%=request.getContextPath() + VerificationCodeFilter.DEFAULT_PROCESSING_URL%&amp;gt;&quot; method=&quot;POST&quot;&amp;gt;
            &amp;lt;input name=&quot;&amp;lt;%=BasicUserApprovalFilter.DEFAULT_APPROVAL_REQUEST_PARAMETER%&amp;gt;&quot;
                   value=&quot;not_&amp;lt;%=BasicUserApprovalFilter.DEFAULT_APPROVAL_PARAMETER_VALUE%&amp;gt;&quot; type=&quot;hidden&quot;/&amp;gt;
            &amp;lt;label&amp;gt;&amp;lt;input name=&quot;deny&quot; value=&quot;Deny&quot; type=&quot;submit&quot;&amp;gt;&amp;lt;/label&amp;gt;
        &amp;lt;/form&amp;gt;
    &amp;lt;/authz:authorize&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Finally, I needed to create &lt;em&gt;src/main/webapp/login.jsp&lt;/em&gt; to allow users to login.&lt;/p&gt;
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
&amp;lt;%@ page language=&quot;java&quot; pageEncoding=&quot;UTF-8&quot; contentType=&quot;text/html;charset=utf-8&quot; %&amp;gt;
&amp;lt;%@ taglib uri=&quot;http://java.sun.com/jsp/jstl/core&quot; prefix=&quot;c&quot; %&amp;gt;
&amp;lt;%@ taglib uri=&quot;http://java.sun.com/jsp/jstl/fmt&quot; prefix=&quot;fmt&quot; %&amp;gt;
&amp;lt;%@ taglib uri=&quot;http://java.sun.com/jsp/jstl/core&quot; prefix=&quot;c&quot; %&amp;gt;

&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Login&amp;lt;/title&amp;gt;
    &amp;lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;all&quot;
          href=&quot;http://demo.appfuse.org/appfuse-struts/styles/simplicity/theme.css&quot;/&amp;gt;
    &amp;lt;style type=&quot;text/css&quot;&amp;gt;
        h1 {
            margin-left: -300px;
            margin-top: 50px
        }
    &amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;h1&amp;gt;Login&amp;lt;/h1&amp;gt;

&amp;lt;form method=&quot;post&quot; id=&quot;loginForm&quot; action=&quot;&amp;lt;c:url value=&apos;/j_security_check&apos;/&amp;gt;&quot;&amp;gt;
    &amp;lt;fieldset style=&quot;padding-bottom: 0&quot;&amp;gt;
        &amp;lt;ul&amp;gt;
            &amp;lt;c:if test=&quot;${param.error != null}&quot;&amp;gt;
                &amp;lt;li class=&quot;error&quot;&amp;gt;
                    ${sessionScope.SPRING_SECURITY_LAST_EXCEPTION.message}
                &amp;lt;/li&amp;gt;
            &amp;lt;/c:if&amp;gt;
            &amp;lt;li&amp;gt;
                &amp;lt;label for=&quot;j_username&quot; class=&quot;required desc&quot;&amp;gt;
                    Username &amp;lt;span class=&quot;req&quot;&amp;gt;*&amp;lt;/span&amp;gt;
                &amp;lt;/label&amp;gt;
                &amp;lt;input type=&quot;text&quot; class=&quot;text medium&quot; name=&quot;j_username&quot;
                       id=&quot;j_username&quot; tabindex=&quot;1&quot;/&amp;gt;
            &amp;lt;/li&amp;gt;

            &amp;lt;li&amp;gt;
                &amp;lt;label for=&quot;j_password&quot; class=&quot;required desc&quot;&amp;gt;
                    Password &amp;lt;span class=&quot;req&quot;&amp;gt;*&amp;lt;/span&amp;gt;
                &amp;lt;/label&amp;gt;
                &amp;lt;input type=&quot;password&quot; class=&quot;text medium&quot; name=&quot;j_password&quot;
                       id=&quot;j_password&quot; tabindex=&quot;2&quot;/&amp;gt;
            &amp;lt;/li&amp;gt;
            &amp;lt;li&amp;gt;
                &amp;lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;login&quot; value=&quot;Login&quot;
                       tabindex=&quot;3&quot;/&amp;gt;
            &amp;lt;/li&amp;gt;
        &amp;lt;/ul&amp;gt;
    &amp;lt;/fieldset&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p&gt;All the changes described in the above section are necessary to implement OAuth if you create a project with AppFuse WS 2.1. It may seem like a lot of code, but I was able to copy/paste and get it all working in an app in under 5 minutes. Hopefully you can do the same. I&apos;m also considering adding it by default to the next version of AppFuse. Now let&apos;s look at integrating OAuth into a client to authenticate and retrieve data from this application.
&lt;/p&gt;
&lt;p id=&quot;oauth-client&quot;&gt;&lt;strong&gt;Authenticate and Retrieve Data with Client&lt;/strong&gt;&lt;br/&gt;
I originally thought my &lt;a href=&quot;http://raibledesigns.com/rd/entry/implementing_oauth_with_gwt&quot;&gt;GWT OAuth&lt;/a&gt; application would provide a nice client. However, after 30 minutes of trying to get GWT 1.7.1 and the GWT Maven plugin (1.1) working with my 64-bit Java 6 JDK on OS X, I gave up. So I opted to use the &lt;a href=&quot;https://github.com/mraible/ajax-login&quot;&gt;Ajax Login&lt;/a&gt; application I&apos;ve been using in my recent security tutorials.
&lt;/p&gt;
&lt;p&gt;In this example, I used OAuth2RestTemplate from Spring Security OAuth. While this works, and works well, I&apos;d still like to get things working with GWT (or jQuery) to demonstrate how to do it from a pure client-side perspective.
&lt;/p&gt;
&lt;p&gt;To begin, I got the latest source of Ajax Login from GitHub (as of this morning) and made some changes. First of all, I added the Spring Security OAuth dependencies to pom.xml:
&lt;/p&gt;
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
&amp;lt;repository&amp;gt;
    &amp;lt;id&amp;gt;spring-milestone&amp;lt;/id&amp;gt;
    &amp;lt;url&amp;gt;http://s3.amazonaws.com/maven.springframework.org/milestone&amp;lt;/url&amp;gt;
&amp;lt;/repository&amp;gt;
...
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.springframework.security.oauth&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;spring-security-oauth&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.0.0.M3&amp;lt;/version&amp;gt;
    &amp;lt;exclusions&amp;gt;
        &amp;lt;exclusion&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-beans&amp;lt;/artifactId&amp;gt;
        &amp;lt;/exclusion&amp;gt;
        &amp;lt;exclusion&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-context&amp;lt;/artifactId&amp;gt;
        &amp;lt;/exclusion&amp;gt;
        &amp;lt;exclusion&amp;gt;
            &amp;lt;groupId&amp;gt;org.springframework&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;spring-core&amp;lt;/artifactId&amp;gt;
        &amp;lt;/exclusion&amp;gt;
    &amp;lt;/exclusions&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Then I modified &lt;em&gt;src/main/webapp/WEB-INF/security.xml&lt;/em&gt; and added an OAuth Token Service and defined the location of the OAuth server.&lt;/p&gt; 
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;beans:beans xmlns=&quot;http://www.springframework.org/schema/security&quot;
             xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
             xmlns:beans=&quot;http://www.springframework.org/schema/beans&quot;
             xmlns:oauth=&quot;http://www.springframework.org/schema/security/oauth2&quot;
             xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
              http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
              http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2.xsd&quot;&amp;gt;

...
    &amp;lt;oauth:client token-services-ref=&quot;oauth2TokenServices&quot;/&amp;gt;

    &amp;lt;beans:bean id=&quot;oauth2TokenServices&quot;
                class=&quot;org.springframework.security.oauth2.consumer.token.InMemoryOAuth2ClientTokenServices&quot;/&amp;gt;

    &amp;lt;oauth:resource id=&quot;appfuse&quot; type=&quot;authorization_code&quot; clientId=&quot;ajax-login&quot;
                    accessTokenUri=&quot;http://localhost:9000/appfuse-oauth/oauth/authorize&quot;
                    userAuthorizationUri=&quot;http://localhost:9000/appfuse-oauth/oauth/user/authorize&quot;/&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Next, I created a Controller that uses OAuth2RestTemplate to make the request and get the data from the AppFuse OAuth application&apos;s API. I created &lt;em&gt;src/main/java/org/appfuse/examples/webapp/oauth/UsersApiController.java&lt;/em&gt; and filled it with the following code:&lt;/p&gt;
&lt;pre class=&quot;brush: java; auto-links: false&quot;&gt;
package org.appfuse.examples.webapp.oauth;

import org.appfuse.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException;
import org.springframework.security.oauth2.consumer.*;
import org.springframework.security.oauth2.consumer.token.OAuth2ClientTokenServices;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@RequestMapping(&quot;/appfuse/users&quot;)
@Controller
public class UsersApiController {

    private OAuth2RestTemplate apiRestTemplate;
    @Autowired
    private OAuth2ClientTokenServices tokenServices;

    private static final String REMOTE_DATA_URL = &quot;http://localhost:9000/appfuse-oauth/api/users&quot;;

    @Autowired
    public UsersApiController(OAuth2ProtectedResourceDetails resourceDetails) {
        this.apiRestTemplate = new OAuth2RestTemplate(resourceDetails);
    }

    @RequestMapping(method = RequestMethod.GET)
    @ResponseBody
    public List&amp;lt;User&amp;gt; getUsers() {
        try {
            List users = apiRestTemplate.getForObject(REMOTE_DATA_URL, List.class);
            return new ArrayList&amp;lt;User&amp;gt;(users);
        } catch (InvalidTokenException badToken) {
            //we&apos;ve got a bad token, probably because it&apos;s expired.
            OAuth2ProtectedResourceDetails resource = apiRestTemplate.getResource();
            OAuth2SecurityContext context = OAuth2SecurityContextHolder.getContext();
            if (context != null) {
                // this one is kind of a hack for this application
                // the problem is that the sparklr photos page doesn&apos;t remove the &apos;code=&apos; request parameter.
                ((OAuth2SecurityContextImpl) context).setVerificationCode(null);
            }
            //clear any stored access tokens...
            tokenServices.removeToken(SecurityContextHolder.getContext().getAuthentication(), resource);
            //go get a new access token...
            throw new OAuth2AccessTokenRequiredException(resource);
        }
    }
}
&lt;/pre&gt;
&lt;p&gt;At this point, I thought everything would work and I spent quite some time banging my head against the wall when it didn&apos;t. As I was composing an email to the Enunciate users mailing list, I realized the issue. It appeared to be working, but from the server side, and the redirect back to the client was not happening. The Ajax Login app uses UrlRewriteFilter (for pretty URLs) to redirect from /app/* to /$1 and this redirect was losing the code parameter in the URL. 
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;rule&amp;gt;
    &amp;lt;from&amp;gt;/app/**&amp;lt;/from&amp;gt;
    &amp;lt;to last=&quot;true&quot; type=&quot;redirect&quot;&amp;gt;%{context-path}/$1&amp;lt;/to&amp;gt;
&amp;lt;/rule&amp;gt;
&lt;/pre&gt;
&lt;p&gt;To fix this, I added use-query-string=&quot;true&quot; to the root element in &lt;em&gt;src/main/webapp/WEB-INF/urlrewrite.xml&lt;/em&gt;:
&lt;pre class=&quot;brush: xml; toolbar: false&quot;&gt;
&amp;lt;urlrewrite default-match-type=&quot;wildcard&quot; use-query-string=&quot;true&quot;&gt;
&lt;/pre&gt;
&lt;p&gt;After making all these changes, I ran &lt;strong&gt;mvn jetty:run&lt;/strong&gt; on both apps and opened &lt;a href=&quot;http://localhost:8080/appfuse/users&quot;&gt;http://localhost:8080/appfuse/users&lt;/a&gt; in my browser. It all worked and a smile crept across my face. I&apos;ve checked in the client changes into &lt;a href=&quot;https://github.com/mraible/ajax-login&quot;&gt;ajax-login on GitHub&lt;/a&gt; and the appfuse-oauth example into &lt;a href=&quot;http://code.google.com/p/appfuse-demos/&quot;&gt;AppFuse Demos on Google Code&lt;/a&gt;. If you&apos;d like to see this example in action, I&apos;d encourage you to checkout both projects and let me know if you find any issues.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/hyperproductive_jsf_2_0_with</id>
        <title type="html">Hyperproductive JSF 2.0 with Ed Burns at Jazoon</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/hyperproductive_jsf_2_0_with"/>
        <published>2011-06-23T04:53:10-06:00</published>
        <updated>2011-06-23T10:53:10-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="edburns" scheme="http://roller.apache.org/ns/tags/" />
        <category term="productivity" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jazoon" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jsf" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jsf2" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">This morning, I attended Ed Burn&apos;s Talk on &lt;a href=&quot;http://jazoon.com/Conference/Thursday-23-June/Edward-John-Burns&quot;&gt;Hyperproductive JSF 2.0&lt;/a&gt; at &lt;a href=&quot;http://jazoon.com&quot;&gt;Jazoon&lt;/a&gt;. As you might know, I&apos;ve been a critic of JSF for many years. However, it is &lt;a href=&quot;http://www.zeroturnaround.com/java-ee-productivity-report-2011/&quot;&gt;one of the most used Java web frameworks&lt;/a&gt;, so I was hoping to learn how it&apos;s improved in the latest version. Below are my notes from Ed&apos;s presentation.&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;
Ed&apos;s Plan for our Time Investment:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Define a productive development environment&lt;/li&gt;
&lt;li&gt;JSF for greenfield and brownfield projects&lt;/li&gt;
&lt;li&gt;List the top 9 productivity killers with JSF projects and solutions&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;em&gt;&quot;I am always doing that which I cannot do, in order that I may learn how to do it.&quot; -- Pablo Picasso&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;
Software is an executable representation of knowledge, a byproduct of learning how to solve a problem. Knowledge is something that changes as more information comes in. A productive environment makes it as easy as possible to learn how to solve a problem. Learning is an iterative process. Early iterations don&apos;t need to be optimal. Later iterations do ... and they need to be maintainable. &lt;em&gt;First&lt;/em&gt; is the hardest. &lt;em&gt;Fast&lt;/em&gt; iterations are they key. Spring Roo and Play are examples of frameworks that make the first iteration very fast.
&lt;/p&gt;
&lt;p&gt;
You should use a tool to jumpstart JSF development: copy from an old project, use a Maven archetype or use your IDE. With greenfield development, you don&apos;t have to bother learning the byproduct of other people&apos;s learning. It&apos;s a great opportunity to pad your resume with the latest hot technologies. With brownfield development, it&apos;s vitally important to understand the existing solution and hidden assumptions. You&apos;re also much more constrained in your technology choices. If you want to change, you&apos;ll need to come up with a migration strategy, which can be difficult. JSF works well for both because it&apos;s not just a runtime framework, it&apos;s also a conceptual framework. You need to understand how your framework handles data conversion, validation, page flow, persistence integration, I18N, L10N, A11Y, Web standards and user friendliness. 
&lt;/p&gt;
&lt;p&gt;
Top 9 JSF Productivity Killers:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Time wasting deployment step&lt;/li&gt;
&lt;li&gt;The perils of &quot;there&apos;s more than one way to do it&quot;&lt;/li&gt;
&lt;li&gt;Lengthy and painful developer on-boarding process&lt;/li&gt;
&lt;li&gt;Misused logging and misunderstood error messages&lt;/li&gt;
&lt;li&gt;Phantoms&lt;/li&gt;
&lt;li&gt;Under-utilized developer tools&lt;/li&gt;
&lt;li&gt;Premature optimization&lt;/li&gt;
&lt;li&gt;Difficulty in doing TDD&lt;/li&gt;
&lt;li&gt;Lack of an app framework&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;strong&gt;Time wasting deployment step&lt;/strong&gt;&lt;br/&gt;
ZeroTurnaround solves this problem with JRebel, but there&apos;s other ways to do it. Some of the killers of flow state: 1) one large war file, 2) underutilizing dynamic language features, 3) complex server environment and 4) build process is redoing work unnecessarily. To stop the time wasting deployment step, the most important things you can do are as follows:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Configure your IDE correctly. In Eclipse, compile directly into WEB-INF/classes and use continuous compilation. With NetBeans, use GlassFish.&lt;/li&gt;
&lt;li&gt;Don&apos;t do control-flow programming in XML.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Ed then showed a simple demo that showed how you can use Groovy to create a JSF UI Component. He also mentioned that Groovy can be used to author any JSF artifact. The benefit of this is you can simply edit and save a .groovy file without having to recompile or redeploy. Unfortunately, using Groovy didn&apos;t eliminate the XML syntax for pages or the XML for defining UI components. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The perils of &quot;there&apos;s more than one way to do it&quot;&lt;/strong&gt;&lt;br/&gt;
JSF is very flexible, but flexibility is, more often than not, abused. There&apos;s a lack of convention for common things (e.g. master-detail, JSF concepts like converter, validator, etc.). The best way to fix this is to establish the norms for a project and stick with them. For example, Neil Griffin has a &lt;a href=&quot;http://www.liferay.com/web/neil.griffin/blog/-/blogs/making-distinctions-between-different-kinds-of-jsf-managed-beans&quot;&gt;good blog entry&lt;/a&gt; for the different kind of managed beans you can create. Develop recommendations like Neil&apos;s and use them on all your projects.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Lengthy developer on-boarding process&lt;/strong&gt;&lt;br/&gt;
Stick with standards when possible (at least have a common project description and build system across projects). Be committed to periodic cleanup cycles, including documenting for re-use. Pick one JSF component library and stick with it. Support for mixing and switching component libraries has improved with JSF 2, but it&apos;s still recommended you use only one.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Misused logging and misunderstood error messages&lt;/strong&gt;&lt;br/&gt;
JSF is notorious for cryptic error messages and very long stack traces. It&apos;s still a problem, but the JSF Team is still working on improving them. Good tip: use the &amp;lt;ui:debug&gt; tag. Its &lt;em&gt;recordStateSize=&quot;true&quot;&lt;/em&gt; attribute can be especially useful. If you&apos;re using &lt;a href=&quot;http://www.primefaces.org/&quot;&gt;PrimeFaces&lt;/a&gt;, add &lt;em&gt;trace=true&lt;/em&gt; to request URLs.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Phantoms&lt;/strong&gt;&lt;br/&gt;
Phantoms is when running code is not the same as the code you are modifying or wrong version of library gets picked up. You should have the capability to hit breakpoints anywhere in your entire software stack, including core Java sources. This is one of the most useful things about open source software. Solutions to phantoms: 1) put a timestamp on every redeploy and have the timestamp appear in the system log 2) write the running library stack to the system log (each library and version being used) and make it easy to compare one developer&apos;s runtime stack with another&apos;s 3) consider doing all work in tightly controlled VMs (checkout the VM at the beginning of the day, do your work, commit your changes and throw your VM away at the end of the day). 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Under-utilizing developer tools&lt;/strong&gt;&lt;br/&gt;
Make sure everyone has the fastest machines available and as much screen real estate as desired. Hardware is much cheaper than developer time. Another tip is to use Hudson as your butler. It&apos;s not just the team CI server. In other words, take advantage of automation wherever you can.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Premature Optimization&lt;/strong&gt;&lt;br/&gt;
Keep in mind the trade-offs between readability and performance. When using frameworks such as JSF, don&apos;t try to outsmart the implementation. Rather, use the framework as intended and use open-source contributions to treat performance problems. Example, EL expressions got a lot faster between EE5 and EE6. If you spent time trying to optimize EL expressions, you might&apos;ve been wasting your time.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Difficulty in doing TDD&lt;/strong&gt;&lt;br/&gt;
Try to figure out why TDD is difficult in your company. For JSF, strongly consider JBoss&apos;s &lt;a href=&quot;http://www.jboss.org/jsfunit&quot;&gt;JSFUnit&lt;/a&gt;. Write your testcases to extend from Cactus ServletTestCase and leverage &lt;a href=&quot;http://htmlunit.sourceforge.net/&quot;&gt;HtmlUnit&lt;/a&gt; (JSFUnit does this for you).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Lack of an app framework&lt;/strong&gt;&lt;br/&gt;
Create common components: login panel, CRUD components, etc. If you don&apos;t have an app framework, build one over time. 
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br/&gt;
This was an interesting talk by Ed. The dynamics of the room where a bit interesting. Jazoon is held in a movie theater, much like Devoxx. However, it appears there&apos;s a spotlight on the speaker that makes it very difficult to see the audience. I don&apos;t remember having this problem at Devoxx. Ed asked the audience quite a few questions, but it seemed he had a lot of difficulty in seeing if folks raised their hands. This made for some periods of awkward silence.
&lt;/p&gt;
&lt;p&gt;
Personally, I was hoping to learn some new whizbang tips about JSF that I was not aware of. Unfortunately, I didn&apos;t learn anything new and wasn&apos;t that impressed with the Groovy demo. 
&lt;/p&gt;
&lt;p&gt;
I think Ed&apos;s tips about things outside of JSF were good, especially buying developers good hardware. I&apos;ve seen many companies, including my &lt;a href=&quot;http://www.overstock.com&quot;&gt;current client&lt;/a&gt;, skimp on developer hardware and cause developer frustration because of it. I think it&apos;s great when companies provide developers top-of-the-line hardware and eliminate frustration over CPU and memory resources. LinkedIn and Time Warner Cable both provide their developers with Mac Pros and MacBook Pros as well as huge monitors. IMO, this is one of the best benefits you can provide your engineers.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/java_web_application_security_part1</id>
        <title type="html">Java Web Application Security - Part II: Spring Security Login Demo</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/java_web_application_security_part1"/>
        <published>2011-05-13T09:20:51-06:00</published>
        <updated>2015-07-07T01:36:15-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="presentation" scheme="http://roller.apache.org/ns/tags/" />
        <category term="springsecurity" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="security" scheme="http://roller.apache.org/ns/tags/" />
        <category term="ujug" scheme="http://roller.apache.org/ns/tags/" />
        <category term="web" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Last week, I wrote &lt;a href=&quot;http://raibledesigns.com/rd/entry/java_web_application_security_part&quot;&gt;a tutorial on how to implement Security in Java EE 6&lt;/a&gt;. This week, I&apos;d like to show you how to implement the same features using &lt;a href=&quot;http://static.springsource.org/spring-security/site/&quot;&gt;Spring Security&lt;/a&gt;. Before I begin, I&apos;d like to explain my reason for writing this article.
&lt;/p&gt;
&lt;p&gt;Last month, I presented a talk on Java Web Application Security at the &lt;a href=&quot;http://ujug.org&quot;&gt;Utah JUG&lt;/a&gt; (UJUG). As part of that presentation, I did a number of demos about how to implement security with Java EE 6, Spring Security and Apache Shiro. I told the audience that I would post the presentation and was planning on recording screencasts of the various demos so the online version of the presentation would make more sense. 
&lt;/p&gt;
&lt;p&gt;
Today, I&apos;ve finished the second screencast showing how to implement security with Spring Security. Below is the presentation (with the screencast embedded on slide 16) as well as a step-by-step tutorial.
&lt;/p&gt;
&lt;p style=&quot;text-align: center&quot;&gt;
&lt;iframe src=&quot;//www.slideshare.net/slideshow/embed_code/key/o4wwswiZck6bKS&quot; width=&quot;510&quot; height=&quot;420&quot; frameborder=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; scrolling=&quot;no&quot; style=&quot;border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;&quot; allowfullscreen&gt; &lt;/iframe&gt;
&lt;br/&gt;
&lt;div style=&quot;font-size: .9em; text-align: left&quot;&gt;* You can also &lt;a href=&quot;http://www.youtube.com/watch?v=K5Hf-2bKYu8&quot;&gt;watch the screencast on YouTube&lt;/a&gt; or &lt;a href=&quot;http://static.raibledesigns.com/repository/presentations/Java_Web_Application_Security_UJUG2011.pdf&quot;&gt;download the presentation PDF&lt;/a&gt;.&lt;/div&gt;
&lt;/p&gt;

&lt;p id=&quot;springsecurity-login-tutorial&quot;&gt;&lt;strong&gt;Spring Security Login Tutorial&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#download-run&quot;&gt;Download and Run the Application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#secure-basic&quot;&gt;Implement Basic Authentication&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#ssl&quot;&gt;Force SSL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#form-authentication&quot;&gt;Implement Form-based Authentication&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#remember-me&quot;&gt;Add Remember Me&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#jdbc&quot;&gt;Store Users in a Database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#summary&quot;&gt;Summary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p id=&quot;download-run&quot;&gt;&lt;strong&gt;Download and Run the Application&lt;/strong&gt;&lt;br/&gt;

To begin, &lt;a href=&quot;http://static.raibledesigns.com/downloads/ajax-login-springsecurity-tutorial-1.0.zip&quot;&gt;download the application&lt;/a&gt; you&apos;ll be implementing security in. This app is a stripped-down version of the Ajax Login application I wrote for my article on &lt;a href=&quot;http://raibledesigns.com/rd/entry/implementing_ajax_authentication_using_jquery&quot;&gt;Implementing Ajax Authentication using jQuery, Spring Security and HTTPS&lt;/a&gt;. You&apos;ll need Java 6 and Maven installed to run the app. Run it using &lt;strong&gt;mvn jetty:run&lt;/strong&gt; and open &lt;a href=&quot;http://localhost:8080&quot;&gt;http://localhost:8080&lt;/a&gt; in your browser. You&apos;ll see it&apos;s a simple CRUD application for users and there&apos;s no login required to add or delete users.&lt;/p&gt;

&lt;p id=&quot;secure-basic&quot;&gt;&lt;strong&gt;Implement Basic Authentication&lt;/strong&gt;&lt;br/&gt;
  
The first step is to protect the list screen so people have to login to view users. To do this, you&apos;ll need to create a Spring context file that contains Spring Security&apos;s configuration. Create &lt;em&gt;src/main/webapp/WEB-INF/security.xml&lt;/em&gt; and populate it with the contents below:
&lt;/p&gt;
&lt;pre class=&quot;brush: xml; auto-links: false&quot;&gt;
  &amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
  &amp;lt;beans:beans xmlns=&quot;http://www.springframework.org/schema/security&quot;
               xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
               xmlns:beans=&quot;http://www.springframework.org/schema/beans&quot;
               xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd&quot;&amp;gt;

      &amp;lt;!-- New in Spring Security 3.1 --&amp;gt;
      &amp;lt;!-- &amp;lt;http pattern=&quot;/css/**&quot; security=&quot;none&quot;/&amp;gt; --&amp;gt;

      &amp;lt;http auto-config=&quot;true&quot;&amp;gt;
          &amp;lt;intercept-url pattern=&quot;/app/users&quot; access=&quot;ROLE_USER,ROLE_ADMIN&quot;/&amp;gt;
          &amp;lt;http-basic/&amp;gt;
      &amp;lt;/http&amp;gt;

      &amp;lt;authentication-manager alias=&quot;authenticationManager&quot;&amp;gt;
          &amp;lt;authentication-provider&amp;gt;
              &amp;lt;password-encoder hash=&quot;sha&quot;/&amp;gt;
              &amp;lt;user-service&amp;gt;
                  &amp;lt;user name=&quot;user&quot; password=&quot;12dea96fec20593566ab75692c9949596833adc9&quot; authorities=&quot;ROLE_USER&quot;/&amp;gt;
                  &amp;lt;user name=&quot;admin&quot; password=&quot;d033e22ae348aeb5660fc2140aec35850c4da997&quot; authorities=&quot;ROLE_ADMIN&quot;/&amp;gt;
              &amp;lt;/user-service&amp;gt;
          &amp;lt;/authentication-provider&amp;gt;
      &amp;lt;/authentication-manager&amp;gt;

      &amp;lt;!-- Override userSecurityAdvice bean in appfuse-service to allow any role to update a user. --&amp;gt;
      &amp;lt;beans:bean id=&quot;userSecurityAdvice&quot; class=&quot;org.appfuse.examples.webapp.security.UserSecurityAdvice&quot;/&amp;gt;
  &amp;lt;/beans:beans&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
The last bean, userSecurityAdvice, is an aspect that&apos;s needed to override some behavior in &lt;a href=&quot;http://appfuse.org&quot;&gt;AppFuse&lt;/a&gt;. You won&apos;t need this normally when implementing Spring Security. 
&lt;/p&gt;
&lt;p&gt;Next, open &lt;em&gt;src/main/webapp/WEB-INF/web.xml&lt;/em&gt; and add Spring&apos;s DelegatingFilterProxy:&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;filter&amp;gt;
    &amp;lt;filter-name&amp;gt;securityFilter&amp;lt;/filter-name&amp;gt;
    &amp;lt;filter-class&amp;gt;org.springframework.web.filter.DelegatingFilterProxy&amp;lt;/filter-class&amp;gt;
    &amp;lt;init-param&amp;gt;
        &amp;lt;param-name&amp;gt;targetBeanName&amp;lt;/param-name&amp;gt;
        &amp;lt;param-value&amp;gt;springSecurityFilterChain&amp;lt;/param-value&amp;gt;
    &amp;lt;/init-param&amp;gt;
&amp;lt;/filter&amp;gt;
&lt;/pre&gt;
&lt;p&gt;And add its filter-mapping just after the rewriteFilter in the filter-mappings section (order is important!):
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;filter-mapping&amp;gt;
    &amp;lt;filter-name&amp;gt;rewriteFilter&amp;lt;/filter-name&amp;gt;
    &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;
&amp;lt;/filter-mapping&amp;gt;
&amp;lt;filter-mapping&amp;gt;
    &amp;lt;filter-name&amp;gt;securityFilter&amp;lt;/filter-name&amp;gt;
    &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;
    &amp;lt;dispatcher&amp;gt;REQUEST&amp;lt;/dispatcher&amp;gt;
    &amp;lt;dispatcher&amp;gt;FORWARD&amp;lt;/dispatcher&amp;gt;
    &amp;lt;dispatcher&amp;gt;INCLUDE&amp;lt;/dispatcher&amp;gt;
&amp;lt;/filter-mapping&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
You don&apos;t need to add any dependencies in your pom.xml is because this project depends on AppFuse, which already contains these dependencies.
&lt;/p&gt;
&lt;p&gt;
At this point, if you restart Jetty (Ctrl+C and jetty:run again), you should be prompted to login when you click on the &quot;Users&quot; tab. Enter admin/admin to login. Spring Security is a bit easier to configure than Java EE 6 out-of-the-box, mostly because it doesn&apos;t require you to configure your container.
&lt;/p&gt;
&lt;p&gt;After logging in, you can try to logout by clicking the &quot;Logout&quot; link in the top-right corner. This calls a LogoutController with the following code that logs the user out.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
public void logout(HttpServletResponse response) throws ServletException, IOException {
    request.getSession().invalidate();
    response.sendRedirect(request.getContextPath()); 
}
&lt;/pre&gt; 
&lt;p class=&quot;quote&quot; style=&quot;font-style: italic; color: #666&quot;&gt;NOTE: Spring Security has a way to configure &quot;logout&quot; to match a URL and get rid of a class like LogoutController. Since it was already in the project, I don&apos;t cover that in this tutorial.&lt;/p&gt;
&lt;p&gt;You&apos;ll notice that clicking this link doesn&apos;t log you out, even though the session is invalidated. The only way to logout with basic authentication is to close the browser. In order to get the ability to logout, as well as to have more control over the look-and-feel of the login, you can implement form-based authentication.
  Before you implement form-based authentication, I&apos;d like to show you how easy it is to force SSL with Spring Security.
&lt;/p&gt;
&lt;p id=&quot;ssl&quot;&gt;&lt;strong&gt;Force SSL&lt;/strong&gt;&lt;br/&gt;
Spring Security allows you to switch between secure (https) and non-secure (http) protocols using a simple &lt;em&gt;requires-channel&lt;/em&gt; attribute on the &amp;lt;intercept-url&amp;gt; element. Possible values are &quot;http&quot;, &quot;https&quot; and &quot;any&quot;. Add &lt;em&gt;requires-channel=&quot;https&quot;&lt;/em&gt; to your security.xml file:
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;intercept-url pattern=&quot;/app/users&quot; access=&quot;ROLE_USER,ROLE_ADMIN&quot; requires-channel=&quot;https&quot;/&amp;gt;
&lt;/pre&gt;
&lt;p&gt;In order for this to work, you have to configure Jetty to listen on an SSL port. Add the following just after the jetty-maven-plugin&apos;s &amp;lt;/webAppConfig&amp;gt; element in your pom.xml:
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;connectors&amp;gt;
    &amp;lt;connector implementation=&quot;org.eclipse.jetty.server.nio.SelectChannelConnector&quot;&amp;gt;
        &amp;lt;forwarded&amp;gt;true&amp;lt;/forwarded&amp;gt;
        &amp;lt;port&amp;gt;8080&amp;lt;/port&amp;gt;
    &amp;lt;/connector&amp;gt;
    &amp;lt;connector implementation=&quot;org.eclipse.jetty.server.ssl.SslSelectChannelConnector&quot;&amp;gt;
        &amp;lt;forwarded&amp;gt;true&amp;lt;/forwarded&amp;gt;
        &amp;lt;port&amp;gt;8443&amp;lt;/port&amp;gt;
        &amp;lt;maxIdleTime&amp;gt;60000&amp;lt;/maxIdleTime&amp;gt;
        &amp;lt;keystore&amp;gt;${project.build.directory}/ssl.keystore&amp;lt;/keystore&amp;gt;
        &amp;lt;password&amp;gt;appfuse&amp;lt;/password&amp;gt;
        &amp;lt;keyPassword&amp;gt;appfuse&amp;lt;/keyPassword&amp;gt;
    &amp;lt;/connector&amp;gt;
&amp;lt;/connectors&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The keystore must be generated for Jetty to start successfully, so add the keytool-maven-plugin just above the jetty-maven-plugin in pom.xml.
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;plugin&amp;gt;
    &amp;lt;groupId&amp;gt;org.codehaus.mojo&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;keytool-maven-plugin&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt;
    &amp;lt;executions&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;phase&amp;gt;generate-resources&amp;lt;/phase&amp;gt;
            &amp;lt;id&amp;gt;clean&amp;lt;/id&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;clean&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
        &amp;lt;/execution&amp;gt;
        &amp;lt;execution&amp;gt;
            &amp;lt;phase&amp;gt;generate-resources&amp;lt;/phase&amp;gt;
            &amp;lt;id&amp;gt;genkey&amp;lt;/id&amp;gt;
            &amp;lt;goals&amp;gt;
                &amp;lt;goal&amp;gt;genkey&amp;lt;/goal&amp;gt;
            &amp;lt;/goals&amp;gt;
        &amp;lt;/execution&amp;gt;
    &amp;lt;/executions&amp;gt;
    &amp;lt;configuration&amp;gt;
        &amp;lt;keystore&amp;gt;${project.build.directory}/ssl.keystore&amp;lt;/keystore&amp;gt;
        &amp;lt;dname&amp;gt;cn=localhost&amp;lt;/dname&amp;gt;
        &amp;lt;keypass&amp;gt;appfuse&amp;lt;/keypass&amp;gt;
        &amp;lt;storepass&amp;gt;appfuse&amp;lt;/storepass&amp;gt;
        &amp;lt;alias&amp;gt;appfuse&amp;lt;/alias&amp;gt;
        &amp;lt;keyalg&amp;gt;RSA&amp;lt;/keyalg&amp;gt;
    &amp;lt;/configuration&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Now if you restart Jetty, go to &lt;a href=&quot;http://localhost:8080&quot;&gt;http://localhost:8080&lt;/a&gt; and click on the &quot;Users&quot; tab, you&apos;ll be prompted to accept the Untrusted Certificate and then redirected to https://localhost:8443/users after logging in. This is an 
  improvement on Java EE&apos;s user-data-constraint for two reasons:
  &lt;/p&gt;
  &lt;ul&gt;
    &lt;li&gt;You can switch between http and https protocols. With Java EE, you can only force https. You have to write a custom filter to switch back to http.&lt;/li&gt;
    &lt;li&gt;Redirecting to https actually works. With Java EE (on Jetty at least), a 403 is returned instead of redirecting the request.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;Now let&apos;s look at how to have more control over the look-and-feel of the login screen, as well as how to make logout work with form-based authentication.&lt;/p&gt;
&lt;p id=&quot;form-authentication&quot;&gt;&lt;strong&gt;Implement Form-based Authentication&lt;/strong&gt;&lt;br/&gt;
To change from basic to form-based authentication, you simply have to add a &amp;lt;form-login&amp;gt; element in security.xml&apos;s &amp;lt;http&amp;gt; element:
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;http auto-config=&quot;true&quot;&amp;gt;
    &amp;lt;intercept-url pattern=&quot;/app/users&quot; access=&quot;ROLE_USER,ROLE_ADMIN&quot; requires-channel=&quot;https&quot;/&amp;gt;
    &amp;lt;form-login login-page=&quot;/login&quot; authentication-failure-url=&quot;/login?error=true&quot;
                login-processing-url=&quot;/j_security_check&quot;/&amp;gt;
    &amp;lt;http-basic/&amp;gt;
&amp;lt;/http&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
  You can leave the &amp;lt;http-basic&amp;gt; element since Spring Security is smart enough to serve up the form for browsers and use Basic Authentication for clients such as web services.
  
  The login.jsp page (that /login forwards to) already exists in the project, in the &lt;em&gt;src/main/webapp&lt;/em&gt; directory. The forwarding is done by the &lt;a href=&quot;http://www.tuckey.org/urlrewrite/&quot;&gt;UrlRewriteFilter&lt;/a&gt; with the following configuration in &lt;em&gt;src/main/webapp/WEB-INF/urlrewrite.xml&lt;/em&gt;. 
  
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;rule&amp;gt;
    &amp;lt;from&amp;gt;/login&amp;lt;/from&amp;gt;
    &amp;lt;to&amp;gt;/login.jsp&amp;lt;/to&amp;gt;
&amp;lt;/rule&amp;gt;
&lt;/pre&gt;  
&lt;p&gt;
  This JSP has 3 important elements: 1) a form that submits to &quot;/j_security_check&quot;, 2) an input element named &quot;j_username&quot; and 3) an input element named &quot;j_password&quot;. If you restart Jetty, you&apos;ll now be prompted to login with this JSP instead of the basic authentication dialog.
&lt;/p&gt;
&lt;p id=&quot;remember-me&quot;&gt;&lt;strong&gt;Add Remember Me&lt;/strong&gt;&lt;br/&gt;
Remember Me is a feature you see in many web applications today. It&apos;s usually a checkbox on the login form that allows you to auto-login the next time you visit a site. This feature doesn&apos;t exist in Java EE security, but it does exist in Spring Security. To enable it, add the following just below &amp;lt;form-login&amp;gt; in security.xml:
&lt;/p&gt;
&lt;pre class=&quot;brush: xml; toolbar: false&quot;&gt;
&amp;lt;remember-me user-service-ref=&quot;userDao&quot; key=&quot;e37f4b31-0c45-11dd-bd0b-0800200c9a66&quot;/&gt;
&lt;/pre&gt;
&lt;p&gt;Next, open &lt;em&gt;src/main/webapp/login.jsp&lt;/em&gt; and change the name of the &quot;remember me&quot; checkbox to be &lt;strong&gt;_spring_security_remember_me&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class=&quot;brush: xml; toolbar: false&quot;&gt;
&amp;lt;input type=&quot;checkbox&quot; name=&quot;_spring_security_remember_me&quot; id=&quot;rememberMe&quot;/&gt;
&lt;/pre&gt;
&lt;p&gt;After making these changes, you should be able to restart Jetty, go to &lt;a href=&quot;http://localhost:8080/users&quot;&gt;http://localhost:8080/users&lt;/a&gt;, enter admin/adminjdbc, check the Remember Me checkbox and login. Then close your browser, and repeat the process. This time, you won&apos;t be prompted to login. For more information on this feature, see &lt;a href=&quot;http://static.springsource.org/spring-security/site/docs/3.0.x/reference/remember-me.html&quot;&gt;Spring Security&apos;s Remember Me documentation&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
While storing usernames and passwords in a file is convenient for demos, it&apos;s not very real-world-ish. The next section shows you how to configure Spring Security to use a database for its user store.
&lt;/p&gt;
&lt;p id=&quot;jdbc&quot;&gt;&lt;strong&gt;Store Users in a Database&lt;/strong&gt;&lt;br/&gt;
To store your users in a database instead of file, you&apos;ll need to add a &lt;em&gt;user-service-ref&lt;/em&gt; attribute to the &amp;lt;authentication-provider&amp;gt; element. You can also delete the &amp;lt;user-service&amp;gt; element. 
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;authentication-manager alias=&quot;authenticationManager&quot;&amp;gt;
    &amp;lt;authentication-provider user-service-ref=&quot;userDao&quot;&amp;gt;
        &amp;lt;password-encoder hash=&quot;sha&quot;/&amp;gt;
    &amp;lt;/authentication-provider&amp;gt;
&amp;lt;/authentication-manager&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The &quot;userDao&quot; bean is provided by AppFuse and its &lt;a href=&quot;http://static.appfuse.org/appfuse-data/appfuse-hibernate/xref/org/appfuse/dao/hibernate/UserDaoHibernate.html&quot;&gt;UserDaoHibernate.java&lt;/a&gt; class. This 
  class implements Spring Security&apos;s &lt;a href=&quot;http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/core/userdetails/UserDetailsService.html&quot;&gt;UserDetailsService&lt;/a&gt; interface.
  With Java EE, I had to configure a database connection and make sure the JDBC Driver was in my container&apos;s classpath. With Spring Security, you can talk to the database you already have configured in your application.
&lt;/p&gt;
&lt;div class=&quot;quote&quot; style=&quot;margin-left: 0; color: #666&quot;&gt;Of course, you could do this with Java EE too. One thing I neglected to show in my last tutorial was that 1) the app uses H2 and 2) I had to configure Java EE&apos;s database to be MySQL. This was because when I tried to access my H2 instance, I got an error about two threads trying to access it at once.
&lt;pre style=&quot;margin-top: 10px; margin-bottom: 0&quot;&gt;
2011-05-13 08:47:29.081:WARN::UserRealm Java EE Login could not connect to database; will try later
org.h2.jdbc.JdbcSQLException: Database may be already in use: &quot;Locked by another process&quot;. 
        Possible solutions: close all other connection(s); use the server mode [90020-154]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
	at org.h2.message.DbException.get(DbException.java:167)
	at org.h2.message.DbException.get(DbException.java:144)
	at org.h2.store.FileLock.getExceptionAlreadyInUse(FileLock.java:443)
	at org.h2.store.FileLock.lockFile(FileLock.java:338)
	at org.h2.store.FileLock.lock(FileLock.java:134)
	at org.h2.engine.Database.open(Database.java:535)
	at org.h2.engine.Database.openDatabase(Database.java:218)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;!-- Figure out exact error from H2 --&gt;
&lt;p&gt;The password for the &quot;admin&quot; user is configured in &lt;em&gt;src/test/resources/sample-data.xml&lt;/em&gt; and it&apos;s loaded by &lt;a href=&quot;http://dbunit.sourceforge.net/&quot;&gt;DbUnit&lt;/a&gt; before the application starts. 
  You can view your pom.xml and the dbunit-maven-plugin&apos;s configuration if you&apos;re interested in learning how this is done. The password is currently configured to &quot;adminjdbc&quot;, but you can reset it by
  &lt;a href=&quot;http://darrenfauth.com/generators/sha1&quot;&gt;generating a new password&lt;/a&gt; and modifying sample-data.xml.
&lt;/p&gt;
&lt;p&gt;Now if you restart Jetty, you should be able to login with admin/adminjdbc and view the list of users.
&lt;/p&gt;
&lt;p id=&quot;summary&quot;&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br/&gt;
In this tutorial, you learned how to implement authentication using Spring Security 3.0.5. In addition to the basic XML configuration, Spring Security also provides a AOP support and annotations you can use to secure methods. It also has many more features than standard Java EE Security. In my opinion, it&apos;s the most mature security framework we have in Java today. Currently, I think its &lt;a href=&quot;http://static.springsource.org/spring-security/site/docs/3.0.x/reference/springsecurity.html&quot;&gt;reference documentation&lt;/a&gt; is the best place to learn more.
&lt;/p&gt;
There are a few limitations I found with Spring Security:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;The authentication mechanism (file, database, ldap, etc.) is contained in the WAR&lt;/li&gt;
&lt;li&gt;Securing methods only works on Spring beans&lt;/li&gt;
&lt;li&gt;Remember Me doesn&apos;t work in my screencast (because I forgot to rename the checkbox in login.jsp)&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;&lt;p&gt;Of course, you can configure Spring to load its configuration from outside the WAR (e.g. a file or JNDI), but it&apos;s not as easy as including the configuration in your app.
  &lt;/p&gt;
  &lt;p&gt;In the next couple weeks, I&apos;ll post &lt;a href=&quot;http://raibledesigns.com/rd/entry/java_web_application_security_part2&quot;&gt;Part III&lt;/a&gt; of this series, where I&apos;ll show you how to implement this same set of features using Apache Shiro. In the meantime, please let me know if you have any questions.
&lt;/p&gt;
&lt;p style=&quot;border-top: 1px dotted silver; padding-top: 5px; color: #666&quot;&gt;
I created the screencasts with &lt;a href=&quot;http://www.techsmith.com/camtasia/&quot; style=&quot;color: #666&quot;&gt;Camtasia&lt;/a&gt;. For small screens, and embedding in the presentation, I created it at 50% and used the SmartFocus feature to zoom in and out during the demo. For larger screens, I published &lt;a href=&quot;http://www.youtube.com/watch?v=poc5dyImbig&quot; style=&quot;color: #666&quot;&gt;another screencast at 100%, in HD&lt;/a&gt;. If you have a preference for which screencast is better, I&apos;d love to hear about it.&lt;/p&gt;
&lt;p&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/adding_search_to_appfuse</id>
        <title type="html">Adding Search to AppFuse with Compass</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/adding_search_to_appfuse"/>
        <published>2011-03-15T17:11:12-06:00</published>
        <updated>2012-11-08T14:19:27-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="appfuse" scheme="http://roller.apache.org/ns/tags/" />
        <category term="search" scheme="http://roller.apache.org/ns/tags/" />
        <category term="compass" scheme="http://roller.apache.org/ns/tags/" />
        <category term="elasticsearch" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Over 5 years ago, I recognized that &lt;a href=&quot;http://appfuse.org&quot;&gt;AppFuse&lt;/a&gt; needed to have a search feature and &lt;a href=&quot;http://issues.appfuse.org/browse/APF-267&quot;&gt;entered an issue in JIRA&lt;/a&gt;. Almost 4 years later, a &lt;a href=&quot;http://code.google.com/p/pagingappfuse/wiki/CompassSearching&quot;&gt;Compass Tutorial&lt;/a&gt; was created and shortly after &lt;a href=&quot;http://www.kimchy.org/&quot;&gt;Shay Banon&lt;/a&gt; (Compass Founder), sent in a &lt;a href=&quot;http://issues.appfuse.org/browse/APF-267?focusedCommentId=12620&amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12620&quot;&gt;patch&lt;/a&gt;. From the message he sent me:&lt;/p&gt;
&lt;div class=&quot;quote&quot; style=&quot;margin-left: 0; margin-bottom: 10px&quot;&gt;
&lt;p&gt;A quick breakdown of enabling search:
&lt;/p&gt;
&lt;ol style=&quot;margin-bottom: 0&quot;&gt;
&lt;li&gt;Added Searchable annotations to the User and Address.&lt;/li&gt;
&lt;li&gt;Defined Compass bean, automatically scanning the model package for mapped searchable classes. It also automatically integrates with Spring transaction manager, and stores the index on the file system ([work dir]/target/test-index).&lt;/li&gt;
&lt;li&gt;Defined CompassTemplate (similar in concept to HibernateTemplate).&lt;/li&gt;
&lt;li&gt;Defined CompassSearchHelper. Really helps to perform search since it does pagination and so on.&lt;/li&gt;
&lt;li&gt;Defined CompassGps, basically it allows for index operation allowing to completely reindex the data from the database. JPA and Hiberante also automatically mirror changes done through their API to the index. iBatis uses AOP. &lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;Fast forward 2 years and I finally found the time/desire to put a UI on the backend Compass implementation that Shay provided. Yes, I realize that &lt;a href=&quot;http://www.kimchy.org/the_future_of_compass/&quot;&gt;Compass is being replaced by ElasticSearch&lt;/a&gt;. I may change to use ElasticSearch in the future; now that the search feature exists, I hope to see it evolve and improve.
&lt;/p&gt;
&lt;p&gt;Since Shay&apos;s patch integrated the necessary Spring beans for indexing and searching, the only thing I had to do was to implement the UI. Rather than having an &quot;all objects&quot; results page, I elected to implement it so you could search on an entity&apos;s list screen. I started with Spring MVC and added a search() method to the UserController:
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleRequest(@RequestParam(required = false, value = &quot;q&quot;) String query) throws Exception {
    if (query != null &amp;&amp; !&quot;&quot;.equals(query.trim())) {
        return new ModelAndView(&quot;admin/userList&quot;, Constants.USER_LIST, search(query));
    } else {
        return new ModelAndView(&quot;admin/userList&quot;, Constants.USER_LIST, mgr.getUsers());
    }
}

public List&amp;lt;User&amp;gt; search(String query) {
    List&amp;lt;User&amp;gt; results = new ArrayList&amp;lt;User&amp;gt;();
    CompassDetachedHits hits = compassTemplate.findWithDetach(query);
    log.debug(&quot;No. of results for &apos;&quot; + query + &quot;&apos;: &quot; + hits.length());
    for (int i = 0; i &amp;lt; hits.length(); i++) {
        results.add((User) hits.data(i));
    }
    return results;
}
&lt;/pre&gt;
&lt;p&gt;At first, I used &lt;em&gt;compassTemplate.find()&lt;/em&gt;, but got an error because I wasn&apos;t using an OpenSessionInViewFilter. I decided to go with findWithDetach() and added the following search form to the top of the userList.jsp page:&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
&amp;lt;div id=&quot;search&quot;&amp;gt;
&amp;lt;form method=&quot;get&quot; action=&quot;${ctx}/admin/users&quot; id=&quot;searchForm&quot;&amp;gt;
    &amp;lt;input type=&quot;text&quot; size=&quot;20&quot; name=&quot;q&quot; id=&quot;query&quot; value=&quot;${param.q}&quot;
           placeholder=&quot;Enter search terms&quot;/&amp;gt;
    &amp;lt;input type=&quot;submit&quot; value=&quot;&amp;lt;fmt:message key=&quot;button.search&quot;/&amp;gt;&quot;/&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p style=&quot;color: #666; margin-left: 20px&quot;&gt;&lt;em&gt;NOTE: I tried using HTML5&apos;s &amp;lt;input type=&quot;search&quot;&amp;gt;, but found &lt;a href=&quot;http://lists.canoo.com/pipermail/webtest/2011q1/013697.html&quot; style=&quot;color: #666&quot;&gt;Canoo WebTest doesn&apos;t support it.&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Next, I wrote a unit test to verify everything worked as expected. I found I had to call compassGps.index() as part of my test to make sure my index was created and up-to-date.&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
public class UserControllerTest extends BaseControllerTestCase {
    @Autowired
    private CompassGps compassGps;
    @Autowired
    private UserController controller;

    public void testSearch() throws Exception {
        compassGps.index();
        ModelAndView mav = controller.handleRequest(&quot;admin&quot;);
        Map m = mav.getModel();
        List results = (List) m.get(Constants.USER_LIST);
        assertNotNull(results);
        assertTrue(results.size() &amp;gt;= 1);
        assertEquals(&quot;admin/userList&quot;, mav.getViewName());
    }
}
&lt;/pre&gt;
&lt;p&gt;After getting this working, I started integrating similar code into AppFuse&apos;s other web framework modules (Struts, JSF and Tapestry). When I was finished, they all looked pretty similar from a UI perspective.
&lt;/p&gt;
&lt;p&gt;&lt;strong style=&quot;color: #666&quot;&gt;Struts:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;div id=&quot;search&quot;&amp;gt;
&amp;lt;form method=&quot;get&quot; action=&quot;${ctx}/admin/users&quot; id=&quot;searchForm&quot;&amp;gt;
    &amp;lt;input type=&quot;text&quot; size=&quot;20&quot; name=&quot;q&quot; id=&quot;query&quot; value=&quot;${param.q}&quot;
           placeholder=&quot;Enter search terms...&quot;/&amp;gt;
    &amp;lt;input type=&quot;submit&quot; value=&quot;&amp;lt;fmt:message key=&quot;button.search&quot;/&amp;gt;&quot;/&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong style=&quot;color: #666&quot;&gt;JSF:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;div id=&quot;search&quot;&amp;gt;
&amp;lt;h:form id=&quot;searchForm&quot;&amp;gt;
    &amp;lt;h:inputText id=&quot;q&quot; name=&quot;q&quot; size=&quot;20&quot; value=&quot;#{userList.query}&quot;/&amp;gt;
    &amp;lt;h:commandButton value=&quot;#{text&amp;#91;&apos;button.search&apos;&amp;#93;}&quot; action=&quot;#{userList.search}&quot;/&amp;gt;
&amp;lt;/h:form&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong style=&quot;color: #666&quot;&gt;Tapestry:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;div id=&quot;search&quot;&amp;gt;
&amp;lt;t:form method=&quot;get&quot; t:id=&quot;searchForm&quot;&amp;gt;
    &amp;lt;t:textfield size=&quot;20&quot; name=&quot;q&quot; t:id=&quot;q&quot;/&amp;gt;
    &amp;lt;input t:type=&quot;submit&quot; value=&quot;${message:button.search}&quot;/&amp;gt;
&amp;lt;/t:form&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p&gt;One frustrating thing I found was that &lt;a href=&quot;http://tapestry.1045711.n5.nabble.com/Is-there-any-way-to-render-the-quot-get-quot-method-of-form-td2643651.html&quot;&gt;Tapestry doesn&apos;t support method=&quot;get&quot;&lt;/a&gt; and AFAICT, neither does JSF 2. With JSF, I had to make my UserList bean session-scoped or the query parameter would be null when it listed the results. Tapestry took me the longest to implement, mainly because I had issues figuring out how it&apos;s easy-to-understand-once-you-know onSubmit() handlers worked and I had the proper @Property and @Persist annotations on my &quot;q&quot; property. &lt;a href=&quot;http://www.crazymcphee.net/x/2009/08/26/tapestry-5-web-framework/&quot;&gt;This tutorial&lt;/a&gt; was the greatest help for me. Of course, now that it&apos;s all finished, the code looks pretty intuitive.&lt;/p&gt;
&lt;p&gt;Feeling proud of myself for getting this working, I started integrating this feature into AppFuse&apos;s code generation and found I had to add quite a bit of code to the generated list pages/controllers. 
&lt;/p&gt;
&lt;p&gt;
So I went on a bike ride...&lt;/p&gt;
&lt;p&gt;While riding, I thought of a much better solution and added the following search method to AppFuse&apos;s GenericManagerImpl.java. In the code I added to pages/controllers previously, I&apos;d already refactored to use CompassSearchHelper and I continued to do so in the service layer implementation.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@Autowired
private CompassSearchHelper compass;

public List&amp;lt;T&amp;gt; search(String q, Class clazz) {
    if (q == null || &quot;&quot;.equals(q.trim())) {
        return getAll();
    }

    List&amp;lt;T&amp;gt; results = new ArrayList&amp;lt;T&amp;gt;();

    CompassSearchCommand command = new CompassSearchCommand(q);
    CompassSearchResults compassResults = compass.search(command);
    CompassHit&amp;#91;&amp;#93; hits = compassResults.getHits();

    if (log.isDebugEnabled() &amp;amp;&amp;amp; clazz != null) {
        log.debug(&quot;Filtering by type: &quot; + clazz.getName());
    }

    for (CompassHit hit : hits) {
        if (clazz != null) {
            if (hit.data().getClass().equals(clazz)) {
                results.add((T) hit.data());
            }
        } else {
            results.add((T) hit.data());
        }
    }

    if (log.isDebugEnabled()) {
        log.debug(&quot;Number of results for &apos;&quot; + q + &quot;&apos;: &quot; + results.size());
    }

    return results;
}
&lt;/pre&gt;
&lt;p&gt;This greatly simplified my page/controller logic because now all I had to do was call manager.search(query, User.class) instead of doing the Compass login in the controller. Of course, it&apos;d be great if I didn&apos;t have to pass in the Class to filter by object, but that&apos;s the &lt;a href=&quot;http://javanotepad.blogspot.com/2007/09/instanceof-doesnt-work-with-generics.html&quot;&gt;nature of generics and type erasure&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Other things I learned along the way:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To index on startup, I added compassGps.index() to the StartupListener.&lt;/a&gt;.
&lt;li&gt;In unit tests that leveraged transactions around methods, I had to call compassGps.index() before any transactions started.&lt;/li&gt;
&lt;li&gt;To scan multiple packages for searchable classes, I had to add a &lt;a href=&quot;http://forum.compass-project.org/thread.jspa?threadID=216821&amp;tstart=0&quot;&gt;LocalCompassBeanPostProcessor&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But more than anything, I was reminded it always helps to take a bike ride when you don&apos;t like the design of your code. &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
This feature and many more will be in AppFuse 2.1, which I hope to &lt;a href=&quot;http://issues.appfuse.org/secure/IssueNavigator.jspa?mode=hide&amp;requestId=10160&quot; title=&quot;Open Issues for 2.1&quot;&gt;finish by the end of the month&lt;/a&gt;. In the meantime, please feel free to try out the &lt;a href=&quot;http://appfuse.org/display/APF/AppFuse+QuickStart&quot;&gt;latest snapshot&lt;/a&gt;.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/what_s_new_in_spring</id>
        <title type="html">What&apos;s New in Spring 3.0</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/what_s_new_in_spring"/>
        <published>2010-03-19T11:46:25-06:00</published>
        <updated>2010-03-19T17:53:19-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="vmware" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javaconfig" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="tomcat" scheme="http://roller.apache.org/ns/tags/" />
        <category term="roo" scheme="http://roller.apache.org/ns/tags/" />
        <category term="springsource" scheme="http://roller.apache.org/ns/tags/" />
        <category term="twitter" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">This morning, I attended Rod Johnson&apos;s &lt;a href=&quot;http://javasymposium.techtarget.com/html/sessions.html#RJohnsonKeynote&quot;&gt;What&apos;s New in Spring 3.0&lt;/a&gt; keynote at TSSJS. Rod ditched his slides for the talk and mentioned that this might be risky. Especially since he was pretty jetlagged (flew in from Paris at 11pm last night). Below are my notes from his talk.
&lt;/p&gt;
&lt;p style=&quot;border-top: 1px dotted silver; padding-top: 10px&quot;&gt;
The most important thing for the future of Java is productivity and cloud computing. The focus at SpringSource is heavily on productivity and not just on improving the Spring codebase. If you look at the comparisons out there between Rails and Spring, it&apos;s not an apples-to-apples comparison. The philosophy with Spring has always been the developer is always right. However, if you look at something like Rails, you&apos;ll see it&apos;s far more prescriptive. That layer of opinionated frameworks is important in that it improves your productivity greatly.
&lt;/p&gt;
&lt;p&gt;
SpringSource is putting a lot of emphasis on improving developer productivity with two opinionated frameworks: Grails and Spring Roo. To show how productive developers can be, Rod started to build a web app with Spring Roo. As part of this demo, he mentioned we&apos;d see many of the new features of Spring 3: RestTemplate, @Value and Spring EL. 
&lt;/p&gt;
&lt;p&gt;
Rod used STS to write the application and built a Twitter client. After creating a new project using File -&gt; New Roo Project, a Roo Shell tab shows up at the bottom. Typing &quot;hint&quot; tells you what you should do write away. The initial message is &quot;Roo requires the installation of a JPA provider and associated database.&quot; The initial command is &quot;persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY&quot;. After running this, a bunch of log messages are shown on the console, most of them indicating that pom.xml has been modified.
&lt;/p&gt;
&lt;p&gt;
The first file that Rod shows is src/main/resources/META-INF/spring/applicationContext.xml. It&apos;s the only XML file you&apos;ll need in your application and includes a PropertyPlaceHolderConfigurer, a context:component-scan for finding annotations and a transaction manager.
&lt;/p&gt;
&lt;p&gt;
After typing &quot;hint&quot; again, Roo indicates that Rod should create entities. He does this by running &quot;ent --class ~.domain.Term --testAutomatically&quot;.  A Term class (with a bunch of annotations) is created, as well as a number of *.aj files and an integration test. Most of the files don&apos;t have anything in them but annotations. The integration test uses @RooIntegrationTest(entity=Term.class) on its class to fire up a Spring container in the test and do dependency injection (if necessary). From there, Rod demonstrated that he could easily modify the test to verify the database existed.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
private SimpleJdbcTemplate jt;

@Autowired
public void init(DataSource ds) {
    this.jt = new SimpleJdbcTemplate(ds);
}

@Test 
public void testDb() {
    jt.queryForInt(&quot;SELECT COUNT(0) FROM TERM&quot;);
}
&lt;/pre&gt;
&lt;p&gt;
Interestingly, after running the test, you could see a whole bunch of tests being run, not just the one that was in the class itself. From there, he modified the Term class to add two new properties: name and searchTerms. He also used JSR 303&apos;s @NotNull annotation to make the fields required.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@Entity
@RooJavaBean
@RooToString
@RooEntity
public class Term {

    @NotNull
    private String name;

    @NotNull
    private String searchTerms;
}
&lt;/pre&gt;
&lt;p&gt;
Next, Rod added a new test and showed that the setters for these properties were automatically created and he never had to write getters and setters. This is done by aspects that are generated beside your Java files. Roo is smart enough that if you write toString() methods in your Java code, it will delete the aspect that normally generates the toString() method.
&lt;/p&gt;
&lt;p&gt;
To add fields to an entity from the command lie, you can run commands like &quot;field string --fieldName text --notNull&quot; and &quot;field number --type java.lang.Long --fieldName twitterId --notNull&quot;. The Roo Shell is also capable of establishing relationships between entities. 
&lt;/p&gt;
&lt;p&gt;
After successfully modifying his Entities, Rod started creating code to talk to Twitter&apos;s API. He used RestTemplate to do this and spent a good 5 minutes trying to get Eclipse to import the class properly. The best part of this demo was watching him do what most developers do: searching Google for RestTemplate to get the package name to import.
&lt;/p&gt;
&lt;p&gt;
After awkward silence and some fumbling, he opened an existing project (that had the dependencies properly configured) and used Java Config to configure beans for the project. This was done with a @Configuration annotation on the class, @Value annotations on properties (that read from a properties file) and @Bean annotations for the beans to expose. The first time Rod tried to run the test it failed because a twitter.properties file didn&apos;t exist.  After creating it, he successfully ran the test and successfully searched Twitter&apos;s API. 
&lt;/p&gt;
&lt;p&gt;
The nice thing about @Configuration is the classes are automatically picked up and you don&apos;t need to configure any XML to recognize them. Also, in your Java classes, you don&apos;t have to use @Autowired to get @Bean references injected. 
&lt;/p&gt;
&lt;p&gt;
After this, Rod attempted to show a web interface of the application. He started the built-in SpringSource tc Server and proceeded to show us Tomcat&apos;s 404 page. Unfortunately, Tomcat seemed to startup OK (no errors in the logs), but obviously something didn&apos;t work well. For the next few silent moments, we watched him try to delete web.xml from Eclipse. Unfortunately, this didn&apos;t work and we weren&apos;t able to see the scaffolding the entities that Rod created. 
&lt;/p&gt;
&lt;p&gt;
At this point, Rod opened a completed version of the app and was able to show it to us in a browser. You could hear the murmur of the crowd as everyone realized he was about to show the the &lt;a href=&quot;http://twitter.com/search?q=%23tssjs&quot;&gt;Twitter search results for #tssjs&lt;/a&gt;. Most of the tweets displayed were from folks commenting about how some things didn&apos;t work in the demo. 
&lt;/p&gt;
&lt;p&gt;
In summary, there&apos;s some really cool things in Spring 3: @Configuration, @Value, task scheduling with @Scheduled and one-way methods with @Async. 
&lt;/p&gt;
&lt;p&gt;
Final points of SpringSource and VMWare: they&apos;re committed to Java and middleware. Their big focus is providing an integrated experience from productivity to cloud. There&apos;s other languages that are further along than Java and SpringSource is trying to fix that. One thing they&apos;re working on is a private Java cloud that companies can use and leverage as a VMWare appliance.
&lt;/p&gt;
&lt;p style=&quot;border-top: 1px dotted silver; padding-top: 10px&quot;&gt;
I think there&apos;s a lot of great things in Spring 3 and most users of Roo seem to be happy with it. It&apos;s unfortunate that the Demo Gods frowned upon Rod, but it was cool to see him do the &quot;no presentation&quot; approach. 
&lt;/p&gt;
&lt;p&gt;

</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/highly_interactive_software_with_java</id>
        <title type="html">Highly Interactive Software with Java and Flex</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/highly_interactive_software_with_java"/>
        <published>2010-03-18T12:29:26-06:00</published>
        <updated>2010-03-18T18:32:00-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="mxml" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <category term="ria" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jamesward" scheme="http://roller.apache.org/ns/tags/" />
        <category term="adobe" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="soap" scheme="http://roller.apache.org/ns/tags/" />
        <category term="flex" scheme="http://roller.apache.org/ns/tags/" />
        <category term="blazeds" scheme="http://roller.apache.org/ns/tags/" />
        <category term="actionscript" scheme="http://roller.apache.org/ns/tags/" />
        <category term="amf" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">This morning at TSSJS, I attended &lt;a href=&quot;http://jamesward.com&quot;&gt;James Ward&apos;s&lt;/a&gt; talk about &lt;a href=&quot;http://javasymposium.techtarget.com/html/theclientside.html%23JWardFlex&quot;&gt;Highly Interactive Software with Java and Flex&lt;/a&gt;. Below are my notes from his talk.
&lt;/p&gt;
&lt;p style=&quot;border-top: 1px dotted silver; padding-top: 10px&quot;&gt;
Application have moved from mainframes (hard to deploy, limited clients) to client/server (hard to deploy, full client capabilities) to web applications (easy to deploy, limited clients) to rich internet applications (easy to deploy, full client capabilities). 
&lt;/p&gt;
&lt;p&gt;
Shortly after showing a diagram of how applications have changed, James showed a demo of a sample Flex app for an automobile insurance company. It was very visually appealing, kinda like using an iPhone app. It was a multi-form application that slides right-to-left as you progress through the wizard. It also allowed you to interact with a picture of your car (to indicate where the damage happened) and a map (to indicate how the accident happened). Both of these interactive dialogs still performed data entry, they just did it in more of a visual way.
&lt;/p&gt;
&lt;p&gt;
Adobe&apos;s developer technology for building RIAs is Flex. There&apos;s two different languages in Flex: ActionScript and MXML. ActionScript was originally based on JavaScript, but now (in ActionScript 3) uses features from Java and C#. On top of ActionScript is MXML. It&apos;s a declarative language, but unlike JSP taglibs. All you can do with MXML is instantiate objects and set properties. It&apos;s merely a convenience language, but also allows tooling. The open source SDK compiler takes Flex files and compiles it into a *.swf file. This file can then be executed using the Flash Player (in browser) or Air (desktop).
&lt;/p&gt;
&lt;p&gt;
The reason Adobe developed two different runtimes was because they didn&apos;t want to bloat the Flash Player. Once the applications are running client-side, the application talks to the web server. Protocols that can be used for communication: SOAP, HTTP/S, AMF/S and RTMP/S. The web server can be composed of REST or SOAP Web Services, as well as BlazeDS or LC Data Services to talk directly to Java classes.
&lt;/p&gt;
&lt;p&gt;
To see all the possible Flex components, see &lt;a href=&quot;http://flex.org/tour&quot;&gt;Tour de Flex&lt;/a&gt;. It contains a number of components: core components, data access controls, AIR capabilities, cloud APIs, data visualization. The &lt;a href=&quot;http://www.adobe.com/devnet/flex/tourdeflex/web/%23sampleId=14050;illustIndex=0;docIndex=-1&quot;&gt;IBM ILOG Elixir real-time dashboard&lt;/a&gt; is particularly interesting, as is Doug McCune&apos;s &lt;a href=&quot;http://www.adobe.com/devnet/flex/tourdeflex/web/#sampleId=16300;illustIndex=0;docIndex=0&quot;&gt;Physics Form&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;Next James showed us some code. He used Flex Builder to create a new Flex project with BlazeDS. The backend for this application was a JSP page that talks to a database and displays the results in XML. In the main .mxml file, he used &amp;lt;s:HTTPService&gt; with a URL pointing to the URI of the JSP. Then he added an &amp;lt;mx:DataGrid&gt; and the data binding feature of Flex. To do this, he added dataProvider=&quot;{srv.lastResult.items.item}&quot; to the DataGrid tag, where &quot;srv&quot; is the id of the HTTPService. Then he added a Button with click=&quot;srv.send()&quot; and set the layout to VerticalLayout. This was a simple demo to show how to hook in a backend with XML. 
&lt;/p&gt;
&lt;p&gt;To show that Flex can interact with more than XML over HTTP, James wrote a SOAP service and changed &amp;lt;s:HTTPService&gt; to &amp;lt;s:WebService&gt; and changed the &quot;url&quot; attribute to &quot;wsdl&quot; (and adjusted the value as appropriate). Then rather than using {srv.lastResult.*}, he had to bind to a particular method and change it to {srv.getElements.lastResults}. The Button&apos;s click value also had to change to &quot;srv.getElements(0, 2000)&quot; (since the method takes 2 parameters). 
&lt;/p&gt;
&lt;p&gt;After doing coding in Flex Builder, James switched to his &lt;a href=&quot;http://www.jamesward.com/census&quot;&gt;Census&lt;/a&gt; to compare server-execution times. In the first example (Flash XML AS), most of the time was spent gzipping the 1MB XML file, but the transfer time is reduced because of this. The server execution time is around 800ms. Compare this to the Flex AMF3 example where the server execution time is 49ms. This is because the AMF (binary) protocol streamlines the data and doesn&apos;t include repeated metadata. 
&lt;/p&gt;
&lt;p&gt;
To integrate BlazeDS in your project, you add the dependencies and then map the MessageBrokerServlet in your web.xml. Then you use a services-config.xml to define the protocol and remoting-config.xml to define what Java classes to export as services. To use this in the Flex aplication, James changed &amp;lt;s:WebService&gt; to &amp;lt;s:RemoteObject&gt;. He changed the &quot;wsdl&quot; attribute to &quot;endpoint&quot; and added a &quot;destination&quot; attribute to specify the name of the aliased Java class to talk to. Next, James ran the demo and showed that he could change the number of rows from 2,000 to 20,000 and the load time was still much, much faster than the XML and SOAP versions.
&lt;/p&gt;
&lt;p&gt;
There&apos;s also a &lt;a href=&quot;http://www.springsource.org/spring-flex&quot;&gt;Spring BlazeDS Integration project&lt;/a&gt; that allows you to simply annotate beans to expose them as AMF services. 
&lt;/p&gt;
&lt;p&gt;
BlazeDS also includes a messaging service that you can use to create publishers and subscribers. The default channels in BlazeDS uses HTTP Streaming and HTTP Long Polling (comet), but it can be configurable (e.g. to use JMS). There&apos;s also an Adobe commercial product that keeps a connection open using NIO on the server and has a binary protocol. This is useful for folks that need more real-time data in their applications (e.g. trading floors). 
&lt;/p&gt;
&lt;p style=&quot;border-top: 1px dotted silver; padding-top: 10px&quot;&gt;
I thought this was a really good talk by James. It had some really cool visual demos and the demo was interesting in showing how easy it was to switch between different web services and protocols. This afternoon, I&apos;ll be duking it out with James at the &lt;a href=&quot;http://javasymposium.techtarget.com/html/theclientside.html#MRaibleSmack&quot;&gt;Flex vs. GWT Smackdown&lt;/a&gt;. If you have deficiencies of Flex you&apos;d like me to share during that talk, please let me know.
</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/what_s_happening_in_the</id>
        <title type="html">What&apos;s Happening in the Java World?</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/what_s_happening_in_the"/>
        <published>2010-03-17T10:28:31-06:00</published>
        <updated>2012-11-11T02:00:40-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="vegas" scheme="http://roller.apache.org/ns/tags/" />
        <category term="oracle" scheme="http://roller.apache.org/ns/tags/" />
        <category term="snorcle" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javaee" scheme="http://roller.apache.org/ns/tags/" />
        <category term="tssjs" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jamesgosling" scheme="http://roller.apache.org/ns/tags/" />
        <category term="sun" scheme="http://roller.apache.org/ns/tags/" />
        <category term="glassfish" scheme="http://roller.apache.org/ns/tags/" />
        <category term="netbeans" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javafx" scheme="http://roller.apache.org/ns/tags/" />
        <category term="javaee6" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">This morning at &lt;a href=&quot;http://javasymposium.techtarget.com/&quot;&gt;TheServerSide Java Symposium&lt;/a&gt; I attended &lt;a href=&quot;http://javasymposium.techtarget.com/html/speakers.html%23JGosling&quot;&gt;James Gosling&apos;s keynote&lt;/a&gt;. Below are my notes from his talk.&lt;/p&gt;
&lt;p&gt;
The unifying principle for Java is the Network - it ties everything together. Enterprise, Desktop, Web, Mobile, HPC, Media and Embedded. The most important thing in the Java world is the acquisition of Sun by Oracle. James is showing a slide of Duke in a fish tank with a &quot;Snorcle!&quot; title above it.
&lt;/p&gt;
&lt;p&gt;
Obligatory statistics for Java:

&lt;ul&gt;
&lt;li&gt;15 million JRE downloads/week (doesn&apos;t count tax season in Brazil)&lt;/li&gt;
&lt;li&gt;10 billion-ish Java enabled devices (more devices than people)&lt;/li&gt;
&lt;li&gt;1 billion-ish Java enabled desktops&lt;/li&gt;
&lt;li&gt;100 million-ish TV devices&lt;/li&gt;
&lt;li&gt;2.6 billion-ish mobile devices&lt;/li&gt;
&lt;li&gt;5.5 billion-ish smart cards&lt;/li&gt;
&lt;li&gt;6.5 million professional Java developers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Java has become &quot;Learn Once, Work Anywhere&quot;. Most college students worldwide have taken a Java course in school. James&apos; daughter is in college but isn&apos;t interested in Java, mostly because her dad&apos;s name is all over the textbooks.
&lt;/p&gt;
&lt;p&gt;
Java EE 6 was approved September 30, 2009. It was many years in the making; the result of large-scale community collaboration. It was built by hardware manufacturers, users, developers and academia. Because of all the politics involved, many engineers had to become diplomats. Most software engineers are from the wrong Myers-Brigg quadrant for this type of negotiation. Needless to say, the process was &lt;em&gt;interesting&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
New and Updated APIs in Java EE 6: Servlet 3.0, JAX-RS 1.1, Bean Validation 1.0, DI 1.0, CDI 1.0, Managed Beans 1.0, JASPIC 1.1, EJB 3.1, JPA 2.0 and many others. Also new is the &lt;strong&gt;Web Profile&lt;/strong&gt;. It&apos;s the first Java EE profile to be defined. It&apos;s a fully-functional, mid-size stack for modern web application development. It&apos;s complete, but not the kitchen sink. It&apos;s what most people use when building a modern web application in Java.
&lt;/p&gt;
&lt;p&gt;Java EE 6 adds dependency injection with DI (JSR-330) and CDI (JSR-299). @Resource is still around, but an @Inject annotation has been added for typesafe injection. It has automatic scope management (request, session, etc.) and is extensible via a BeanManager API.
&lt;/p&gt;
&lt;p&gt;
GlassFish is the world&apos;s most downloaded app server (1 million-ish downloads/month). GFv2 was the EE 5 reference implementation. GFv3 is the reference implementation for EE 6. But it&apos;s not just a reference implementation, it&apos;s a benchmark-winning mission-critical large-scale app server. The FCS was released on December 10, 2009. 
&lt;/p&gt;
&lt;p&gt;Goals of Java EE: ease of use, right-sizing and extensibility. Now Roberto Chinnici (EE 6 spec lead) and another guy are on stage showing a NetBeans and GlassFish demo. With Servlet 3.0, you don&apos;t need a web.xml file, you just need a WEB-INF directory. There&apos;s a new @WebServlet annotation that lets you specify a &quot;urlPattern&quot; value for the servlet-mapping. A new @EJB annotation allows you to easily inject EJBs into your servlet. Roberto wired in an EJB, hit Ctrl+S and refreshed his browser and it all worked immediately. In the background, NetBeans and GlassFish did the redeployment and initialized the EJB container in milliseconds. &lt;/p&gt;
&lt;p&gt;@ManagedBeans and @SessionScope and @Named are all part of CDI. When using @Named, the beans become available to JSTL and you can access them using ${beanName.property}. Interestingly, the CDI annotations are in difference packages: javax.annotation.ManagedBean and javax.enterprise.context.RequestScoped.
&lt;/p&gt;
&lt;p&gt;As &lt;a href=&quot;http://twitter.com/davidgeary/status/10627196026&quot;&gt;David Geary mentions&lt;/a&gt;, it&apos;s great to see the influence that Ruby on Rails has had on Java EE. 
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
Long demo of JEE6 in NetBeans. Spent quite a bit of time extolling the virtues of hot deploy. Thanks, RoR!
&lt;/p&gt;
&lt;p&gt;Now Roberto is showing us the admin console of GlassFish and how modular it is. He&apos;s installing a JMS module, but it&apos;s interesting to see that there&apos;s a Ruby Container installed by default. Apache Felix is the underlying OSGI implementation used by GlassFish. You can telnet into it and see the status of all the bundles installed. After installing the full-profile, Roberto shows that you can restart the server from the console. 
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Isn&apos;t the whole point of OSGI that you don&apos;t have to restart anything!?&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;The GlassFish management console is definitely impressive &lt;em&gt;and&lt;/em&gt; visually appealing. Apparently, it&apos;s extensible too, so you could easily write plugins to monitor your application and provide memory statistics.&lt;/p&gt;
&lt;p&gt;Changing topics, one of the things that nice about Java is its a two-level spec. The important thing in the Java world isn&apos;t the language, it&apos;s the virtual machine. The magic is in the VM! Scala, Ruby/Rails, Groovy/Grails, Python, PHP, JavaScript, JavaFX and many others. In the same breath of talking about Java.next languages, James mentioned JavaFX Script. It&apos;s a new declarative scripting language for GUIs. It&apos;s similar to Flash or Silverlight, but it&apos;s much better because it has the Java VM under it.
&lt;/p&gt;
&lt;p&gt;At the current rate that we&apos;re going with CPUs and cores, there&apos;s a good chance we&apos;ll have 5220 cores on our desktops by 2030. If you find the concurrency libraries scary, get over it. 
&lt;/p&gt;
&lt;p&gt;For the rest of talk, James talked about what he&apos;s hacking on these days. He&apos;s helping build an Audi TTS for the Pikes Peak Road Rally in Colorado. The goal is to figure out a way to keep the vehicle above 130 MPH for the whole race. Sounds like a pretty cool project to me.
&lt;/p&gt;
&lt;p&gt;I don&apos;t think there was a whole lot of new information covered in James&apos; talk, but I really do like Java EE 6&apos;s Web Profile. However, I think it&apos;s something most of the community has been using for many years with Tomcat + Spring + Hibernate. Now it&apos;s simply been standardized. If you happen to work at one of those companies that frowns on open source and smiles at standards, you&apos;ve finally caught up with the rest of us. &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/a_letter_to_the_appfuse</id>
        <title type="html">A Letter to the AppFuse Community</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/a_letter_to_the_appfuse"/>
        <published>2009-11-04T00:17:17-07:00</published>
        <updated>2009-11-04T07:32:42-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <category term="seam" scheme="http://roller.apache.org/ns/tags/" />
        <category term="rubyonrails" scheme="http://roller.apache.org/ns/tags/" />
        <category term="letter" scheme="http://roller.apache.org/ns/tags/" />
        <category term="springroo" scheme="http://roller.apache.org/ns/tags/" />
        <category term="appfuse" scheme="http://roller.apache.org/ns/tags/" />
        <category term="grails" scheme="http://roller.apache.org/ns/tags/" />
        <category term="play" scheme="http://roller.apache.org/ns/tags/" />
        <category term="community" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">The last &lt;a href=&quot;http://appfuse.org&quot;&gt;AppFuse&lt;/a&gt; release was way back in &lt;a href=&quot;http://raibledesigns.com/rd/entry/appfuse_2_0_2_released&quot;&gt;May 2008&lt;/a&gt;. Many folks have asked when the next release would be ever since. Often, I&apos;ve said &quot;sometimes this quarter&quot;, but obviously, that&apos;s never happened. For that, I apologize.
&lt;/p&gt;
&lt;p&gt;There are many reasons I haven&apos;t worked on AppFuse for the past 18 months, but it mostly comes down to the fact that I didn&apos;t make time for it. The good news is I&apos;m working on it again and &lt;em&gt;will&lt;/em&gt; have a release out sometime this month. Unfortunately, it probably won&apos;t be a 2.1 final release, but there&apos;s so many things that&apos;ve changed, I feel like a milestone release is a good idea. Here&apos;s a brief summary of changes so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Changed archetypes to include all source and tests for the &quot;webapp&quot; portion of the application. No more warpath plugin, merging wars and IDE issues. Using &quot;mvn jetty:run&quot; should work as expected.&lt;/li&gt;
&lt;li&gt;Moved from &lt;a href=&quot;http://raibledesigns.com/rd/entry/moving_from_spring_s_xml&quot;&gt;Spring XML to Annotations&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;AppFuse Light &lt;a href=&quot;http://raibledesigns.com/rd/entry/appfuse_light_converted_to_maven&quot;&gt;converted to Maven modules&lt;/a&gt; and now depends on AppFuse&apos;s backend.&lt;/li&gt;
&lt;li&gt;Published easier to use archetype selection form in the &lt;a href=&quot;http://appfuse.org/display/APF/AppFuse+QuickStart&quot;&gt;QuickStart Guide&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Published &lt;a href=&quot;http://static.appfuse.org/light/archetypes.html&quot;&gt;archetype selection form for AppFuse Light&lt;/a&gt;. I do plan on combining these forms as soon as I figure out the best UI and instructions for users to choose AppFuse or AppFuse Light.&lt;/li&gt;
&lt;li&gt;Upgraded all libraries to latest released versions (Spring 3 hasn&apos;t had a final release yet).&lt;/li&gt;
&lt;li&gt;Upgraded to Tapestry 5 thanks to &lt;a href=&quot;http://code.google.com/p/tapestry5-appfuse/&quot;&gt;Serge Eby&lt;/a&gt;. I still need to complete tests and code generation for tests.&lt;/li&gt;
&lt;li&gt;Added &lt;a href=&quot;http://issues.appfuse.org/browse/APF-267&quot;&gt;Compass support&lt;/a&gt; thanks to a patch from &lt;a href=&quot;http://www.kimchy.org/&quot;&gt;Shay Banon&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Upgraded from &lt;a href=&quot;http://issues.appfuse.org/browse/APF-1125&quot;&gt;XFire to CXF&lt;/a&gt; for Web Services.&lt;/li&gt;
&lt;li&gt;Moved Maven repository to &lt;a href=&quot;https://docs.sonatype.com/display/NX/OSS+Repository+Hosting&quot;&gt;Sonatype&apos;s OSS Repository Hosting&lt;/a&gt; for snapshots and releasing to Maven Central. There are no longer any AppFuse-specific artifacts, all are available in central.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I realize there&apos;s many full-stack frameworks that do the same thing as AppFuse with less code. Examples include &lt;a href=&quot;http://rubyonrails.org&quot;&gt;Ruby on Rails&lt;/a&gt;, &lt;a href=&quot;http://grails.org&quot;&gt;Grails&lt;/a&gt;, &lt;a href=&quot;http://seamframework.org&quot;&gt;Seam&lt;/a&gt;, &lt;a href=&quot;http://www.springsource.org/roo&quot;&gt;Spring Roo&lt;/a&gt; and the &lt;a href=&quot;http://www.playframework.org/&quot;&gt;Play framework&lt;/a&gt;. However, there seems to be quite a few folks that continue to use AppFuse and it stills serves the community as a nice example of how to integrate frameworks. Furthermore, it helps me keep up with the latest framework releases, their quirks and issues that happen when you try to integrate them. In short, working on it helps me stay up to speed with Java open source frameworks.
&lt;/p&gt;
&lt;p&gt;
For those folks that like the 1.x, Ant-based version of AppFuse, there will &lt;em&gt;not&lt;/em&gt; be a 1.9.5 release. I know I promised it for years, but it&apos;s simply something I will not use, so I&apos;d rather not invest my time in it. I&apos;m sorry for lying to those that expected it.&lt;/p&gt;
&lt;p&gt;So what&apos;s the future of AppFuse? Will it continue to integrate web frameworks with Spring and popular persistence frameworks? Possibly, but it seems more logical to align it with the types of Ajax + REST applications I&apos;m creating these days. I&apos;m currently thinking AppFuse 3.0 would be nice as a RESTful backend with GWT and Flex UIs. I might create the backend with &lt;a href=&quot;http://cxf.apache.org/&quot;&gt;CXF&lt;/a&gt;, but it&apos;s possible I&apos;d use one of the frameworks mentioned above and simply leverage it to create the default features AppFuse users have come to expect.&lt;/p&gt;
&lt;p&gt;More than anything, I&apos;m writing this letter to let you know that the AppFuse project is not dead and you can expect a release in the near future.&lt;/p&gt;
&lt;p&gt;Thanks for your support,&lt;/p&gt;
&lt;p&gt;Matt</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/building_gwt_applications_with_mvp</id>
        <title type="html">Building GWT Applications with MVP and Issues with Overlay Types</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/building_gwt_applications_with_mvp"/>
        <published>2009-09-22T13:41:36-06:00</published>
        <updated>2012-11-11T02:00:40-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="json" scheme="http://roller.apache.org/ns/tags/" />
        <category term="gxt" scheme="http://roller.apache.org/ns/tags/" />
        <category term="testing" scheme="http://roller.apache.org/ns/tags/" />
        <category term="gwt" scheme="http://roller.apache.org/ns/tags/" />
        <category term="overlaytypes" scheme="http://roller.apache.org/ns/tags/" />
        <category term="mvp" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="easymock" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">MVP has recently become a popular strategy for structuring GWT applications. This is largely due to its &lt;a href=&quot;http://googletesting.blogspot.com/2009/02/with-all-sport-drug-scandals-of-late.html&quot;&gt;testability&lt;/a&gt; and Ray Ryan&apos;s &lt;a href=&quot;http://code.google.com/events/io/sessions/GoogleWebToolkitBestPractices.html&quot;&gt;Best Practices For Architecting Your GWT App&lt;/a&gt; from this year&apos;s Google I/O. GWT, by itself, is simply a widget toolkit and doesn&apos;t ship with any sort of MVC (or MVP) framework.
&lt;/p&gt;
&lt;p&gt;
On my current project, we&apos;re using &lt;a href=&quot;http://www.extjs.com/products/gxt/&quot;&gt;GXT&lt;/a&gt;, a GWT implementation based on ExtJS. It has its own MVC framework, but it has very little documentation and can be confusing when using it with GWT&apos;s History management. At one point, I attempted to make it more understandable by writing a blog entry on &lt;a href=&quot;http://raibledesigns.com/rd/entry/gxt_s_mvc_framework&quot;&gt;GXT&apos;s MVC Framework&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt; 
One of my initial assignments was to decide if we should use MVP or MVC. Regardless of which one was chosen, I was also tasked with deciding if we should use an existing framework or write our own. After watching &lt;a href=&quot;http://www.youtube.com/watch?v=PDuhR18-EdM&quot;&gt;Ray Ryan&apos;s session on YouTube&lt;/a&gt; and recalling my frustration with GXT MVC on my last project, I quickly became convinced MVP was the answer.
&lt;/p&gt;
&lt;p&gt;
To test my &quot;MVP is best for our project&quot; theory, I did a spike to implement it. I used the &lt;a href=&quot;http://blog.hivedevelopment.co.uk/2009/08/google-web-toolkit-gwt-mvp-example.html&quot;&gt;GWT MVP Example tutorial&lt;/a&gt; as a starting point and added the following libraries to my project.
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/gwt-presenter/&quot;&gt;GWT-Presenter&lt;/a&gt;: An implementation of the MVP pattern.&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/google-gin/&quot;&gt;Google Gin&lt;/a&gt;: Dependency Injection based on Google&apos;s Guice.&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/gwt-log/&quot;&gt;GWT-Log&lt;/a&gt;: A log4j-style logger for GWT.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Implementing the MVP pattern itself was relatively straightforward, but I did encounter a few issues. I&apos;m writing this post to see if anyone has solved these issues.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MVP Implementation Issues&lt;/strong&gt;&lt;br/&gt;
The first issue I ran across was &lt;a href=&quot;http://www.extjs.com/forum/showthread.php?t=76968&quot;&gt;GXT&apos;s widgets don&apos;t implement standard GWT interfaces&lt;/a&gt;. To try and figure out a solution, I &lt;a href=&quot;http://tweader.com/conversation.php?id=3554190680&quot;&gt;posted&lt;/a&gt; the following on Twitter:
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;&quot;Wondering if it&apos;s possible to do MVP with GXT since it&apos;s buttons don&apos;t implement standard GWT interfaces.&quot;
&lt;/p&gt;
&lt;p&gt;
The best response I received was from Simon Stewart (founder of the &lt;a href=&quot;http://code.google.com/p/webdriver/&quot;&gt;WebDriver&lt;/a&gt; project, works for Google):&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
&quot;Put the GXT buttons in the View. Let that turn DOM events into semantic events.&quot;
&lt;/p&gt;
&lt;p&gt;He also pointed me to his &lt;a href=&quot;http://code.google.com/p/tdd-gwt-gae/&quot;&gt;tdd-gwt-gae&lt;/a&gt; project which shows many techniques for unit testing (with jMock) and integration testing (with GWTTestCase). Using Simon&apos;s examples, I was able to determine an initial strategy for implementing MVP with GXT.&lt;/p&gt;
&lt;p&gt;My strategy is instead of getting widgets from the view and adding handlers, you add handlers to to the view and it takes care of adding them to the widgets that should listen for them. This seems to work, but my View interface has a lot of void methods, which is a bit different than standard MVP patterns I&apos;ve seen.&lt;/p&gt;
&lt;p&gt;The 2nd issue I encountered is with unit testing. Unit testing can be be performed on MVP applications by mocking out any dependencies that use JSNI. Classes that use JSNI are not testable with plain ol&apos; JUnit and typically requires you to use &lt;a href=&quot;http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/junit/client/GWTTestCase.html&quot;&gt;GWTTestCase&lt;/a&gt;, which can be slow and cumbersome. This isn&apos;t to say that GWTTestCase isn&apos;t useful, just that it has its place.
&lt;/p&gt;
&lt;p&gt;When unit testing MVP applications, the recommended practice seems to be you should test presenters and not views. Services fall into a similar &quot;don&apos;t unit test&quot; category because they&apos;ll need to connect to the server-side, which won&apos;t be running in a unit testing environment. 
&lt;/p&gt;
&lt;p&gt;This is where I ran into a major issue that I don&apos;t have a solution for.
&lt;/p&gt;
&lt;p&gt;I&apos;m using Overlay Types (as described in &lt;a href=&quot;http://raibledesigns.com/rd/entry/json_parsing_with_javascript_overlay&quot;&gt;JSON Parsing with JavaScript Overlay Types&lt;/a&gt;) to do JSON parsing in callbacks. Since Overlay Types use JSNI, it&apos;s not possible to do any JSON parsing in unit tests. The problem with not being able to do any JSON parsing is the callbacks will often call &lt;code&gt;eventBus.fireEvent(GwtEvent)&lt;/code&gt; after the JSON parsing has happened. This means I can&apos;t fully test the flow of a presenter if event firing happens in a callback.
&lt;/p&gt;
&lt;p&gt;
In attempt to try different mocking techniques for callbacks, I created a test that uses two recommended EasyMock-ing strategies. The first is a &quot;CallbackSuccessMatcher&quot; and is described in more detail in &lt;a href=&quot;http://googletesting.blogspot.com/2009/08/tott-testing-gwt-without-gwttest.html&quot;&gt;Testing GWT without GwtTestCase&lt;/a&gt;. The second technique uses a &quot;CallbackMockSupport&quot; class to allow EasyMock expectations such as &lt;em&gt;expectLastCallAsync() &lt;/em&gt;and &lt;em&gt;expectLastCallAsyncSuccess(T)&lt;/em&gt;. You can read more about this technique in &lt;a href=&quot;http://robvanmaris.jteam.nl/2008/04/22/test-driven-development-for-gwt-ui-code-with-asynchronous-rpc/&quot;&gt;Test driven development for GWT UI code with asynchronous RPC&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Both of these examples use RPC, which typically has callbacks that have an onSuccess(T type) method. It&apos;s easy to use these callbacks in unit tests since T is a POJO and the onSuccess() method contains no JSNI code.&lt;/p&gt;
&lt;p&gt;Currently, I see a few possible solutions to this problem:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Figure out a way to detect when unit tests are running and add if/else logic to callbacks. 
&lt;/li&gt;
&lt;li&gt;Modify presenters and services so a callback can be set that is unit test-friendly.&lt;/li&gt;
&lt;li&gt;Make JSOModel an interface that can be replaced/mocked in tests.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The last solution seems like best one, but I&apos;m also curious to know what others are doing. My hunch is that most GWT apps use RPC and haven&apos;t run into this issue. </content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/my_experience_with_java_rest</id>
        <title type="html">My Experience with Java REST Frameworks (specifically Jersey and CXF)</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/my_experience_with_java_rest"/>
        <published>2009-08-27T14:20:51-06:00</published>
        <updated>2012-11-11T02:00:40-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="jersey" scheme="http://roller.apache.org/ns/tags/" />
        <category term="cxf" scheme="http://roller.apache.org/ns/tags/" />
        <category term="json" scheme="http://roller.apache.org/ns/tags/" />
        <category term="gwt" scheme="http://roller.apache.org/ns/tags/" />
        <category term="soap" scheme="http://roller.apache.org/ns/tags/" />
        <category term="rpc" scheme="http://roller.apache.org/ns/tags/" />
        <category term="rest" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webservices" scheme="http://roller.apache.org/ns/tags/" />
        <category term="enunciate" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Recently I was tasked with developing a server-side REST strategy for a client. When I started working with them, they were using GWT RPC for exposing services. They wanted to move to RESTful services to allow for a more open platform, that multiple types of clients could talk to. There were interested in supporting SOAP and GWT RPC as well, but it wasn&apos;t required. They are using Spring, a &lt;a href=&quot;http://blog.springsource.com/2006/08/28/creating-a-spring-20-namespace-use-springs-abstractbeandefintionparser-hierarchy/&quot;&gt;custom namespace&lt;/a&gt; (for easily creating remote services) and an HTML documentation generator to expose their API in human readable form.
&lt;/p&gt;
&lt;p&gt;When I first starting developing, I chose to try &lt;a href=&quot;http://enunciate.codehaus.org/&quot;&gt;Enunciate&lt;/a&gt;. From Enunciate&apos;s homepage:&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
Enunciate is an engine for creating, maintaining, and deploying your rich Web service API on the Java platform.
If that sounds complicated, it&apos;s not. All you have to do is define your service interfaces in Java source code. ... 
Then invoke Enunciate.
&lt;/p&gt;
&lt;p&gt;Sounds pretty sweet, eh? At first glance, the things I liked about Enunciate were:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The ability to generate multiple endpoints (and clients).&lt;/li&gt;
&lt;li&gt;Generates nice-looking documentation.&lt;/li&gt;
&lt;li&gt;Allows selecting different frameworks (for example, &lt;a href=&quot;http://docs.codehaus.org/display/ENUNCIATE/Using+CXF+or+XFire&quot;&gt;CXF instead of JAX-WS RI&lt;/a&gt;).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Initially, the hardest part of using Enunciate was integrating it into my project. This was somewhat related to having a &lt;a href=&quot;http://docs.codehaus.org/display/ENUNCIATE/Multi-Module+Projects&quot;&gt;multi-module project&lt;/a&gt;, but moreso related to getting the settings right in my &lt;em&gt;enunciate.xml&lt;/em&gt; file. After getting everything working, I encountered &lt;a href=&quot;http://markmail.org/thread/g3wj2gyvtqq5v3f4&quot;&gt;a few Spring wiring issues&lt;/a&gt; with the GWT Endpoints and with Jersey&apos;s Spring support. 
&lt;/p&gt;
&lt;p&gt;
The good news is I believe most of these issues were related to my project and how it proxies Spring beans that Jersey couldn&apos;t find. Jersey&apos;s &lt;a href=&quot;http://blogs.sun.com/enterprisetechtips/entry/jersey_and_spring&quot;&gt;Spring support&lt;/a&gt; only supports annotations at this time, so I was unable to tell it the proxied bean names via XML (or even its own annotations). I&apos;m sure this problem is solvable, but after struggling with it for a day or two, I decided to give up on Enunciate. I had to get something working, and fast.
&lt;/p&gt;
&lt;p&gt;At this point, I was back to the drawing board. I knew there were plenty of good Java REST frameworks available, but Spring and CXF (for SOAP) were already available dependencies in my project, so I chose that route. I was able to get something up and running fairly quickly with &lt;a href=&quot;http://raulraja.com/2009/06/25/spring-exposing-a-bean-as-rest-xml-json-and-soap-webservice/&quot;&gt;this tutorial&lt;/a&gt; and CXF&apos;s &lt;a href=&quot;http://cwiki.apache.org/CXF20DOC/jax-rs.html&quot;&gt;JAX-RS documentation&lt;/a&gt;. I ran into an &lt;a href=&quot;http://twitter.com/mraible/statuses/3407586205&quot;&gt;Invalid JSON Namespace issue&lt;/a&gt;, but was able to solve it by &lt;a href=&quot;https://issues.apache.org/jira/browse/CXF-1671&quot;&gt;adding a custom namespace&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;It&apos;s not all rosy though, there are still a couple CXF issues I haven&apos;t solved:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I&apos;d like to remove the namespace prefixes on returned JSON. I&apos;ve never seen JSON with &quot;prefix.&quot; notation before and it doesn&apos;t seem right.&lt;/li&gt;
&lt;li&gt;I&apos;m &lt;a href=&quot;http://www.nabble.com/No-message-body-writer-found-for-response-class-%3A-String---tt25070046.html#a25070046&quot;&gt;unable to return String[] from services&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;While CXF does take a bit of XML for each service, it&apos;s kinda slick in that it only requires you to annotate your service interfaces. It also generates documentation for your services (WSDL and WADL), but it&apos;s not as pretty as Enunciate&apos;s. To solve this, I &lt;a href=&quot;http://docs.codehaus.org/display/ENUNCIATE/Documentation+Only&quot;&gt;added Enunciate for documentation only&lt;/a&gt;. To make Enunciate work, I did have to add some annotations to my service implementation classes and &lt;a href=&quot;http://markmail.org/thread/r6i4rv45lkaknzv7&quot;&gt;parse the generated HTML&lt;/a&gt; to fix some links to CXF&apos;s services, but ultimately it works pretty well. 
&lt;/p&gt;
&lt;p&gt;In the end, I recommended my client not use Enunciate for generating endpoints. This was primarily related to their unique Spring configuration, but also because I was able to easily use the same classes for REST, SOAP and GWT Endpoints. However, I will continue to keep my eye on Enunciate. It could be very useful for the upcoming &lt;a href=&quot;http://jira.codehaus.org/browse/ENUNCIATE-290&quot;&gt;appfuse-ws&lt;/a&gt; archetype. I&apos;m also eager to see &lt;a href=&quot;http://jira.codehaus.org/browse/ENUNCIATE-319&quot;&gt;better GWT support&lt;/a&gt; and the ability to &lt;a href=&quot;http://jira.codehaus.org/browse/ENUNCIATE-290&quot;&gt;generate Overlay types&lt;/a&gt; in future releases. </content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/integrating_gwt_with_spring_security</id>
        <title type="html">Integrating GWT with Spring Security</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/integrating_gwt_with_spring_security"/>
        <published>2009-08-06T08:50:15-06:00</published>
        <updated>2012-10-17T17:35:41-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="authentication" scheme="http://roller.apache.org/ns/tags/" />
        <category term="security" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <category term="gwt" scheme="http://roller.apache.org/ns/tags/" />
        <category term="springsecurity" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Yesterday, I wrote about &lt;a href=&quot;http://raibledesigns.com/rd/entry/how_to_do_cross_domain&quot;&gt;How to do cross-domain GWT RPC with a ProxyServlet&lt;/a&gt;. Today I&apos;ll be discussing
    how to modify the ProxyServlet to authenticate with Spring Security. For the application I&apos;m working on, the ProxyServlet
    is only used in development (when running GWT&apos;s hosted mode) and isn&apos;t necessary when deploying the client and
    server on the same server. Using the ProxyServlet allows cross-domain requests so you can run GWT in hosted mode and
    talk to your backend running on another server. This setup can be especially handy in that you
    can easily point your hosted client at different backends (for example, if you have testing and staging environments).
&lt;/p&gt;
&lt;p&gt;
    In this example, the backend application is a JSF/Spring application that has Spring Security wired in to protect
    services with both Basic and Form-based authentication. Basic authentication will kick in if a &quot;Authorization&quot; header
    is sent, otherwise Form-based authentication is used. Here&apos;s the Spring Security context file that makes this happen:
&lt;/p&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;

&amp;lt;beans:beans xmlns=&quot;http://www.springframework.org/schema/security&quot;
             xmlns:beans=&quot;http://www.springframework.org/schema/beans&quot;
             xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
             xsi:schemaLocation=&quot;...&quot;&amp;gt;

    &amp;lt;http auto-config=&quot;true&quot; realm=&quot;My Web Application&quot;&amp;gt;
        &amp;lt;intercept-url pattern=&quot;/faces/welcome.jspx&quot; access=&quot;ROLE_USER&quot;/&amp;gt;
        &amp;lt;intercept-url pattern=&quot;/*.rpc&quot; access=&quot;ROLE_USER&quot;/&amp;gt;
        &amp;lt;http-basic/&amp;gt;
        &amp;lt;form-login login-page=&quot;/faces/login.jspx&quot; authentication-failure-url=&quot;/faces/accessDenied.jspx&quot;
                    login-processing-url=&quot;/j_spring_security_check&quot; default-target-url=&quot;/redirect.jsp&quot;
                    always-use-default-target=&quot;true&quot;/&amp;gt;
    &amp;lt;/http&amp;gt;

    &amp;lt;authentication-provider&amp;gt;
        &amp;lt;user-service &amp;gt;
            &amp;lt;user name=&quot;admin&quot; password=&quot;admin&quot; authorities=&quot;ROLE_USER&quot;/&amp;gt;
        &amp;lt;/user-service&amp;gt;
    &amp;lt;/authentication-provider&amp;gt;
&amp;lt;/beans:beans&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
The easiest way to configure your GWT application to talk to a Spring Security protected resource is to
&lt;a href=&quot;http://www.dotnetguru2.org/bmarchesson/index.php?p=678&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1&quot;&gt;protect your HTML page that GWT is embedded in&lt;/a&gt;. This is the documented way to integrate GWT with Spring Security (ref: 
&lt;a href=&quot;http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ&quot;&gt;GWT&apos;s LoginSecurityFAQ&lt;/a&gt;, search for &quot;Acegi&quot;).
This works well for production, but not for hosted-mode development.&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Basic Authentication&lt;/strong&gt;&lt;br/&gt;
To authenticate with Basic Authentication, you can use GWT&apos;s RequestBuilder and set an &quot;Authentication&quot; header that
contains the user&apos;s (base64-encoded) credentials.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
private class LoginRequest {
    public LoginRequest(RequestCallback callback) {
        String url = &quot;/services/faces/welcome.jspx&quot;;

        RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
        rb.setHeader(&quot;Authorization&quot;, createBasicAuthToken());
        rb.setCallback(callback);
        try {
            rb.send();
        } catch (RequestException e) {
            Window.alert(e.getMessage());
        }
    }
}

protected String createBasicAuthToken() {
    byte[] bytes = stringToBytes(username.getValue() + &quot;:&quot; + password.getValue());
    String token = Base64.encode(bytes);
    return &quot;Basic &quot; + token;
}

protected byte[] stringToBytes(String msg) {
    int len = msg.length();
    byte[] bytes = new byte[len];
    for (int i = 0; i &amp;lt; len; i++)
        bytes[i] = (byte) (msg.charAt(i) &amp;amp; 0xff);
    return bytes;
}
&lt;/pre&gt;
&lt;p&gt;
To use this LoginRequest class, create it with a callback and look for a 401 response code to determine if
authentication failed.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
new LoginRequest(new RequestCallback() {
    public void onResponseReceived(Request request, Response response) {
        if (response.getStatusCode() != Response.SC_UNAUTHORIZED &amp;amp;&amp;amp;
                response.getStatusCode() != Response.SC_OK) {
            onError(request, new RequestException(response.getStatusText() + &quot;:\n&quot; + response.getText()));
            return;
        }

        if (response.getStatusCode() == Response.SC_UNAUTHORIZED) {
            Window.alert(&quot;You have entered an incorrect username or password. Please try again.&quot;);
        } else {
            // authentication worked, show a fancy dashboard screen
        }
    }

    public void onError(Request request, Throwable throwable) {
        Window.alert(throwable.getMessage());
    }
});
&lt;/pre&gt;
&lt;p&gt;If your GWT application is included in the &quot;services&quot; war, everything should work at this point. However, if you try to login
with invalid credentials, your browser&apos;s login dialog will appear. To suppress this in the aforementioned
ProxyServlet, you&apos;ll need to make a change in its &lt;em&gt;executeProxyRequest()&lt;/em&gt; method so the &quot;WWW-Authenticate&quot; header
is not copied.&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
// Pass the response code back to the client
httpServletResponse.setStatus(intProxyResponseCode);

// Pass response headers back to the client
Header[] headerArrayResponse = httpMethodProxyRequest.getResponseHeaders();
for (Header header : headerArrayResponse) {
    if (header.getName().equals(&quot;Transfer-Encoding&quot;) &amp;amp;&amp;amp; header.getValue().equals(&quot;chunked&quot;) ||
            header.getName().equals(&quot;Content-Encoding&quot;) &amp;amp;&amp;amp; header.getValue().equals(&quot;gzip&quot;) ||
            header.getName().equals(&quot;WWW-Authenticate&quot;)) { // don&apos;t copy WWW-Authenticate header
    } else {
        httpServletResponse.setHeader(header.getName(), header.getValue());
    }
}
&lt;/pre&gt;
&lt;p&gt;I&apos;m not sure how to suppress the browser prompt when not using the ProxyServlet. If you have a solution, please
&lt;a href=&quot;http://raibledesigns.com/rd/entry/integrating_gwt_with_spring_security#comments&quot;&gt;let me know&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Basic Authentication works well for GWT applications because you don&apos;t need additional logic to retain the
authenticated state after the initial login. While Basic Authentication over SSL might offer a decent solution,
the downside is you can&apos;t logout. Form-based Authentication allows you to logout.&lt;/p&gt;
&lt;strong&gt;Form-based Authentication&lt;/strong&gt;&lt;br/&gt;
&lt;p&gt;Before I show you how to implement form-based authentication, you should be aware that Google does not recommend this.
Below is a warning from their LoginSecurityFAQ.&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
Do &lt;i&gt;NOT&lt;/i&gt; attempt to use the &lt;code&gt;Cookie&lt;/code&gt; header to transfer the sessionID from GWT to the server; it is
fraught with security issues that will become clear in the rest of this article. You &lt;strong&gt;MUST&lt;/strong&gt; transfer
the sessionID in the payload of the request. For an example of why this can fail, see CrossSiteRequestForgery.
&lt;/p&gt;
&lt;p&gt;In my experiment, I didn&apos;t want to change the server-side Spring Security configuration, so I ignored this
warning. If you know how to configure Spring Security so it looks for the sessionID in the payload of the request
(rather than in a cookie), I&apos;d love to hear about it. The upside of the example below is it should work with 
container-managed authentication as well.&lt;/p&gt;
&lt;p&gt;
The LoginRequest class for form-based authentication is similar to the previous one, except it has a different URL and
sends the user&apos;s credentials in the request body.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
private class LoginRequest {
    public LoginRequest(RequestCallback callback) {
        String url = &quot;/services/j_spring_security_check&quot;;

        RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url);
        rb.setHeader(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;);
        rb.setRequestData(&quot;j_username=&quot; + URL.encode(username.getValue()) +
                    &quot;&amp;amp;j_password=&quot; + URL.encode(password.getValue()));

        rb.setCallback(callback);
        try {
            rb.send();
        } catch (RequestException e) {
            Window.alert(e.getMessage());
        }
    }
}
&lt;/pre&gt;
&lt;p&gt;If you deploy your GWT application in the same WAR your services are hosted in, this is all you&apos;ll need to do. If
you&apos;re using the ProxyServlet, there&apos;s a couple of changes you&apos;ll need to make in order to set/send cookies when
running in hosted mode.
&lt;/p&gt;
&lt;p&gt;
First of all, you&apos;ll need to make sure you&apos;ve configured the servlet to follow redirects (by subclassing or simply modifying its default).
After that, add the following logic on line 358 (or just look for &quot;&lt;code&gt;if (followRedirects)&lt;/code&gt;&quot;) to expose the sessionID to the client. The most important part is setting the cookie&apos;s path to &quot;/&quot; so the client (running at localhost:8888) can see it.&lt;/p&gt;
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
if (followRedirects) {
    // happens on first login attempt
    if (stringLocation.contains(&quot;jsessionid&quot;)) { 
        Cookie cookie = new Cookie(&quot;JSESSIONID&quot;,
                stringLocation.substring(stringLocation.indexOf(&quot;jsessionid=&quot;) + 11));
        cookie.setPath(&quot;/&quot;);
        httpServletResponse.addCookie(cookie);
    // the following happens if you refresh your GWT app after already logging in once
    } else if (httpMethodProxyRequest.getResponseHeader(&quot;Set-Cookie&quot;) != null) {
        Header header = httpMethodProxyRequest.getResponseHeader(&quot;Set-Cookie&quot;);
        String[] cookieDetails = header.getValue().split(&quot;;&quot;);
        String[] nameValue = cookieDetails[0].split(&quot;=&quot;);

        Cookie cookie = new Cookie(nameValue[0], nameValue[1]);
        cookie.setPath(&quot;/&quot;);
        httpServletResponse.addCookie(cookie);
    }
    httpServletResponse.sendRedirect(stringLocation.replace(getProxyHostAndPort() +
            this.getProxyPath(), stringMyHostName));
    return;
}
&lt;/pre&gt;
&lt;p style=&quot;font-style: italic&quot;&gt;Click &lt;a href=&quot;http://www.flickr.com/photos/mraible/3794558459/sizes/l/&quot;&gt;here&lt;/a&gt; to see a screenshot of the diff of the ProxyServlet after this code has been added.&lt;/p&gt;
&lt;p&gt;Figuring out that headers needed to be parsed &lt;strong&gt;after&lt;/strong&gt; authenticating successfully and &lt;strong&gt;before&lt;/strong&gt; redirecting was the hardest part for me. If you grab the JSESSIONID from
the &quot;Set-Cookie&quot; header anywhere else, the JSESSIONID is one that hasn&apos;t been authenticated. While the login will work,
subsequent calls to services will fail.&lt;/p&gt;
&lt;p&gt;To make subsequent calls with the cookie in the header, you&apos;ll need to make an additional modification to ProxyServlet to 
send cookies as headers. First of all, add a &lt;em&gt;setProxyRequestCookies()&lt;/em&gt; method:&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
/**
 * Retrieves all of the cookies from the servlet request and sets them on
 * the proxy request
 *
 * @param httpServletRequest The request object representing the client&apos;s
 *                            request to the servlet engine
 * @param httpMethodProxyRequest The request that we are about to send to
 *                                the proxy host
 */
@SuppressWarnings(&quot;unchecked&quot;)
private void setProxyRequestCookies(HttpServletRequest httpServletRequest, 
                                    HttpMethod httpMethodProxyRequest) {
    // Get an array of all of all the cookies sent by the client
    Cookie[] cookies = httpServletRequest.getCookies();
    if (cookies == null) {
        return;
    }
    
    for (Cookie cookie : cookies) {
        cookie.setDomain(stringProxyHost);
        cookie.setPath(httpServletRequest.getServletPath());
        httpMethodProxyRequest.setRequestHeader(&quot;Cookie&quot;, cookie.getName() +  
                &quot;=&quot; + cookie.getValue() + &quot;; Path=&quot; + cookie.getPath());
    }
}
&lt;/pre&gt;
&lt;p&gt;Next, in the &lt;em&gt;doGet()&lt;/em&gt; and &lt;em&gt;doPost()&lt;/em&gt; methods, add the following line just after the call to &lt;em&gt;setProxyRequestHeaders()&lt;/em&gt;.&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
setProxyRequestCookies(httpServletRequest, getMethodProxyRequest);
&amp;nbsp;
&lt;/pre&gt;
&lt;p&gt;After making these modifications to ProxyServlet, you can create LoginRequest and attempt to authenticate. To detect a failed attempt, I&apos;m looking for text in Spring Security&apos;s &quot;authentication-failure-url&quot; page.
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
new LoginRequest(new RequestCallback() {

    public void onResponseReceived(Request request, Response response) {
        if (response.getStatusCode() != Response.SC_OK) {
            onError(request, new RequestException(response.getStatusText() + &quot;:\n&quot; + response.getText()));
            return;
        }
        
        if (response.getText().contains(&quot;Access Denied&quot;)) {
            Window.alert(&quot;You have entered an incorrect username or password. Please try again.&quot;);
        } else {
            // authentication worked, show a fancy dashboard screen
        }
    }

    public void onError(Request request, Throwable throwable) {
        Window.alert(throwable.getMessage());
    }
});
&lt;/pre&gt;
&lt;p&gt;After making these changes, you should be able to authenticate with Spring Security&apos;s form-based configuration. While this example doesn&apos;t show how to logout, it should be easy enough to do by 1) deleting the JSESSIONID cookie or 2) calling the Logout URL you have configured in your services WAR.&lt;/p&gt;
&lt;p&gt;Hopefully this howto gives you enough information to configure your GWT application to talk to Spring Security
without modifying your existing backend application. It&apos;s entirely possible that Spring Security offers a more GWT-friendly
authentication mechanism. If you know of a better way to integrate GWT with Spring Security, I&apos;d love to hear about it.&lt;/p&gt;
&lt;p id=&quot;update&quot;&gt;&lt;strong&gt;Update on October 7, 2009&lt;/strong&gt;: I did some additional work on this and got Remember Me working when using form-based authentication. I found I didn&apos;t need as much fancy logic in my ProxyServlet and was able to reduce the &quot;followRequests&quot; logic to the following:
&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
if (followRedirects) {
    if (httpMethodProxyRequest.getResponseHeader(&quot;Set-Cookie&quot;) != null) {
        Header[] headers = httpMethodProxyRequest.getResponseHeaders(&quot;Set-Cookie&quot;);
        if (headers.length == 1) {
            extractCookieFromHeader(httpServletResponse, headers[0]);
        } else {
            // ignore the first header since there always seems two jsessionid headers
            // and the 2nd is the valid one
            for (int i = 1; i &lt; headers.length; i++) {
                extractCookieFromHeader(httpServletResponse, headers[i]);
            }
        }
    }
    httpServletResponse.sendRedirect(
            stringLocation.replace(getProxyHostAndPort() + getProxyPath(), stringMyHostName));
    return;
}
&lt;/pre&gt;
&lt;p&gt;I was also able to remove the &lt;em&gt;setProxyRequestCookies()&lt;/em&gt; method completely as it no longer seems necessary.&lt;/p&gt;
&lt;p&gt;Next, I&apos;d like to figure out how to make Spring Security more Ajax-friendly where it can read an authentication token in the request body or header (instead of from a cookie). Also, it&apos;d be sweet if I could convince it to return error codes instead of the login page (for example, when a certain header is present). </content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/moving_from_spring_s_xml</id>
        <title type="html">Moving from Spring&apos;s XML to Annotations in AppFuse</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/moving_from_spring_s_xml"/>
        <published>2008-11-04T11:39:54-07:00</published>
        <updated>2014-05-08T19:47:19-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="appfuse" scheme="http://roller.apache.org/ns/tags/" />
        <category term="junit4" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <category term="abstracttransactionaldatasourcespringcontexttests" scheme="http://roller.apache.org/ns/tags/" />
        <category term="annotations" scheme="http://roller.apache.org/ns/tags/" />
        <category term="xml" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Last night, I did a spike on AppFuse to &lt;a href=&quot;http://issues.appfuse.org/browse/APF-1105&quot;&gt;change XML to Spring annotations (@Repository, @Service and @Autowired)&lt;/a&gt; in its service and data modules. While I was able to accomplish everything in a few hours (including converting tests), I did run into a couple issues.
&lt;/p&gt;
&lt;p style=&quot;text-align: left&quot;&gt;
&lt;strong&gt;AbstractTransactionalJUnit4..Tests vs. AbstractTransactionalDataSource..Tests&lt;/strong&gt;&lt;br/&gt;
I&apos;ve switched from &lt;a href=&quot;http://www.jroller.com/raible/entry/ditch_dbunit_use_abstracttransactionaldatasourcespringcontexttests&quot;&gt;my favorite Spring class&lt;/a&gt; to the annotation-happy &lt;a href=&quot;http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/test/context/junit4/AbstractTransactionalJUnit4SpringContextTests.html&quot;&gt;AbstractTransactionalJUnit4SpringContextTests&lt;/a&gt;. However, this has presented an issue: when using ATDSSCT, I was able to call &lt;code&gt;endTransaction()&lt;/code&gt; and &lt;code&gt;startNewTransaction()&lt;/code&gt;. With ATJ4SCT, this doesn&apos;t seem possible. Below is a screenshot of the diff on a test method in the JPA implementation of UserDaoTest:
&lt;/p&gt;
&lt;a href=&quot;http://farm4.static.flickr.com/3166/3003374654_31fff24bd1_o.png&quot; title=&quot;AbstractTransactionalJUnit4SpringContextTests vs. AbstractTransactionalDataSourceSpringContextTests&quot; rel=&quot;lightbox[appfuse-annotations]&quot;&gt;&lt;img src=&quot;//farm4.static.flickr.com/3166/3003374654_a3f2ca2ebd.jpg&quot; width=&quot;500&quot; height=&quot;188&quot; alt=&quot;AbstractTransactionalJUnit4SpringContextTests vs. AbstractTransactionalDataSourceSpringContextTests&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p style=&quot;text-align: left&quot;&gt;On the right, you&apos;ll notice that I had to comment out &lt;code&gt;@ExpectedException&lt;/code&gt; to get the test to pass. This concerns me since this exception should be thrown. Is there a way to call &lt;code&gt;endTransaction()&lt;/code&gt; and &lt;code&gt;startNewTransaction()&lt;/code&gt; when subclassing AbstractTransactionalJUnit4SpringContextTests?
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Instantiating GenericDao Implementations Programmatically&lt;/strong&gt;&lt;br/&gt;
The second feature I tried to add is the ability to instantiate a GenericDao programatically rather than requiring a XML bean definition. In current versions of AppFuse, you can use the following bean definition to create a GenericDao for a model object.&lt;/p&gt;
&lt;pre&gt;
&amp;lt;bean id=&quot;personDao&quot; class=&quot;org.appfuse.dao.hibernate.GenericDaoHibernate&quot;&amp;gt;
    &amp;lt;constructor-arg value=&quot;org.appfuse.tutorial.model.Person&quot;/&amp;gt; 
    &amp;lt;property name=&quot;sessionFactory&quot; ref=&quot;sessionFactory&quot;/&amp;gt;
&amp;lt;/bean&amp;gt; 
&lt;/pre&gt;
&lt;p&gt;When moving to a &lt;em&gt;no-XML required&lt;/em&gt; architecture, it&apos;d be nice to allow users to create GenericDao&apos;s programmatically. Below is the easiest way I&apos;ve found to do this in a test:
&lt;/p&gt;
&lt;pre&gt;
GenericDao&amp;lt;User, Long&gt; genericDao;
@Autowired
SessionFactory sessionFactory;

@Before
public void setUp() {
    genericDao = new GenericDaoHibernate&amp;lt;User, Long&gt;(User.class);
    genericDao.setSessionFactory(sessionFactory);
}
&lt;/pre&gt;
&lt;p&gt;However, there&apos;s a couple problems with this. First of all, mixing constructor injection and setter injection probably isn&apos;t a good idea. Changing the constructor to take a SessionFactory solves this problem, but now all subclasses need to have a more verbose constructor:
&lt;/p&gt;
&lt;pre&gt;
@Autowired
public UserDaoHibernate(SessionFactory sessionFactory) {
    super(User.class, sessionFactory);
}
&lt;/pre&gt;
&lt;p&gt;Whereas before they had:&lt;/p&gt;
&lt;pre&gt;
public UserDaoHibernate() {
    super(User.class);
}
&lt;/pre&gt;
&lt;p style=&quot;text-align: left&quot;&gt;In an ideal world, I could call &lt;code&gt;new GenericDaoHibernate&amp;lt;User, Long&gt;(User.class)&lt;/code&gt; and the SessionFactory would be wired in auto-magically. Is this possible with Spring 2.5?
&lt;p&gt;The 2nd problem this presents is your client code will now be dependent on an implementation rather than the interface. I don&apos;t know how to solve that one, but I&apos;d love to figure out a way to create GenericDaos with no XML and no implementation details in the client. Any ideas are most welcome.&lt;/p&gt;
&lt;p&gt;If you&apos;d like to see all the changes I made in converting from XML to Annotations, please &lt;a href=&quot;http://issues.appfuse.org/secure/attachment/10512/XMLToAnnotations.patch&quot;&gt;see this patch&lt;/a&gt;.
</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/taking_apache_camel_for_a</id>
        <title type="html">Taking Apache Camel for a Ride with Bruce Snyder</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/taking_apache_camel_for_a"/>
        <published>2008-10-23T14:25:30-06:00</published>
        <updated>2014-05-09T17:18:11-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="eip" scheme="http://roller.apache.org/ns/tags/" />
        <category term="camel" scheme="http://roller.apache.org/ns/tags/" />
        <category term="apache" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="servicemix" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <category term="softwaresummit" scheme="http://roller.apache.org/ns/tags/" />
        <category term="opensource" scheme="http://roller.apache.org/ns/tags/" />
        <category term="brucesnyder" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">&lt;a href=&quot;http://activemq.apache.org/camel/&quot;&gt;Camel&lt;/a&gt; is a Java API that allows you to do message routing very easily. It implements many of the patterns found in &lt;a href=&quot;http://activemq.apache.org/camel/enterprise-integration-patterns.html&quot;&gt;Enterprise Integration Patterns&lt;/a&gt;. It doesn&apos;t require a container and can be run in any Java-based environment. Camel has a whole bunch of components - Bruce is showing a 6 x 10 grid with a component name in each grid. In other words, there&apos;s 60 components that Camel can use. Examples include: ActiveMQ, SQL, Velocity, File and iBATIS. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://www.chrisrichardson.net/&quot;&gt;Chris Richardson&lt;/a&gt; asks &quot;What&apos;s left inside of ServiceMix&quot;. Why use ServiceMix if you have Camel? ServiceMix is a container that can run standalone or inside an app server. You can run distributed ServiceMix as a federated ESB. Camel is much smaller and lightweight and is really just a Java API. ServiceMix 4 changed from a JBI-based architecture to OSGi (based on Apache Felix). They also expect to create your routes for ServiceMix 4 with Camel instead of XML. To process messages, you can use many different languages: BeanShell, JavaScript, Groovy, Python, PHP, Ruby, JSP EL, OGNL, SQL, XPath and XQuery. 
&lt;/p&gt;
&lt;p&gt;
Camel has a &lt;code&gt;CamelContext&lt;/code&gt; that&apos;s similar to Spring&apos;s &lt;code&gt;ApplicationContext&lt;/code&gt;. You can initialize it in Java and add your routes to it:&lt;/p&gt;
&lt;pre&gt;
CamelContext context = new DefaultCamelContext();
context.addRoutes(new MyRouterBuilder());
context.start();
&lt;/pre&gt;
&lt;p&gt;Or you can initialize it using XML:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;camelContext xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;&amp;gt;
    &amp;lt;package&amp;gt;com.acme.routes&amp;lt;/package&amp;gt;
&amp;lt;/camelContext&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Camel&apos;s &lt;code&gt;&lt;a href=&quot;http://activemq.apache.org/camel/routebuilder.html&quot;&gt;RouteBuilder&lt;/a&gt;&lt;/code&gt; contains a &lt;a href=&quot;http://activemq.apache.org/camel/dsl.html&quot;&gt;fluid API&lt;/a&gt; that allows you to define to/from and other criteria. At this point, Bruce is showing a number of examples using the Java API. He&apos;s showing a Content Based Router, a Message Filter, a Splitter, an Aggregator, a Message Translator, a Resequencer, a Throttler and a Delayer.&lt;/p&gt;
&lt;p&gt;Bruce spent the last 10 minutes doing a demo using Eclipse, m2eclipse, the camel-maven-plugin and ActiveMQ. It&apos;s funny to see a command-line guy like Bruce say he can&apos;t live w/o m2eclipse. I guess Maven&apos;s XML isn&apos;t so great after all. &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Camel is built on top of Spring and has good integration. Apparently, the Camel developers tried to get it added to Spring, but the SpringSource guys didn&apos;t want it. Coincidentally, &lt;a href=&quot;http://www.springframework.org/spring-integration&quot;&gt;Spring Integration&lt;/a&gt; was &lt;a href=&quot;http://blog.springsource.com/2007/12/14/spring-integration-a-new-addition-to-the-spring-portfolio/&quot;&gt;released&lt;/a&gt; about a year later.&lt;/p&gt;
&lt;p&gt;Camel also allows you to use &quot;beans&quot; and bind them to Camel Endpoints with annotations. For example:

&lt;pre&gt;
public class Foo {

    @MessageDriven (uri=&quot;activemq:cheese&quot;)
    public void onCheese(String name) {
        ...
    }
}
&lt;/pre&gt;
&lt;p&gt;Other annotations include @XPath, @Header and @EndpointInject. 
&lt;/p&gt;
&lt;p&gt;Camel can also be used for BAM (Business Activity Monitoring). Rather than using RouteBuilder, you can use ActivityBuilder to listen for activities and create event notifications.&lt;/p&gt;
&lt;p&gt;Bruce had quite a few folks show up for this presentation. I had trouble finding a seat because I was late. I think he did a good job of showing what Camel is and how you might use it.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/extensionless_urls_in_java_web</id>
        <title type="html">Extensionless URLs with Java Web Frameworks</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/extensionless_urls_in_java_web"/>
        <published>2008-05-13T21:50:51-06:00</published>
        <updated>2008-05-14T04:01:37-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="urlmanagement" scheme="http://roller.apache.org/ns/tags/" />
        <category term="urlrewritefilter" scheme="http://roller.apache.org/ns/tags/" />
        <category term="urls" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Last week, I had a go of making a Spring MVC application use extensionless URLs. I did some googling, found some tips on the &lt;a href=&quot;http://forum.springframework.org&quot;&gt;Spring Forums&lt;/a&gt; and believe I arrived at a solid solution. Using the &lt;a href=&quot;http://tuckey.org/urlrewrite/&quot;&gt;UrlRewriteFilter&lt;/a&gt; (version 3), I was able to create a rule that looks for any URLs without an extension. If it finds one, it appends the extension and forwards to the controllers. This rule is as follows (where *.html is my servlet-mapping for DispatcherServlet in web.xml):
&lt;/p&gt;
&lt;pre&gt;
  &amp;lt;rule&amp;gt;
    &amp;lt;from&amp;gt;^(&amp;#91;^?&amp;#93;*)/(&amp;#91;^?/\.&amp;#93;+)(\?.*)?$&amp;lt;/from&amp;gt;
    &amp;lt;to last=&quot;true&quot;&amp;gt;$1/$2.html$3&amp;lt;/to&amp;gt;
  &amp;lt;/rule&amp;gt;
&lt;/pre&gt;
&lt;p&gt;As long as I hand-write all my URLs without an extension (&amp;lt;a href=&quot;home&quot;&gt; vs. &amp;lt;a href=&quot;home.html&quot;&gt;), this seems to work. To combat developers that use &quot;home.html&quot;, one solution is to require all links to be wrapped with &amp;lt;c:url value=&quot;url&quot;/&gt; (or some other macro that call response.encodeURL()). If you can convince everyone to do this, you can write an outbound-rule that strips the .html extension from URLs.
&lt;/p&gt;
&lt;pre&gt;
  &amp;lt;outbound-rule&amp;gt;
    &amp;lt;from&amp;gt;^(.*)\.html(\?.*)?$&amp;lt;/from&amp;gt;
    &amp;lt;to last=&quot;false&quot;&amp;gt;$1$2&amp;lt;/to&amp;gt;
  &amp;lt;/outbound-rule&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
In an ideal world, it&apos;d be possible to modify the &amp;lt;a&gt; tag at the very core of the view framework you&apos;re using to automatically encode the URL of any &quot;href&quot; attributes. I don&apos;t think this is possible with JSP, FreeMarker, Facelets or any other Java Web Framework templates (i.e. Tapestry or Wicket). If it is, please let me know. 
&lt;/p&gt;
&lt;p&gt;
Below is my final urlrewrite.xml with these rules, as well as my &quot;welcome-file&quot; rule at the top.
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;
&amp;lt;!DOCENGINE urlrewrite PUBLIC &quot;-//tuckey.org//DTD UrlRewrite 3.0//EN&quot;
  &quot;http://tuckey.org/res/dtds/urlrewrite3.0.dtd&quot;&amp;gt;

&amp;lt;urlrewrite&amp;gt;
  &amp;lt;rule&amp;gt;
    &amp;lt;from&amp;gt;/$&amp;lt;/from&amp;gt;
    &amp;lt;to type=&quot;forward&quot;&amp;gt;home&amp;lt;/to&amp;gt;
  &amp;lt;/rule&amp;gt;

  &amp;lt;rule&amp;gt;
    &amp;lt;from&amp;gt;^(&amp;#91;^?&amp;#93;*)/(&amp;#91;^?/\.&amp;#93;+)(\?.*)?$&amp;lt;/from&amp;gt;
    &amp;lt;to last=&quot;true&quot;&amp;gt;$1/$2.html$3&amp;lt;/to&amp;gt;
  &amp;lt;/rule&amp;gt;

  &amp;lt;outbound-rule&amp;gt;
    &amp;lt;from&amp;gt;^(.*)\.html(\?.*)?$&amp;lt;/from&amp;gt;
    &amp;lt;to last=&quot;false&quot;&amp;gt;$1$2&amp;lt;/to&amp;gt;
  &amp;lt;/outbound-rule&amp;gt;

&amp;lt;/urlrewrite&amp;gt;
&lt;/pre&gt;
&lt;p&gt;If you have other solutions for extensionless URLs with Java web frameworks, I&apos;d love to hear about them. With any luck, 2008 will be the year we drop extensions (and path-mappings) from our URLs. The stat packages might not like it, but I do.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/running_spring_mvc_web_applications</id>
        <title type="html">Running Spring MVC Web Applications in OSGi</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/running_spring_mvc_web_applications"/>
        <published>2008-04-30T00:42:34-06:00</published>
        <updated>2008-04-30T06:51:04-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="maven" scheme="http://roller.apache.org/ns/tags/" />
        <category term="springmvc" scheme="http://roller.apache.org/ns/tags/" />
        <category term="osgi" scheme="http://roller.apache.org/ns/tags/" />
        <category term="equinox" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">For the past couple of weeks, I&apos;ve been developing a web application that deploys into an OSGi container (Equinox) and uses Spring DM&apos;s &lt;a href=&quot;http://static.springframework.org/osgi/docs/1.1.0-m2/reference/html/web.html#web:spring-mvc&quot;&gt;Spring MVC support&lt;/a&gt;. The first thing I discovered was that Spring MVC&apos;s annotations weren&apos;t supported in the M1 release. This was apparently caused by a &lt;a href=&quot;http://groups.google.com/group/spring-osgi/browse_thread/thread/cf1fa802f846feac/b0f7483ea63b8f8e?lnk=gst#b0f7483ea63b8f8e&quot;&gt;bug &lt;/a&gt; in Spring 2.5.3 and not Spring DM. Since Spring DM 1.1.0 M2 was released with Spring 2.5.4 &lt;a href=&quot;http://www.springframework.org/node/646&quot;&gt;today&lt;/a&gt;, I believe this is fixed now.
&lt;/p&gt;
&lt;p&gt;The story below is about my experience getting a Spring MVC application up and running in Equinox 3.2.2, Jetty 6.1.9 and Spring DM 1.1.0 M2 SNAPSHOT (from last week). If you want to read more about why Spring MVC + OSGi is cool, see Costin Leau&apos;s &lt;a href=&quot;http://blog.springsource.com/main/2008/04/29/web-applications-and-osgi/&quot;&gt;Web Applications and OSGi&lt;/a&gt; article.&lt;/p&gt;
&lt;p&gt;To get a simple &quot;Hello World&quot; Spring MVC application working in OSGi is pretty easy. The hard part is setting up a container with all the Spring and Jetty bundles installed and started. I imagine &lt;a href=&quot;http://www.infoq.com/news/2008/04/springsource-app-platform&quot;&gt;SSAP&lt;/a&gt; might solve this. Luckily for me, this was done by another member of my team.&lt;/p&gt;
&lt;p&gt;After you&apos;ve done this, it&apos;s simply a matter of creating a MANIFEST.MF for your WAR that contains the proper information for OSGi to recognize. Below is the one that I used when I first tried to get my application working. 
&lt;/p&gt;
&lt;pre&gt;
Manifest-Version: 1
Bundle-ManifestVersion: 2
Spring-DM-Version: 1.1.0-m2-SNAPSHOT
Spring-Version: 2.5.2
Bundle-Name: Simple OSGi War
Bundle-SymbolicName: myapp
Bundle-Classpath: .,WEB-INF/classes,WEB-INF/lib/freemarker-2.3.12.jar,
 WEB-INF/lib/sitemesh-2.3.jar,WEB-INF/lib/urlrewritefilter-3.0.4.jar,
 WEB-INF/lib/spring-beans-2.5.2.jar,WEB-INF/lib/spring-context-2.5.2.jar,
 WEB-INF/lib/spring-context-support-2.5.2.jar,WEB-INF/lib/spring-core-2.5.2.jar,
 WEB-INF/lib/spring-web-2.5.2.jar,WEB-INF/lib/spring-webmvc-2.5.2.jar 
Import-Package: javax.servlet,javax.servlet.http,javax.servlet.resources,javax.swing.tree,
 javax.naming,org.w3c.dom,org.apache.commons.logging,javax.xml.parsers;resolution:=optional,
 org.xml.sax;resolution:=optional,org.xml.sax.helpers;resolution:=optional
&lt;/pre&gt;
&lt;p class=&quot;smokey&quot;&gt;Ideally, you could generate this MANIFEST.MF using the &lt;a href=&quot;http://felix.apache.org/site/maven-bundle-plugin-bnd.html&quot;&gt;maven-bundle-plugin&lt;/a&gt;. However, it &lt;a href=&quot;http://www.nabble.com/Is-it-possible-to-use-the-maven-bundle-plugin-on-a-WAR-project--ts16763483.html&quot;&gt;doesn&apos;t support WARs&lt;/a&gt; in its 1.4.0 release.&lt;/p&gt;

&lt;p&gt;You can see this is an application that uses Spring MVC, FreeMarker, SiteMesh and the URLRewriteFilter. You should be able to &lt;a href=&quot;http://static.raibledesigns.com/downloads/myapp-noosgi.zip&quot;&gt;download it&lt;/a&gt;, unzip it, run &quot;mvn package&quot; and install it into Equinox using &quot;install file://&amp;lt;path to war&gt;&quot;.&lt;/p&gt;
&lt;p&gt;That&apos;s all fine and dandy, but doesn&apos;t give you any benefits of OSGi. This setup works great until you try to import OSGi services using a context file with an &lt;strong&gt;&amp;lt;osgi:reference&gt;&lt;/strong&gt; element. After adding such a reference, it&apos;s likely you&apos;ll get the following error:
&lt;/p&gt;
&lt;pre&gt;
SEVERE: Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace [http://www.springframework.org/schema/osgi]
&lt;/pre&gt;
&lt;p&gt;To fix this, add the following to your web.xml (if you&apos;re using ContextLoaderListener, as an &amp;lt;init-parameter&amp;gt; on DispatcherServlet if you&apos;re not):&lt;/p&gt;
&lt;pre&gt;
  &amp;lt;context-param&amp;gt;
    &amp;lt;param-name&amp;gt;contextClass&amp;lt;/param-name&amp;gt;
    &amp;lt;param-value&amp;gt;org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext&amp;lt;/param-value&amp;gt;
  &amp;lt;/context-param&amp;gt;
&lt;/pre&gt;
&lt;p&gt;After doing this, you might get the following error on startup:&lt;/p&gt;
&lt;pre&gt;
SEVERE: Context initialization failed
org.springframework.context.ApplicationContextException: Custom
context class [org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext]
is not of type [org.springframework.web.context.ConfigurableWebApplicationContext] 
&lt;/pre&gt;
&lt;p&gt;To fix this, I change from referencing the Spring JARs in WEB-INF/lib
to importing the packages for Spring (which were already installed in my
Equinox container).
&lt;/p&gt;
&lt;pre&gt;
Bundle-Classpath: .,WEB-INF/classes,WEB-INF/lib/freemarker-2.3.12.jar,
 WEB-INF/lib/sitemesh-2.3.jar,WEB-INF/lib/urlrewritefilter-3.0.4.jar
Import-Package:
javax.servlet,javax.servlet.http,javax.servlet.resources,javax.swing.tree,
 javax.naming,org.w3c.dom,org.apache.commons.logging,javax.xml.parsers;resolution:=optional,
 org.xml.sax;resolution:=optional,org.xml.sax.helpers;resolution:=optional,
 org.springframework.osgi.web.context.support,
 org.springframework.context.support,
 org.springframework.web.context,
 org.springframework.web.context.support,
 org.springframework.web.servlet,
 org.springframework.web.servlet.mvc,
 org.springframework.web.servlet.mvc.support,
 org.springframework.web.servlet.view,
 org.springframework.ui,
 org.springframework.web.servlet.view.freemarker 
&lt;/pre&gt;
&lt;p&gt;After rebuilding my WAR and reloading the bundle in Equinox, I was confronted with the following error message:&lt;/p&gt;
&lt;pre&gt;
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name &apos;freemarkerConfig&apos; defined in ServletContext
resource [/WEB-INF/myapp-servlet.xml]: Instantiation of bean failed;
nested exception is java.lang.NoClassDefFoundError:
freemarker/cache/TemplateLoader
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:851) 
&lt;/pre&gt;
&lt;p&gt;As far as I can tell, this is because the version of Spring MVC installed in Equinox
cannot resolve the FreeMarker JAR in my WEB-INF/lib directory.
&lt;/p&gt;
&lt;p&gt;To prove I wasn&apos;t going insane, I commented out my &quot;freemarkerConfig&quot; and &quot;viewResolver&quot; beans in myapp-servlet.xml and changed to a regular ol&apos; InternalResourceViewResolver:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;bean id=&quot;viewResolver&quot; class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;&amp;gt;
    &amp;lt;property name=&quot;prefix&quot; value=&quot;/&quot;/&amp;gt;
    &amp;lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot;/&amp;gt;
&amp;lt;/bean&amp;gt;
&lt;/pre&gt;
&lt;p&gt;This worked and I was able to successfully see &quot;Hello World&quot; from a JSP in my browser. FreeMarker/SiteMesh worked too, but FreeMarker didn&apos;t work as a View for Spring MVC.
&lt;/p&gt;
&lt;p&gt;
To attempt to solve this, I create a &lt;a href=&quot;http://static.raibledesigns.com/downloads/freemarker-2.3.12-bundle.jar&quot;&gt;bundle for FreeMarker&lt;/a&gt; using &quot;java -jar
bnd-0.0.249.jar wrap freemarker-2.3.12.jar&quot; and installed it in Equinox.
I then change my MANIFEST.MF to use FreeMarker imports instead of
referencing the JAR in WEB-INF/lib.
&lt;/p&gt;
&lt;pre&gt;
Bundle-Classpath:
.,WEB-INF/classes,WEB-INF/lib/sitemesh-2.3.jar,WEB-INF/lib/urlrewritefilter-3.0.4.jar
Import-Package:
javax.servlet,javax.servlet.http,javax.servlet.resources,javax.swing.tree,
 javax.naming,org.w3c.dom,org.apache.commons.logging,javax.xml.parsers;resolution:=optional,
 org.xml.sax;resolution:=optional,org.xml.sax.helpers;resolution:=optional,
 org.springframework.osgi.web.context.support,
 org.springframework.context.support,
 org.springframework.web.context,
 org.springframework.web.context.support,
 org.springframework.web.servlet,
 org.springframework.web.servlet.mvc,
 org.springframework.web.servlet.mvc.support,
 org.springframework.web.servlet.view,
 org.springframework.ui,
 org.springframework.web.servlet.view.freemarker,
 freemarker.cache,freemarker.core,freemarker.template,freemarker.ext.servlet 
&lt;/pre&gt;
&lt;p&gt;Unfortunately, this still doesn&apos;t work and I still haven&apos;t been able to get FreeMarker to work with Spring MVC in OSGi. The crazy thing is I actually solved this at one point a week ago. Shortly after, I rebuilt Equinox from scratch and I&apos;m been banging my head against the wall over this issue ever since. Last week, I entered an &lt;a href=&quot;http://jira.springframework.org/browse/OSGI-461&quot;&gt;issue in Spring&apos;s JIRA&lt;/a&gt;, but thought I&apos;d fixed it a few hours later.
&lt;/p&gt;
&lt;p&gt;
I&apos;ve uploaded the final project that&apos;s not working to the following URL:&lt;/p&gt;
&lt;p style=&quot;padding-left: 15px&quot;&gt;&lt;a href=&quot;http://static.raibledesigns.com/downloads/myapp-osgi.zip&quot;&gt;http://static.raibledesigns.com/downloads/myapp-osgi.zip&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;If you&apos;d like to see this project work with Spring MVC + JSP, simply modify myapp-servlet.xml to remove the FreeMarker references and use the InternalResourceViewResolver instead.&lt;/p&gt;
&lt;p&gt;I hope Spring DM + Spring MVC supports more than just JSP as a view technology. I hope I can&apos;t get FreeMarker working because of some oversight on my part. 
If you have a Spring DM + Spring MVC application working with Velocity or FreeMarker, I&apos;d love to hear about it.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/the_web_framework_smackdown_questions</id>
        <title type="html">The Web Framework Smackdown Questions</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/the_web_framework_smackdown_questions"/>
        <published>2008-03-28T10:04:02-06:00</published>
        <updated>2008-03-31T19:18:06-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <category term="conference" scheme="http://roller.apache.org/ns/tags/" />
        <category term="smackdown" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">I&apos;m doing my &lt;a href=&quot;http://raibledesigns.com/rd/entry/java_web_framework_smackdown_at&quot;&gt;Web Frameworks Smackdown&lt;/a&gt;  this morning at TheServerSide Conference. A few weeks ago, I asked &lt;strong&gt;What Would You Ask the Web Framework Experts?&lt;/strong&gt; on &lt;a href=&quot;http://java.dzone.com/news/what-would-you-ask-web-framewo&quot;&gt;Javalobby&lt;/a&gt; and &lt;a href=&quot;http://tinyurl.com/2clqqw&quot;&gt;LinkedIn&lt;/a&gt;. Here&apos;s a summary of those questions:&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;What is the overall performance of your framework as it compares to others?&lt;/li&gt;
&lt;li&gt;How does your web framework position themselves in relation to Web Beans?&lt;/li&gt;
&lt;li&gt;How easy is it to create a re-useable component in your framework? Is it as easy as sub-classing an existing component?&lt;/li&gt;
&lt;li&gt;What is the key differentiating characteristic of your framework that makes it better than the rest?&lt;/li&gt;
&lt;li&gt;What do you think about the various scopes introduced by Seam, e.g. conversation vs request or session? If you support these additional scopes, do you also provide some sort of concurrency control?&lt;/li&gt;
&lt;li&gt;Why can&apos;t we, the Java Community, come together and adopt the best application framework and settle the web development subject?&lt;/li&gt;
&lt;li&gt;What are you doing to help with developer productivity?&lt;/li&gt;
&lt;li&gt;2008 is a huge year for the mobile web. How do you help developers build great mobile web applications?&lt;/li&gt;
&lt;li&gt;If you couldn&apos;t use your framework, what would you use and why?&lt;/li&gt;
&lt;li&gt;How do you enable rich Ajax applications?&lt;/li&gt;
&lt;li&gt;Can a developer make a change to source, and hit RELOAD in the browser to see the change? If not, why not? &lt;/li&gt;
&lt;li&gt;What do you think about the whole Flex revolution, and do you think you are competitors to this technology?&lt;/li&gt;
&lt;li&gt;How easy is it to create a module and plug it into a bigger application, complete with configuration, code, and view? &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Of course, there&apos;s many more questions on the aforementioned pages, these are just some that I hope to ask during the panel. Sitting on the panel: Don Brown (Struts 2), Keith Donald (Spring MVC), Ed Burns (JSF), David Geary (GWT), Geert Bevin (RIFE/OpenLaszlo) and Justin Gehtland (Rails). I tried to get Flex and Grails folks, but they&apos;d either left the conference already or are speaking at the same time.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; InfoWorld has some modest coverage of this event in &lt;a href=&quot;http://www.infoworld.com/article/08/03/28/java-webframeworks-debated_1.html&quot;&gt;Web frameworks debated at TheServerSide Java Symposium&lt;/a&gt;.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/the_linkedin_journey_continues</id>
        <title type="html">The LinkedIn Journey Continues</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/the_linkedin_journey_continues"/>
        <published>2008-03-06T08:00:49-07:00</published>
        <updated>2008-03-06T15:02:41-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="grails" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="productivity" scheme="http://roller.apache.org/ns/tags/" />
        <category term="rails" scheme="http://roller.apache.org/ns/tags/" />
        <category term="career" scheme="http://roller.apache.org/ns/tags/" />
        <category term="linkedin" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">As you might know, I&apos;ve spent the last several months working for one of the coolest clients ever: &lt;a href=&quot;http://www.linkedin.com&quot;&gt;LinkedIn&lt;/a&gt;. They hired me back in July 2007 and I was &lt;a href=&quot;http://raibledesigns.com/rd/entry/first_day_at_linkedin&quot;&gt;impressed on day one&lt;/a&gt;. I was originally hired to help them evaluate open source Java web frameworks and try to determine if moving from their proprietary one to an open source one would help improve developer productivity.&lt;/p&gt;
&lt;p&gt;After looking at all the options, I recommended we look at Struts 2 and Spring MVC - primarily because they seemed to be the best frameworks for a LinkedIn-type of application. Another Engineer and I prototyped with Struts 2 for about 6 weeks and came up with a prototype that worked quite well. While our mission was successful, we found a &lt;a href=&quot;http://raibledesigns.com/rd/entry/does_struts_2_suck&quot;&gt;couple&lt;/a&gt; &lt;a href=&quot;http://raibledesigns.com/rd/entry/proposed_tomcat_enhancement_add_flag&quot;&gt;issues&lt;/a&gt; with Struts 2 and standard JSP that might actually hurt developer productivity more than it helped.&lt;/p&gt;
&lt;p&gt;Following this project, I worked on the New Homepage Team, which is &lt;a href=&quot;http://blog.linkedin.com/blog/2008/02/the-new-look-of.html&quot;&gt;now visible&lt;/a&gt; to everyone that logs onto LinkedIn. My role was minimal, but it was still a very fun project to work on. You know those widgets in the right panel? I did the initial UI and backend integration for those. All the business logic, Ajax/JavaScript, CSS, and optimization was done by other folks on the team. Shortly after this project went live in November, I started prototyping again with Spring MVC + JSP.&lt;/p&gt;
&lt;p&gt;The reason I was asked to prototype with Spring MVC was because they were using Spring on the backend, Spring MVC in a couple other projects, and a new project was being kicked off that used Grails. Rather than add &lt;em&gt;another&lt;/em&gt; framework (Struts 2) to the mix, they wanted to see if they could suppress any further framework proliferation.&lt;/p&gt;
&lt;p&gt;After a month of prototyping with Spring MVC + JSP, my results weren&apos;t as good as Struts 2. With Struts 2, I was able to use OGNL to do all the things their current JSP implementation allows them to do (call methods with arguments, use statics in EL, etc.). With standard JSP, a lot of this wasn&apos;t possible. If it was - it required writing lots of tag libraries and made it more cumbersome for developers to do certain things. At the end of that project, I determined that using FreeMarker might solve these problems. I also determined that neither Struts 2 nor Spring MVC would solve the ultimate problem of developer productivity. Neither framework would allow developers to go from make-a-change-and-deploy, wait-3-minutes-to-see-change-in-browser to make-a-change, save and wait-15-seconds-to-see-change-in-browser.
&lt;/p&gt;
&lt;p&gt;
I recommended that this be the ultimate goal - to get rid of the deployment cycle and to allow minimal turnaround when deploying modified classes. After that problem was solved, it&apos;s true that moving to an open source web framework would likely provide an easier-to-remember API. However, the problem with moving to a new web framework would be that everything used to construct the existing site would suddenly become legacy code.&lt;/p&gt;
&lt;p&gt;In the end, we concluded that the best solution might be to &lt;em&gt;enhance&lt;/em&gt; the existing framework to be more like the available open source options. This would allow existing applications to keep using their code -- and if we enhance properly -- new applications can use a simpler, less verbose API and a templating framework that&apos;s easier to understand. We can make LinkedIn&apos;s version of JSP more like standard JSP while allowing its powerful EL to remain. We can add support for JSP Tag Libraries and Tag Files.&lt;/p&gt;
&lt;p&gt;One of the benefits of moving to an open source web framework is there&apos;s a community, documentation and books that describe the best (or most common) ways to solve problems with the framework. LinkedIn has this, but it&apos;s all in code and no one seems to have a high-level of confidence that the way that they did it is the &quot;best&quot; way. Developers communicate well, but all the knowledge is stuck in their heads and inboxes - there&apos;s no way for new developers to search this knowledge and figure it out on their own without asking somebody.
&lt;/p&gt;
&lt;p&gt;
By adopting an open source web framework, it&apos;s possible to solve part of this problem, but I think it&apos;s still going to exist - where a few engineers know how to use the framework really well (for the specific application) and the rest don&apos;t. We determined that regardless of open source vs. proprietary framework, what was needed was a set of developers that acted as authorities on how to develop web applications at LinkedIn. A UI Frameworks Team if you will. This would be their only job and they would never get pulled from this to work on projects or complete tasks related to LinkedIn&apos;s products. Some developers mentioned that they&apos;d been asking for this for years, and some folks had even been hired for this. However, the formulation of this group has never happened and it&apos;s obvious (now more than ever) that it&apos;d be awesome to have them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The UI Frameworks Team&lt;/strong&gt;&lt;br/&gt;
At the end of 6 months, it seemed my work was done at LinkedIn. I liked the idea of a UI Frameworks Team and recommended they start it with the authors of the existing web framework. They agreed this was a good idea. A few days later, I was pulled into the CTO&apos;s office and he offered me the job. He offered me the challenge of building this team and told me I could do it remotely (from Denver) and hire my own people to help me with it. I gulped as I realized I&apos;d just been offered the opportunity of a lifetime. I knew that while this might not be the best option for LinkedIn, it certainly was an excellent opportunity for me. I said I&apos;d think about it.&lt;/p&gt;
&lt;p&gt;In the meantime, I was given a project which you might&apos;ve read about. They asked me to &lt;a href=&quot;http://raibledesigns.com/rd/entry/migrating_a_rails_app_to&quot;&gt;migrate a Rails application to Grails&lt;/a&gt; and try to determine if &lt;a href=&quot;http://raibledesigns.com/rd/entry/is_there_room_for_both&quot;&gt;they really needed both frameworks&lt;/a&gt;. I spent 2 weeks coming up to speed on both and flew to Mountain View to deliver my conclusion. Here&apos;s an excerpt from an internal blog post I wrote.&lt;/p&gt;
&lt;div class=&quot;smokey&quot; style=&quot;border: 1px solid silver; background: #eee; padding: 10px; margin-bottom: 10px&quot;&gt;
&lt;p style=&quot;margin-top: 0&quot;&gt;As far as I know, Rails has been used at LinkedIn for well over 6 months and Grails has been used for a similar duration. Both projects that&apos;ve used these technologies have enjoyed extreme success. Both projects have been fun for the developers working on them and both have improved the technologies/frameworks they&apos;re using. &lt;/p&gt;

&lt;p&gt;Here&apos;s an interesting quote about the Rails application:&lt;/p&gt;

&lt;blockquote style=&quot;padding: 0px 10px&quot;&gt;
Another app you might want to look at is BumperSticker, our facebook app. Interestingly we heard through joyent that DHH (the creator of Rails) told them that BumperSticker is the biggest rails app in the world (in terms of page views) - we are closing in on 1 billion monthly page views and we have 1 million unique users per day (about 10 million installs on FB). It&apos;s a little trickier to setup in a dev environment since you need to be running on FB, but the code itself is pretty interesting since we&apos;ve iterated on it a bunch of times and are making extensive use of third party libraries such as memcached.&lt;/blockquote&gt;

&lt;p&gt;This quote loosely translates to &quot;We have some Rails Ninjas on staff and we&apos;ve been quite successful in developing with it and making it scale&quot;.&lt;/p&gt;

&lt;p&gt;Both platforms have allowed developers to iterate quickly and turbo-charge their productivity.&lt;/p&gt;

&lt;p&gt;My Conclusion: &lt;b&gt;&lt;em&gt;Allow Both&lt;/em&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;If you have talented developers that can whip out kick-ass code with either platform, pay them and pay them well. Passion is the most important part of any job. If developers are passionate about the application they&apos;re developing and the language they&apos;re using (notice language is secondary) - they can do great things.&lt;/p&gt;

&lt;p&gt;I know this probably isn&apos;t the answer you wanted to hear, but it&apos;s what I believe. I think both frameworks are very similar. I believe the knowledge you gain from learning one framework is transferable to the other. A lot of the things I learned about Rails worked with Grails. Ruby&apos;s syntax is similar to Groovy&apos;s. &lt;/p&gt;

&lt;p style=&quot;margin-bottom: 0&quot;&gt;There&apos;s a natural synergy between these two frameworks. The hard part is figuring out when to use which one.&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;The application that I was asked to port from Rails to Grails? The one that was launched last week - &lt;a href=&quot;http://blog.linkedin.com/blog/2008/02/linkedin-mobile.html&quot;&gt;LinkedIn Mobile&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After doing this research, I stepped up to the plate and accepted the offer to start a UI Frameworks Team and recruited some kick-ass Java Developers I know to be the founding members. Last week, I flew out to Mountain View to do some kickoff meetings and start getting the infrastructure in place so we can document, support and release code like a well-oiled open source project. There&apos;s nothing saying we won&apos;t use an open source web framework as the underlying engine, but I think this should be an excellent chance to see the power of open source governance and development style in a corporate environment.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Director of Engineering, Core Experience&lt;/strong&gt;&lt;br/&gt;
I should mention one last thing. If you&apos;re an experienced Java Developer/Architect with a passion and deep knowledge of UI development (JavaScript, CSS, HTML), we&apos;ve got a &lt;a href=&quot;http://www.linkedin.com/jobs?viewJob=&amp;amp;jobId=483817&amp;amp;fromSearch=39&amp;amp;sik=1204111006804&quot;&gt;Director of Engineering, Core Experience&lt;/a&gt; position with your name on it. I might even get to interview you if you apply for this job. Furthermore, whoever gets hired will likely work very closely with my team. What&apos;s not to like about that!? &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/all_web_frameworks_should_support</id>
        <title type="html">All Java web frameworks should support hot deploy of a single class</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/all_web_frameworks_should_support"/>
        <published>2008-01-24T15:11:18-07:00</published>
        <updated>2012-11-08T14:35:47-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="seam" scheme="http://roller.apache.org/ns/tags/" />
        <category term="stripes" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <category term="tapestry" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">In &lt;a href=&quot;http://www.nabble.com/Anyone-else-using-Groovy--td15064401.html&quot;&gt;Anyone else using Groovy?&lt;/a&gt;, Tim Fennell (inventor of &lt;a href=&quot;http://stripesframework.org&quot;&gt;Stripes&lt;/a&gt;) raves at how much he likes Groovy now that it supports Java 5 features. He writes that Groovy might offer a solution to make development with Stripes faster:
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
The other thing I&apos;ve been wondering about is that if there were  
enough demand for it we could try adding &quot;improved&quot; groovy support.  
E.g. throw your groovy actions under WEB-INF and we&apos;ll use groovy&apos;s  
built in stuff to do auto-reloading etc. &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.linkedin.com/pub/1/12/415&quot;&gt;Gregg Bolinger&lt;/a&gt; responds with an excellent idea:&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
It would be really cool if Stripes could automatically discover and load
changes to action beans (including new ones) without the entire app
restarting, regardless of what the action bean is written in. But I
realize that is a pretty tall order. :) &lt;/p&gt;
&lt;p&gt;I agree that it might be a tall order, but I don&apos;t think it&apos;s impossible. In fact, I think &lt;strong&gt;all Java-based web frameworks should support hot deploy of a single class&lt;/strong&gt;. We shouldn&apos;t have to buy &lt;a href=&quot;http://www.zeroturnaround.com/javarebel/&quot;&gt;JavaRebel&lt;/a&gt; to do this. It should be mandatory. 
&lt;/p&gt;
&lt;p&gt;
When an application reaches a certain size, the startup time can get pretty lengthy. This is lost development time. Furthermore, if any part of the development cycle takes longer than 15 seconds, there&apos;s a good chance developers will do something else (check their e-mail, move onto another task, etc.). Multi-tasking may be a good skill to have, but it&apos;s a horrible way to be productive. 
&lt;/p&gt;
&lt;p&gt;
Of the frameworks I&apos;m familiar with, only Tapestry 5 and Seam support reloading single classes without restarting the whole application. Why can&apos;t the other frameworks &quot;borrow&quot; Tapestry 5&apos;s code? Maybe someone should just buy &lt;a href=&quot;http://www.zeroturnaround.com/&quot;&gt;ZeroTurnaround&lt;/a&gt; and give away JavaRebel for free.
&lt;/p&gt;
&lt;p&gt;If I had one wish for 2008, it would be for all Java web frameworks to support this feature. Pretty Please?</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/migrating_a_rails_app_to</id>
        <title type="html">Migrating a Rails app to Grails</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/migrating_a_rails_app_to"/>
        <published>2008-01-22T09:37:49-07:00</published>
        <updated>2008-01-22T16:37:49-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="grails" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <category term="rails" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">There&apos;s an interesting trend I&apos;ve seen happening at companies over the last year. More and more, they&apos;re experimenting with Rails and/or Grails for both prototyping and real applications. I think this is an excellent use for these frameworks as they both are very productive. The reasons for their productivity is simple: &lt;a href=&quot;http://www.theserverside.com/news/thread.tss?thread_id=35538&quot;&gt;zero turnaround&lt;/a&gt; and less code.&lt;/p&gt;
&lt;p&gt;For a Java-based company that&apos;s built their bread and butter applications on Java and been successful with it, both frameworks can be disruptive. Bread and butter applications tend to be large and somewhat difficult to maintain. In my experience, the biggest maintenance headache is &lt;em&gt;not&lt;/em&gt; writing code or fixing bugs, it&apos;s the turnaround time required to make changes, run tests and build the application to test in your browser. Since Rails and Grails eliminate the turnaround, it&apos;s only natural for developers at companies with a lengthy build process to love their increased productivity.
&lt;/p&gt;
&lt;p&gt;Over the next couple weeks, I&apos;m going to do some experimenting with porting a Rails application to Grails. Why? Because I think companies are going to have a difficult time choosing between these two frameworks for rapid prototyping and (possible) production deployments. While both frameworks are great for prototyping, the last thing most developers want to do is throw away the prototype and develop it with something else. They want to continue to enhance the prototype and eventually put it into production. With Rails and Grails (and many others), it&apos;s possible to build the real application in a matter of weeks, so why shouldn&apos;t it be put into production?&lt;/p&gt;
&lt;p&gt;For most Java-based companies, putting a Rails application into production is unfamiliar territory. However, a Grails application is just a WAR, so they can continue to use all the Java infrastructure they know and love. So for companies with an established, tuned and successful JVM infrastructure, does it really make sense to use Rails over Grails? The only thing I can think of is language reasons - there&apos;s a lot of Ruby fanatics out there.&lt;/p&gt;
&lt;p&gt;So again, the purpose of my experiment is simple: to see if a Grails app can do everything a Rails app can. As for language features and &lt;a href=&quot;http://www.theserverside.com/news/thread.tss?thread_id=48180&quot;&gt;scalability&lt;/a&gt;, I&apos;m not really concerned with that right now. I&apos;m not looking to prove that either framework should be used for all web applications - just certain types.&lt;/p&gt;
&lt;p&gt;
Has anyone out there ported a Rails application to Grails? If so, are there any gotchas I should watch out for?
&lt;/p&gt;
&lt;p class=&quot;smokey&quot;&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; I realize that Rails can be deployed on the JVM with JRuby. However, I think many companies have existing Java-based tools (logging, JMX, Spring backends, etc.) that more easily integrate with Grails than Rails. I could be wrong.&lt;/p&gt;
&lt;p&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/a_positive_wicket_experience</id>
        <title type="html">A Positive Wicket Experience</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/a_positive_wicket_experience"/>
        <published>2008-01-18T12:37:18-07:00</published>
        <updated>2008-01-18T19:45:12-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="wicket" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Julian Sinai &lt;a href=&quot;http://www.nabble.com/Our-experience-with-Wicket-to14938030.html#a14938030&quot;&gt;recently released&lt;/a&gt; the first version of his company&apos;s product based on Wicket. In &lt;a href=&quot;http://javathoughts.capesugarbird.com/2008/01/year-of-wicket.html&quot;&gt;A Year of Wicket&lt;/a&gt;, he describes the experience (emphasis mine).&lt;/p&gt;
&lt;p class=&quot;smokey&quot;&gt;
I&apos;ve been working with Wicket for almost a year. We&apos;ve just released our first product that uses Wicket for the user interface, and so it seems like a good time to take stock. Unfortunately, it&apos;s not a public site, it&apos;s an installable enterprise product, so I can&apos;t show it to you. If you don&apos;t want to read further, here&apos;s the executive summary: Wicket rocks!
&lt;br/&gt;&lt;br/&gt;
I was hired as the GUI Architect for this project. I came to it with many years of GUI experience, mostly using Swing, but without a lot of web development experience.
&lt;br/&gt;&lt;br/&gt;
Because of my Java and Swing background, I was drawn to Wicket. It maps fairly closely to the Swing model of development. So does GWT, but when I evaluated it, it seemed so different from other J2EE frameworks that I felt it was a step too far. No HTML, and no WAR files, for example. This made my colleagues nervous, who were used to Struts and PHP. Me too, as a matter of fact.
&lt;br/&gt;&lt;br/&gt;
I had done some pretty serious prototyping for another project with Tapestry, and there were certain things I liked, like runtime bytecode generation. But the learning curve was pretty steep. At one point I needed to create a custom component, and to do so I needed to learn about engine services and other arcane things that I felt made the process too hard. By contrast, custom components are Wicket&apos;s bread and butter, and they are very easy to build.
&lt;br/&gt;&lt;br/&gt;
I also took a close look at JSF. It seemed overly complex to me, and not much of a departure from the Struts era. It came across as a technology designed by committee, with the combination of several complementary libraries required to get the job done, and there are still too many configuration files.
&lt;br/&gt;&lt;br/&gt;
So we decided to use Wicket. 
&lt;br/&gt;&lt;br/&gt;...&lt;br/&gt;&lt;br/&gt;
One of Wicket&apos;s advantages is the strict separation of design from behavior, that is, HTML from code. While &lt;strong&gt;we did not have a web designer on the team who built the HTML&lt;/strong&gt; (the developers did this), and therefore didn&apos;t get any mileage from the separation in that sense, we definitely gained from having all the behavior in Java code, because it gave us all the power of refactoring, compile-time error checking, and maximum reusability.
[&lt;a href=&quot;http://javathoughts.capesugarbird.com/2008/01/year-of-wicket.html&quot;&gt;Read More&lt;/a&gt;]
&lt;/p&gt;
&lt;p&gt;
I really like how Julian talks about reasons they didn&apos;t choose other frameworks. Beyond that, I think it&apos;s important to note that Wicket was a perfect fit for someone with heavy Java and Swing experience. I still think Wicket is a little verbose for Web developers that program in Java (me), but it&apos;s unlikely there&apos;s very many of those. Building a form in Java seems so much more cumbersome than building it with HTML - but that&apos;s probably just me.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/rest_and_seam_talks_at</id>
        <title type="html">REST and Seam Talks at Denver&apos;s JUG</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/rest_and_seam_talks_at"/>
        <published>2008-01-09T20:59:45-07:00</published>
        <updated>2008-01-11T21:08:48-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="rest" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="seam" scheme="http://roller.apache.org/ns/tags/" />
        <category term="djug" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">After a long hiatus, I decided to attend the &lt;a href=&quot;http://www.denverjug.org&quot;&gt;Denver JUG&lt;/a&gt; meeting this evening. Tonight there&apos;s a couple of interesting talks:
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Give It a REST by &lt;a href=&quot;http://zepheira.com/team/brian/&quot;&gt;Brian Sletten&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Seam by &lt;a href=&quot;http://members.capmac.org/~orb/blog.cgi&quot;&gt;Norman Richards&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&apos;ll do my best to live-blog these sessions, so hopefully you can read along and learn everything I do. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Give It a REST by Brian Sletten&lt;/strong&gt;&lt;br/&gt;
This talk isn&apos;t an implementation talk, it&apos;s more of a motivational talk. Brian is trying to answer the question &quot;Why do we care?&quot;. We care because we have a lot of WS-Dissatisfaction. &quot;Conventional&quot; Web Services are often:&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;too difficult for non-trivial tasks (real complexity)&lt;/li&gt;
&lt;li&gt;too complex for trivial tasks (artificial complexity)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
RPC-based Web Services are mythically interoperable and time/process coupled in painful ways. SOAP has largely become popular because of marketing dollars behind in. REST is more like the &quot;hippy&quot; way that has grass-roots support with no corporate sponsor.&lt;/p&gt;
&lt;p&gt;What makes SOAP difficult? It&apos;s remote procedure calls and its tunneled using existing application protocols (HTTP). Furthermore, there are no nouns (mappings to business terms), only handlers. There are no semantics, only handlers. When you tie yourself to a contract/WSDL, you can have anything back that you want - so as long as its simple XML. This isn&apos;t entirely true because a lot of things can be shoved into XML (Word documents that are Base64 encoded).&lt;/p&gt;
&lt;p&gt;The main problem with SOAP is it solves a problem that most people don&apos;t have. It solves an edge case, rather than the main problem.&lt;/p&gt;
&lt;p&gt;Many people say &quot;SOAP is secure and REST isn&apos;t&quot;.&lt;/p&gt;
&lt;p&gt;Why do people believe this? It&apos;s because of the long list of SOAP-related security acronyms: XML Encryption, XML Signature, XKMS, SAML, XACML, WS-Security, WS-Trust, XrML. Even if you&apos;re using these in your system, there&apos;s no proof that your implementation is secure. REST is what we all use on the web with online shopping, etc. We don&apos;t seem to have a problem with the security we use everyday on the web, do we?&lt;/p&gt;
&lt;p&gt;SAO is an architectural style promoting loose coupling among software participants. Sompanies have rigid definitions of what constitutes a SOA. Many believe that SOAP is an essential piece, but it&apos;s not. SOAP 1.2 and Doc Lit are improvements, but are they necessary? Interestingly, 85% of Amazon&apos;s users chose REST over SOAP when given the choice.&lt;/p&gt;
&lt;p&gt;What is REST? The acronym stands for &lt;strong&gt;RE&lt;/strong&gt;presentational &lt;strong&gt;S&lt;/strong&gt;tate &lt;strong&gt;T&lt;/strong&gt;ransfer. It&apos;s an architectural style based on certain constraints designed to elicit properties of scalability and extensibility. It&apos;s an idealized notion of how the early web should work and helped drive the way it eventually did work. It&apos;s more than just URLs!&lt;/p&gt;
&lt;p&gt;Resource-Oriented Computing focuses on information spaces, not code or objects. It focuses on logical connections and reduces complexity by separating actions from nouns. In the history of the web, we started with URLs that pointed to documents. Eventually, these documents became dynamic and were generated on-the-fly.&lt;/p&gt;
&lt;p&gt;URLs are locations on the web that are horrible names because they change so much. URIs are good names that have no way of being resolved. Fundamentally, REST is a separation of the parts of the system: Nouns, Verbs and Representation. A Resource (in a REST architecture) can be a file, a service or a concept. It can also have different representations. Resources are named with Resource Identifiers. It&apos;s simply the means of naming a resource. It&apos;s a standard syntax that allows various schemes. Often known as URIs (or IRIs). It&apos;s orthogonal to satisfying the reference and it&apos;s one of the missing pieces of &quot;normal&quot; web services.&lt;/p&gt;
&lt;p&gt;Examples of Representation include 1) a particular dereferencing of a Resource Identifier to a Resource at a particular time, 2) a byte-stream tagged with metadata or 3) it could change based on request or processing/display capabilities of the client (Firefox vs. WAP). &lt;/p&gt;
&lt;p&gt;REST&apos;s verbs are design decisions to minimize the the complexity of implementing a system. GET retrieves a resource and always returns the exact same result. It doesn&apos;t change anything in the backend system. Because of this, it allows for easier layering of your system - particularly when you introduce caching for GETs. POST is used to create (or update) a Resource. It does not require a &quot;known URI&quot; and it supports the append operation. PUT creates (or updates) a Resource, but requires a &quot;known URI&quot; and also supports an overwrite operation. Lastly, there is DELETE, which removes a Resource. This is not supported in modern browsers. Just because browsers don&apos;t support them doesn&apos;t mean you can&apos;t implement them in your applications.&lt;/p&gt;
&lt;p&gt;REST&apos;s concepts were developed by &lt;a href=&quot;http://en.wikipedia.org/wiki/Roy_Fielding&quot;&gt;Roy Fielding&lt;/a&gt; in his &lt;a href=&quot;http://tinyurl.com/cvamh&quot;&gt;thesis&lt;/a&gt;. He was trying to create a system that had the following architectural properties: performance, scalability, generality, simplicity and modifiability. REST allows us to create true client-server applications. To satisfy scalability requirements, REST is stateless. All parameters travel with the request and no session information is maintained on the server. This improves scalability through load-balancing and allows visibility of intermediary processors.&lt;/p&gt;
&lt;p&gt;One of the first things that becomes a bottleneck in enterprise systems is the database. This works fine if you like paying Oracle. By using REST and HTTP concepts, it&apos;s easy to take advantage of a cache. This allows replication of an external data set where it&apos;s too large to copy locally. REST allows you to create Layered Systems that allow you to have managed dependencies between layers. Having a RESTful architecture allows you to swap out the backend without changing the front-end and vise-versa.&lt;/p&gt;
&lt;p&gt;Now Brian is going to do some demos using &lt;a href=&quot;http://1060.org/&quot;&gt;NetKernel&lt;/a&gt;. He recommends using HTML documents to describe services. The beauty of developing a RESTful system is there&apos;s nothing preventing you from appending ?wsdl to your URLs to return SOAP.&lt;/p&gt;
&lt;p&gt;Invoking functionality using web-friendly techniques is a very nice way to build web applications.&lt;/p&gt;
&lt;p&gt;What is controversial in REST? &lt;a href=&quot;http://www.w3.org/DesignIssues/Axioms.html&quot;&gt;When you are not dereferencing you should not look at the contents of the URI string to gain other information.&lt;/a&gt;. However, if you structure your URLs in your application in a hierarchical manner, people &lt;em&gt;will&lt;/em&gt; be able to use URIs in this way.&lt;/p&gt;
&lt;p&gt;What isn&apos;t controversial? No one believes you should rely on sessions or other state at the application level. They also believe using nouns, not verbs is an excellent idea.&lt;/p&gt;
&lt;hr/&gt;
&lt;p&gt;&lt;strong&gt;Seam by Norman Richards&lt;/strong&gt;&lt;br/&gt;
Seam isn&apos;t just a web framework, it&apos;s an integration technology for building applications for the web. It&apos;s a technology that takes your persistence and web technologies and unifies them so you have a simpler view of your system. 
&lt;/p&gt;
&lt;p&gt;
First of all, what is Seam?
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;It&apos;s a unified component and event model - you access all your components the same way&lt;/li&gt;
&lt;li&gt;It has a declarative state with a rich context model&lt;/li&gt;
&lt;li&gt;It provides deep integration with minimal glue code&lt;/li&gt;
&lt;li&gt;It minimizes configuration, prefers annotations to XML&lt;/li&gt;
&lt;li&gt;It allows a freedom of architectures and technologies&lt;/li&gt;
&lt;li&gt;It also allows testing of components in context&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With Seam, you have a number of technology choices to make. The first is which business component model you want to use (EJB 3 vs. POJO). You might choose EJB 3 if you want more clustering capabilities. For persistence, you can use Hibernate or any JPA implementation. Norman recommends using JPA if possible. You also have a choice of languages: Java or Groovy (and possibly Scala in the future). Seam gives you a choice of web frameworks. All the examples today will use JSF, but there&apos;s also support for GWT and 2.1 will have support for Wicket. Also, there&apos;s some non-committers developing support for Flex. Norman believes component-based web frameworks are the best way to develop web applications. While I hear this from a lot of &lt;span style=&quot;text-decoration: line-through&quot;&gt;folks&lt;/span&gt; component-based framework authors, it seems ironic that the &quot;best&quot; way to develop webapps is not the most popular way (PHP, Struts, Rails).
&lt;/p&gt;
&lt;p class=&quot;smokey&quot;&gt;I think it&apos;s ironic that there&apos;s a REST (no state) and a Seam (it&apos;s all about state) talk in the same night. I&apos;m tempted to ask why a stateful architecture is better than a REST one, but I&apos;m not really that interested in the answer. I think your architecture should be determined by the needs of your application, rather than choosing the architecture and then implementing an application with it.&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;In addition to choices, Seam gives you a number of tools: CRUD generation, Eclipse and NetBeans support and full IDE support in JBoss Tools / JBoss Developer Studio.&lt;/p&gt;
&lt;p&gt;Now Norman is doing a demo - starting by creating a new Seam Web Project in Eclipse. He mentions that he&apos;s skipped a number of steps: downloading and installing Seam, downloading and installing JBoss and configuring your Seam installation and database in Eclipse. He has two projects in Eclipse - apparently the New Project wizard creates two - one for the application and one for testing. It&apos;s strange that the tests don&apos;t go in the actual project. The directory structure has &lt;code&gt;src/action&lt;/code&gt; and &lt;code&gt;src/model&lt;/code&gt; for your Seam components. After doing some simple CRUD, Norman starts JBoss and looks at the master/detail screens it generates.
&lt;/p&gt;
&lt;p&gt;To make a Java class a Seam component, you usually only have to add a @Name annotation to the class. While trying to show us how the Authenticator/login works, Norman tried to open components.xml. Unfortunately, this crashed Eclipse and 30 seconds later - following a bevy of &quot;file does not exist&quot; errors, we&apos;re back in action. To inject dependencies in a Seam environment, you use the @In annotation. In the example class, here&apos;s what the code looks like:
&lt;/p&gt;
&lt;pre&gt;
try {
  currentUser = (Person) entityManager.createQuery(&quot;select p from Person p where&quot; + 
       &quot; p.email = #{identity.username} and p.password=#{identity.password}&quot;).getSingleResult();
} catch (NoSuchEntityException e) {
  currentUser = null;
}
&lt;/pre&gt;
&lt;p&gt;This example appears to encourage title coupling with the data layer, rather than loose coupling (i.e. a DAO layer). I&apos;m sure Seam doesn&apos;t prevent you from developing a more loosely coupled application.
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Bug Alert:&lt;/strong&gt; The &amp;lt;h:messages&gt; tag looks like it always has an &amp;lt;li&amp;gt; - even when there&apos;s only one message. Struts 2 has the same issue with its &amp;lt;s:errors&amp;gt; tag. It&apos;s disappointing that so many Java framework developers don&apos;t have more attention to HTML details.&lt;/p&gt;
&lt;p&gt;Probably the coolest part of Norman&apos;s demo is how Eclipse auto-synchronizes with JBoss so he never has to start/stop anything when he changes Facelets pages or Java classes. Of course, hot deploy should be possible with any web application if you&apos;re using Eclipse Web Tools effectively.&lt;/p&gt;
&lt;p class=&quot;smokey&quot;&gt;I do believe all-in-one starter frameworks like Seam, Rails, Grails and AppFuse are excellent. However, I also believe they&apos;re solving a problem that only 10% of companies have. Most companies don&apos;t have the ability to start applications from scratch - unless they&apos;re a startup. Most companies have an existing infrastructure in place for the backend and they simply need a better web framework to slap a pretty face on it. I don&apos;t know the best solution for this, but it seems like a logical choice to RESTify the backend (possibly with a web framework) and then use a modern web framework for the front-end. IMHO, the best web frameworks for a RESTified backend are &lt;a href=&quot;http://www.adobe.com/products/flex/&quot;&gt;Flex&lt;/a&gt;, &lt;a href=&quot;http://code.google.com/webtoolkit/&quot;&gt;GWT&lt;/a&gt; and &lt;a href=&quot;http://www.appcelerator.org&quot;&gt;Appcelerator&lt;/a&gt;. If nothing else, these appear to be the most hyped for 2008.&lt;/p&gt;
&lt;p&gt;Many of the enhancements that Seam has added to the Java web programming model are being pushed back into the &lt;a href=&quot;http://jcp.org/en/jsr/detail?id=299&quot;&gt;Web Beans JSR&lt;/a&gt;. With Seam, &lt;em&gt;injection&lt;/em&gt; is bi-directional (input and output), is continuous during application invocation and dis-injected after action is done. The whole purpose of this is to let Seam handle the state of your application. By not worrying about storing/maintaining state, you as a developer can concentrate on business logic more and get your applications done faster.
&lt;/p&gt;
&lt;p&gt;At this point, Norman started talking about Seam&apos;s events and how you can use them. Unfortunately, my battery ran out and I drifted off to do some other stuff. I&apos;m sure Seam&apos;s Event Model is pretty cool, I just missed it.
</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/spring_mvc_jstlview_and_exposecontextbeansasattributes</id>
        <title type="html">Spring MVC, JstlView and exposeContextBeansAsAttributes</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/spring_mvc_jstlview_and_exposecontextbeansasattributes"/>
        <published>2007-12-05T18:34:41-07:00</published>
        <updated>2007-12-06T01:35:39-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="jstl" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Did you know that Spring MVC&apos;s &lt;a href=&quot;http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/web/servlet/view/JstlView.html&quot;&gt;JstlView &lt;/a&gt; has a &lt;strong&gt;exposeContextBeansAsAttributes&lt;/strong&gt; property you can use to expose all your Spring beans to JSTL? I didn&apos;t. To configure it, you configure your viewResolver as follows:
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;bean id=&quot;viewResolver&quot; 
    class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;&amp;gt;
    &amp;lt;property name=&quot;viewClass&quot; value=&quot;org.springframework.web.servlet.view.JstlView&quot;/&amp;gt;
    &amp;lt;property name=&quot;exposeContextBeansAsAttributes&quot; value=&quot;true&quot;/&amp;gt;
    &amp;lt;property name=&quot;prefix&quot; value=&quot;/&quot;/&amp;gt;
    &amp;lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot;/&amp;gt;
&amp;lt;/bean&amp;gt;
&lt;/pre&gt;
&lt;p&gt;After doing this, any Spring bean can get referenced in JSTL with:
&lt;/p&gt;
&lt;pre&gt;
${beanId.getterMethodWithoutTheGetPrefix}
&lt;/pre&gt;
&lt;p&gt;If you&apos;re using Spring 2.5a annotations and &amp;lt;context:component-scan&amp;gt;, you&apos;ll need to specify a &quot;value&quot; attribute on your annotations in order to reference them in JSTL. For example:
&lt;/p&gt;
&lt;pre&gt;
@Controller(value = &quot;beanId&quot;)
@RequestMapping(&quot;/foo.html&quot;)
public class MyController extends SimpleFormController

...

@Component(value=&quot;testClass&quot;)
public class TestClass {
&lt;/pre&gt;
&lt;p&gt;Pretty cool stuff. It&apos;d be a lot more useful if you could call methods with parameters. Hopefully &lt;a href=&quot;http://juel.sourceforge.net/&quot;&gt;JUEL&lt;/a&gt; will solve that problem. &lt;a href=&quot;http://www.javaworld.com/javaworld/jw-05-2003/jw-0523-calltag.html&quot;&gt;JSTL&apos;s functions&lt;/a&gt; work, but I&apos;d rather write ${foo.method(&apos;arg&apos;)} rather than ${taglib:callMethod(foo, &apos;method&apos;, &apos;arg&apos;)}.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/go_light_with_apache_struts</id>
        <title type="html">Go Light with Apache Struts 2 and REST by Don Brown</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/go_light_with_apache_struts"/>
        <published>2007-11-15T18:12:58-07:00</published>
        <updated>2007-11-16T01:12:58-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="struts2" scheme="http://roller.apache.org/ns/tags/" />
        <category term="rest" scheme="http://roller.apache.org/ns/tags/" />
        <category term="donbrown" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">After attending &lt;a href=&quot;http://raibledesigns.com/rd/entry/building_scalable_reliable_and_secure&quot;&gt;Dan&apos;s talk on REST&lt;/a&gt;, I stayed in the same room and listened to Don Brown talk about &lt;a href=&quot;http://us.apachecon.com/us2007/program/talk/2058&quot;&gt;Struts 2&apos;s support for building RESTful applications&lt;/a&gt;. Below are my notes from the event.
&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;What is wrong with today&apos;s web applications? You&apos;re using a modern web framework and you&apos;ve cleanly separated your presentation and business logic. The biggest problem in modern web applications is Confusing URLs.
&lt;/p&gt;
&lt;p&gt;
A URL should be a resource indicator - not a method invocation. Often, web applications have little or no caching. People use GET to perform data manipulation and POST may or may not change state (especially with JSF). Another big issue with modern web frameworks is there&apos;s too many abstraction layers that hide HTTP headers and it&apos;s difficult to manipulate them.
&lt;/p&gt;
&lt;p&gt;
Today&apos;s applications are &quot;information silos&quot;. There&apos;s a lot of information in your applications, but it&apos;s all buried in HTML, JavaScript and CSS. There&apos;s no way to get this information out of your application unless you explicitly expose it.
&lt;/p&gt;
&lt;p&gt;
The answer to many of these problem is REST. It&apos;s the Way of the Web. To solve the information silo problem, you can create a single interface that has multiple representation of the same resource. There&apos;s one URI for all types of resources - be it XML, JSON or HTML. How does this work w/o modifying the URL? You modify the URL&apos;s extension.
&lt;/p&gt;
&lt;p&gt;
Struts 2 has a couple of plugins that make developing RESTful services easier. The first is the Codebehind plugin and the 2nd is the REST plugin. Don is doing a demo with the REST plugin and shows that there&apos;s no Struts configuration files needed (no struts.xml and no struts.properties). The only thing that&apos;s necessary is to specify an &quot;actionPackages&quot; init-param on the DispatcherFilter in web.xml. This activates the Codebehind plugin that uses conventions to determine the view template&apos;s path.
&lt;/p&gt;
&lt;p&gt;
In Don&apos;s demo, he&apos;s creating an &quot;OrdersController&quot; that implements ModelDriven. After implementing a setId() method (to set the id from the request parameters), a getModel() method (to return the Order object) and implementing a show() method that returns HttpHeaders, Don starts up his server and shows that http://localhost:8080/order/5 returns an HTML page. Changing the URL to end in /5.json returns JSON, /5.xml returns XML.
&lt;/p&gt;
&lt;pre&gt;
public HttpHeaders create() {
    service.save(order);
    return new DefaultHttpHeaders(&quot;success&quot;).setLocationId(order.getId());
}
&lt;/pre&gt;
&lt;p&gt;
The &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/2691&quot;&gt;Poster Plugin for Firefox&lt;/a&gt; is great when you&apos;re working with REST services. Don used this plugin to show us that it&apos;s possible to post to JSON and get back JSON results. His demo was impressive, especially the fact that there was no XML configuration required for Struts. I also like how the DefaultHttpHeaders class allows you to manipulate headers in a type-safe manner. 
&lt;/p&gt;
&lt;p&gt;
To use the REST plugin, you&apos;ll want to use Struts 2.1. If you&apos;re using Maven, all you need to depend on is struts-rest-plugin. The struts-codebehind-plugin (as well as struts-core) will be pulled in by transitive dependencies.
&lt;/p&gt;
&lt;p&gt;
One disadvantage of REST vs. WS-* is you can&apos;t generate client code from a WSDL. You&apos;ll have to write your client by hand. However, one advantage of REST is there&apos;s already lots of clients - your browser, curl, etc.
&lt;/p&gt;
&lt;p&gt;
The Struts REST Plugin hasn&apos;t been officially released, but hopefully will be in Struts 2.1.1. You can checkout the code from SVN using the URL below. The documentation is located &lt;a href=&quot;http://struts.apache.org/2.x/docs/rest-plugin.html&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p style=&quot;margin-left: 10px&quot;&gt;
&lt;a href=&quot;http://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/rest/&quot;&gt;http://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/rest&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;Great talk Don - and excellent work on the REST plugin for Struts. I can&apos;t wait to try it out.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/choosing_a_jvm_web_framework1</id>
        <title type="html">Choosing a JVM Web Framework: Stories Wanted</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/choosing_a_jvm_web_framework1"/>
        <published>2007-08-22T12:02:58-06:00</published>
        <updated>2007-08-22T18:03:56-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">My &lt;a href=&quot;http://raibledesigns.com/rd/entry/choosing_a_jvm_web_framework&quot;&gt;last post&lt;/a&gt; on choosing a web framework got quite a few comments. Some seemed to like the application categorization technique as a means to narrow the choices. However, others seemed to disagree. So if application categorization is not a good methodology for narrowing the choices, what is?&lt;/p&gt;
&lt;p&gt;I think one of the best ways to figure out a good methodology is to find out what people have done to choose their web framework. I&apos;m looking for stories from developers who have evaluated 2-3+ frameworks for a project. I&apos;d like to come up with 3-5 stories as part of my talk to highlight how some teams have chosen their web framework. What were your important criteria? What made you choose the one you did? Was it a tight race between a few of them? Did industry buzz or application categorization play a part in your decision?&lt;/p&gt;
&lt;p&gt;Please send any stories you&apos;d like to share to &lt;a href=&quot;mailto:matt@raibledesigns.com?subject=How we chose our JVM Web Framework&quot;&gt;matt@raibledesigns.com&lt;/a&gt;. Of course, you can also post your story in the comments - but an e-mail gives it a bit more validity. If you&apos;d like to share your company name, that&apos;d be great, but it&apos;s by no means required. I haven&apos;t decided if I&apos;m going to prevent all cases as anonymous companies or not. If you do send a story, I&apos;ll make sure and ask your permission before I share any of your personal/company information. &lt;em&gt;Thanks!&lt;/em&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/choosing_a_jvm_web_framework</id>
        <title type="html">Choosing a JVM Web Framework</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/choosing_a_jvm_web_framework"/>
        <published>2007-08-07T10:10:05-06:00</published>
        <updated>2007-08-14T12:53:11-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">I plan on rewriting my &quot;Comparing Java Web Frameworks&quot; presentation for this year&apos;s &lt;a href=&quot;http://softwaresummit.com&quot;&gt;Colorado Software Summit&lt;/a&gt;. Rather than &quot;Comparing Java Web Frameworks&quot;, I&apos;m going to make it into more of a &quot;Choosing a JVM Web Framework&quot; presentation. I think this opens it up to more possibilities such as Grails, JRuby on Rails, Flex and GWT. 
&lt;/p&gt;
&lt;p&gt;
One of the things I hope to talk about is choosing the right tool for the job. I think there&apos;s 3 types of web applications you can develop:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Consumer-facing, high-traffic, stateless applications&lt;/li&gt;
&lt;li&gt;Internal, more desktop-like applications that are stateful&lt;/li&gt;
&lt;li&gt;Media-rich applications that require a RIA framework like Flex&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Once you&apos;ve decided on which of these you&apos;re developing, it&apos;s much easier to narrow down the choices:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Struts 2, Spring MVC, Stripes&lt;/li&gt;
&lt;li&gt;JSF, Tapestry, Wicket&lt;/li&gt;
&lt;li&gt;GWT, Flex, OpenLaszlo&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;
I&apos;m not sure if GWT fits in the RIA category. I&apos;m not sure where Rails or Grails fit either. They more closely resemble category #1 than any other, yet there&apos;s a lot of speculation about their scalability. I think if that perception can be changed, they&apos;ll fit into the first category quite well. However, I don&apos;t think they compete with component-based or RIA because they don&apos;t hold state or offer rich-media capabilities. 
&lt;/p&gt;
&lt;p class=&quot;smokey&quot;&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; I find the scalability debate quite interesting. There&apos;s a fair amount of propaganda in Javaland that scalability can be achieved with appservers and clustering tools like Terracotta. If this is true, I&apos;ve yet to read good solid proof of it. Most of the &quot;how to scale&quot; information out there suggests &quot;share nothing&quot; architectures that shard data and applications across several servers. Of course, there&apos;s scalability and then there&apos;s massive scalability. Can appservers and clustering solve massive scalability like Google and Amazon require?&lt;/p&gt;
&lt;p&gt;
The 2nd and 3rd categories have someone of a blurry line, so I&apos;m hoping to figure out how to clarify that. There&apos;s also a lot of other factors that will go into choosing a web framework. What if you&apos;re simply trying to replace a home-grown framework with an open-source one? If you want to keep your backend and all its logic, does it make sense to use something like Seam, Grails, JRuby on Rails or even AppFuse? Probably not - all their wizbang features and CRUD generation doesn&apos;t mean much if all you&apos;re using is the web framework. Also, if your application requires support for non-JavaScript browsers (for 508 compliance), then GWT and JSF can be easily eliminated. I know that there are many claims that JSF doesn&apos;t require JavaScript, but I&apos;ve yet to see a real-world application developed with JSF that &lt;em&gt;expects&lt;/em&gt; JavaScript to be turned off. Progressive enhancement is a requirement by many of my clients these days. 
&lt;/p&gt;
&lt;p&gt;What&apos;s your opinion? How can we make it easier for developers and companies to choose a web framework? Is categorizing application types a good technique?</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/oscon_2007_comparing_java_web</id>
        <title type="html">OSCON 2007: Comparing Java Web Frameworks</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/oscon_2007_comparing_java_web"/>
        <published>2007-07-25T16:50:55-06:00</published>
        <updated>2007-07-25T22:59:30-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="tapestry" scheme="http://roller.apache.org/ns/tags/" />
        <category term="stripes" scheme="http://roller.apache.org/ns/tags/" />
        <category term="wicket" scheme="http://roller.apache.org/ns/tags/" />
        <category term="struts2" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jsf" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="presentation" scheme="http://roller.apache.org/ns/tags/" />
        <category term="myfaces" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <category term="oscon" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">This afternoon I delivered my &lt;a href=&quot;http://conferences.oreillynet.com/cs/os2007/view/e_sess/12341&quot;&gt;Comparing Java Web Frameworks&lt;/a&gt; talk at OSCON in Portland. I told attendees I&apos;d post it here afterwards, so here it is:&lt;/p;
&lt;p style=&quot;margin-left: 20px&quot;&gt;&lt;a href=&quot;http://static.raibledesigns.com/repository/presentations/ComparingJavaWebFrameworks-OSCON2007.pdf&quot;&gt;Download Comparing Java Web Frameworks Presentation&lt;/a&gt; (5.1 MB)&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;For comments on this presentation from earlier this year, see related postings from &lt;a href=&quot;http://raibledesigns.com/rd/entry/apachecon_eu_comparing_java_web&quot;&gt;ApacheCon EU&lt;/a&gt; and &lt;a href=&quot;http://raibledesigns.com/rd/entry/ja_sig_comparing_java_web&quot;&gt;JA-SIG&lt;/a&gt;. This presentation is pretty much the same as the one from ApacheCon and JA-SIG, except it has a different theme and I chopped out the Sweetspots section (due to time constraints).&lt;/p&gt;
&lt;p&gt;Portland is great this time of year, but unfortunately I won&apos;t be sticking around. I&apos;m heading down to Salem to work remotely for a couple of days, returning for the &lt;a href=&quot;http://www.oregonbrewfest.com&quot;&gt;Oregon Brewers Festival&lt;/a&gt; on Friday and heading back to Denver on Saturday. I&apos;ll be glad when July is over - I&apos;ve traveled to a new state every week.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/thoughts_on_myfaces_1_2</id>
        <title type="html">Thoughts on MyFaces 1.2 vs. JSF RI</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/thoughts_on_myfaces_1_2"/>
        <published>2007-07-19T11:32:18-06:00</published>
        <updated>2007-07-19T17:35:52-06:00</updated> 
        <category term="/Java" label="Java" />
        <category term="myfaces" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jsf" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Yesterday, &lt;a href=&quot;http://www.theserverside.com/news/thread.tss?thread_id=46244&quot;&gt;MyFaces 1.2&lt;/a&gt; was released. I took the opportunity to upgrade &lt;a href=&quot;http://appfuse-light.dev.java.net&quot;&gt;AppFuse Light&lt;/a&gt; and found it surprisingly easy to do so.  The only issue I ran into is my &lt;a href=&quot;http://www.nabble.com/Testing-JSF-1.2-Managed-Beans-vs.-JSF-1.1-tf4103841.html&quot;&gt;testing logic&lt;/a&gt; no longer works. I haven&apos;t had a chance to dive deeper into trying to fix the problem, but I did &lt;a href=&quot;http://fisheye4.cenqua.com/changelog/appfuse-light/?cs=56&quot;&gt;check the code in&lt;/a&gt;.
&lt;/p&gt;&lt;p&gt;
Since I&apos;m using &lt;a href=&quot;http://facelets.dev.java.net&quot;&gt;Facelets&lt;/a&gt; with MyFaces, I figured it should be possible to run my app on Tomcat 5.x. &lt;a href=&quot;http://www.nabble.com/Does-MyFaces-1.2-require-JSP-2.1--tf4112432.html&quot;&gt;No dice&lt;/a&gt;. I tried replacing MyFaces with Sun&apos;s RI (version 1.2_04) and &lt;em&gt;voila!&lt;/em&gt; - it works.&lt;/p&gt;
&lt;p&gt;From what I learned yesterday, it appears that MyFaces 1.2 will only run on a container that supports JSP 2.1. Sun&apos;s RI, on the other hand, will run on a Servlet 2.4/JSP 2.0 container. I don&apos;t know if Sun&apos;s RI is doing things properly, but it doesn&apos;t seem like Servlet 2.5 is required (which is kinda nice IMO).&lt;/p&gt;
&lt;p&gt;You might ask why I care about JSP 2.0 vs. JSP 2.1? In reality, I don&apos;t. However, if I were to mix and match Struts 2 and JSF in the same application (using the &lt;a href=&quot;http://struts.apache.org/2.x/docs/jsf-plugin.html&quot;&gt;Struts 2 JSF Plugin&lt;/a&gt;), I&apos;d like to do it on a JSP 2.0 container. Why? Because OGNL (the EL in Struts 2) uses the &lt;a href=&quot;http://www.nabble.com/OGNL-and-JSP-2.1---are-there-plans-to-fix--tf4103710.html&quot;&gt;pound sign (#) for expressions&lt;/a&gt; and JSP 2.1 hijacked that. Until the Struts team fixes that, I&apos;m stuck on JSP 2.0. The workaround (disabling EL for all JSPs) doesn&apos;t seem like a good option to me.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/java_web_frameworks_and_xss</id>
        <title type="html">Java Web Frameworks and XSS</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/java_web_frameworks_and_xss"/>
        <published>2007-07-19T10:16:15-06:00</published>
        <updated>2012-11-08T14:40:17-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="xss" scheme="http://roller.apache.org/ns/tags/" />
        <category term="webframeworks" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">In preparation for my &lt;a href=&quot;http://conferences.oreillynet.com/cs/os2007/view/e_sess/12341&quot;&gt;talk at OSCON next week&lt;/a&gt;, I&apos;ve been doing some research on &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-site_scripting&quot;&gt;cross-site scripting&lt;/a&gt; and how good Java web frameworks handle it. I&apos;m disappointed to report that the handling of XSS in Java web frameworks is abysmal. First of all, the JSP EL &lt;a href=&quot;http://www.sleberknight.com/blog/sleberkn/entry/20060721&quot;&gt;doesn&apos;t bother to handle XSS&lt;/a&gt;:&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
With JSP 2.0 you can use the following to emit the description of a &quot;todo&quot; item:&lt;br/&gt;

&lt;code&gt;
${todo.description}
&lt;/code&gt;

&lt;br/&gt;That&apos;s pretty nice. What happens when someone has entered a description like this?&lt;br/&gt;

&lt;code&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;alert(&apos;F#$@ you!&apos;);&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;br/&gt;Well, it executes the JavaScript and pops up a nice little message to you. &lt;br/&gt;
...&lt;br/&gt;
My question is this: &lt;strong&gt;Why in the world did the expert group on the JSP 2.0 JSR decide to make not escaping XML content the default for EL expressions&lt;/strong&gt;, when they made the opposite decision for &lt;code&gt;c:out&lt;/code&gt;?
&lt;/p&gt;
&lt;p&gt;(Emphasis mine) If a company/developer wants to make sure their JSP-based code is not susceptible to XSS, they have two choices (as I see it): 
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Do lots of code review to make sure &amp;lt;c:out&gt; is used instead of ${}.&lt;/li&gt;
&lt;li&gt;Hack the jsp-compiler/el-engine to escape XML by default.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The good news is #2 doesn&apos;t seem to be that hard. I pulled down commons-el yesterday, added a hack to escape XML, re-jarred and put it in Tomcat 5.0.25&apos;s classpath. This actually worked and I was impressed it was so easy. However, when I looked at Tomcat 6, commons-el is no longer used and now there&apos;s a &quot;jasper-el.jar&quot; in the lib directory. I don&apos;t mind modifying another library, but what&apos;s the difference between jasper-el and commons-el? 
&lt;br/&gt;&lt;br/&gt;
Of course, the whole problem with JSP EL could be solved if Tomcat (and other containers) would allow a flag to turn on XML escaping by default. IMO, it&apos;s badly needed to make JSP-based webapps safe from XSS.
&lt;br/&gt;&lt;br/&gt;
On a related note, there&apos;s a couple of web frameworks that I&apos;ve found to be susceptible to XSS: namely Spring MVC and Struts 2. For Spring MVC, its &lt;a href=&quot;http://shh.thathost.com/secadv/spring-form-xss/&quot;&gt;&amp;lt;form:input&gt; and &amp;lt;form:errors&gt; tags are vulnerable&lt;/a&gt;. For Struts 2, &lt;a href=&quot;http://javaswamy.blogspot.com/2007/07/has-struts2-lost-it.html&quot;&gt;OGNL expressions are evaluated&lt;/a&gt;, which is way worse than XSS and actually allows you to shutdown the JVM by putting &lt;code&gt;%{@java.lang.System@exit(0)}&quot;&lt;/code&gt; in a text field.
&lt;br/&gt;&lt;br/&gt;
Even though it was surprising for me to see the issues with Struts 2 and Spring MVC, I&apos;m somewhat glad they exist. If I hadn&apos;t discovered them, I might blissfully think that Java web frameworks aren&apos;t susceptible to XSS. However, it appears they&apos;re not only susceptible, but no one is really thinking about XSS when developing these framework. To further prove that theory, the Spring MVC and Struts 2 teams are aware of these issues, have been for quite some time - yet they&apos;ve done nothing in the form of releasing upgrades or patches. 
&lt;br/&gt;&lt;br/&gt;
Seems kinda strange doesn&apos;t it? 

</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/the_security_annotation_framework</id>
        <title type="html">The Security Annotation Framework</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/the_security_annotation_framework"/>
        <published>2007-05-24T12:42:35-06:00</published>
        <updated>2012-11-11T02:00:40-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="acegi" scheme="http://roller.apache.org/ns/tags/" />
        <category term="security" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Spotted on the &lt;a href=&quot;http://www.nabble.com/Spring-2.0-XSD-Parsers-tf3205417.html#a9990445&quot;&gt;Acegi Security mailing list&lt;/a&gt; several weeks ago:
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
A few weeks ago, I started an open source project (Security Annotation Framework) which addresses annotation-based, instance-level access control for Spring applications. It is also based on Spring 2.0&apos;s extensible XML authoring features. You can find more info at 
&lt;br/&gt;&lt;br/&gt;
&lt;a href=&quot;http://sourceforge.net/projects/safr&quot;&gt;http://sourceforge.net/projects/safr&lt;/a&gt; and &lt;a href=&quot;http://safr.sourceforge.net/&quot;&gt;http://safr.sourceforge.net&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
The framework was created during a project in 2006 and is now available under the Apache 2.0 license. It&apos;s a generic framework focused on processing security annotations on Spring beans as well as domain objects (which typically aren&apos;t managed by a Spring application context) and can be used to enforce access decisions for domain object instances. It can be used with any authorization provider and is not specific to Acegi. However, I plan to include an example how to use the SAF with Acegi authorization soon. Furthermore, it supports inheritance of annotations from base classes and interfaces. 
&lt;/p&gt;
&lt;p&gt;What do you think about SAF?  Are annotations a better way of implementing ACLs on domain objects?</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/spring_web_flow_and_jsf</id>
        <title type="html">Spring Web Flow and JSF</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/spring_web_flow_and_jsf"/>
        <published>2007-04-21T10:22:32-06:00</published>
        <updated>2012-11-08T14:40:39-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="struts2" scheme="http://roller.apache.org/ns/tags/" />
        <category term="interface21" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jboss" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jsf" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Keith Donald has a nice and &lt;a href=&quot;http://blog.interface21.com/main/2007/04/21/what-spring-web-flow-offers-jsf-developers/&quot;&gt;long writeup&lt;/a&gt; on Spring Web Flow 1.0.3&apos;s stellar support for JSF:&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
One important area where our integration is growing is with the Java Server Faces (JSF) community. Beginning with Spring Web Flow 1.0.3, our JSF integration is on-par with what the Spring community expects, and delivers what JSF developers in the trenches need most. This blog will illustrate the integration enhancements to show you the difference Spring Web Flow is making for JSF developers.
&lt;/p&gt;
&lt;p&gt;One of the most interesting parts of the post is a few paragraphs down:&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
Basically, Web Flow solves every problem &lt;a href=&quot;http://icoloma.blogspot.com/2006/10/myfaces-emperor-has-no-clothes.html&quot;&gt;this pour soul&lt;/a&gt; experienced with JSF&apos;s basic navigation capabilities.  As &lt;a href=&quot;http://forum.springframework.org/showpost.php?p=111157&amp;amp;postcount=4&quot;&gt;one of our leading users noted&lt;/a&gt;, Web Flow can be used as a complete replacement for JSF&apos;s default &quot;forward-centric&quot; navigation model.&lt;/p&gt;
&lt;p&gt;It&apos;s also interesting to note that ideas from SWF could be incorporated into JSF 2.0:&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;I&apos;d also like to take this opportunity to encourage those already using Spring Web Flow in a JSF environment to speak out about your experience?send me an email, leave a comment here, write an article on JSF central, tell leaders in the JSF community about your experience.  Your real world experience can help influence the direction of the JSF 2.0 specification in a time where the specification lead has &lt;a href=&quot;http://weblogs.java.net/blog/edburns/archive/2007/03/prejcpfiled_dra_1.html&quot;&gt;asked for community feedback&lt;/a&gt;.  Interface21 has been extended an invitation from Ed Burns, the JSF specification lead, to be a part of the JSF 2.0 expert group, which is a recognition of Web Flow&apos;s contribution as an innovative JSF extension. We have accepted that invitation and are excited about helping channel whats proven to work in the area of navigation and state management on a general basis back into JSF 2.0, while continuing to chart new territory and remaining usable in &lt;i&gt;any&lt;/i&gt; environment.
&lt;/p&gt;
&lt;p&gt;Are you using SWF with JSF?  If so, have your experiences been good or bad?  I&apos;m sure Keith would love to hear about them either way.
&lt;br/&gt;&lt;br/&gt;
I think it&apos;s interesting to note that both Interface21 and JBoss are doing a lot to build solutions to JSF&apos;s problems. Is there money to be made from supporting JSF? In reality, you have to like what both companies are doing: they&apos;re building solutions to overcome the shortcomings of JSF &lt;em&gt;and&lt;/em&gt; they&apos;re contributing those solutions back to the community &lt;em&gt;for free&lt;/em&gt;. Even cooler is the fact that both companies are trying to get their solutions into the next version of JSF. This benefits everyone as far as I&apos;m concerned.
&lt;br/&gt;&lt;br/&gt;
What about those of you using Spring Web Flow with Spring MVC or Struts?  How is it working for you?
&lt;br/&gt;&lt;br/&gt;
I recently integrated Spring Web Flow into my current project using the &lt;a href=&quot;http://cwiki.apache.org/S2PLUGINS/spring-webflow-plugin.html&quot;&gt;Spring Webflow Plugin&lt;/a&gt;. In the past, I&apos;ve used SWF with Spring MVC and JSF, so the &lt;a href=&quot;http://www.nabble.com/Spring-Web-Flow-Plugin-Feeback-tf3406920.html#a9490150&quot;&gt;Struts 2 Plugin seemed a bit odd&lt;/a&gt;. I guess I&apos;ll know more once I start using it more.
&lt;br/&gt;&lt;br/&gt;
This brings up a good question - do you think it&apos;s better to create a page flow (i.e. a shopping cart) without Spring Web Flow first, and then refactor? Or do you think it&apos;s easier to use SWF from the beginning?  My gut feeling is to start w/o it because you may not need it. Then if you do need it, you&apos;ll understand the problems it solves. What are your thoughts?</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/jsf_still_sucks</id>
        <title type="html">JSF still sucks?</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/jsf_still_sucks"/>
        <published>2007-04-16T12:40:45-06:00</published>
        <updated>2012-11-08T14:17:13-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="jsf" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Granted, &lt;a href=&quot;http://icoloma.blogspot.com/2006/10/myfaces-emperor-has-no-clothes.html&quot;&gt;this post about how painful JSF is&lt;/a&gt; is almost 6 months old, but I think it&apos;s still mostly true.  
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
Want to compare times? More than three man-weeks have been spent fixing silly JSF navigation problems. A full CRUD AJAX interface with Spring MVC and prototype in the same project took four days, and there was no previous experience with Spring MVC.
&lt;/p&gt;
&lt;p&gt;
If you&apos;re going to use JSF, I highly recommend Facelets or Shale/Seam. However, those are mentioned as well:&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
The default view technology is JSP, even when no one in the real world would recommend it; instead, use Facelets, or Clay, or some other non-standard framework. Not trying to be sarcastic here, since Facelets is pretty good, but this complicates the hiring and education of the team and in fact invalidates the selling point of Faces &apos;being a standard&apos;.
&lt;/p&gt;
&lt;p&gt;IMO, Facelets is &lt;em&gt;very&lt;/em&gt; easy to learn.  If you know how to program JSPs with JSF, you should be able to use Facelets in under an hour. When we converted AppFuse&apos;s JSF flavor from JSP to Facelets, rarely did the body have to change - we just had to change from taglibs to XML namespaces.&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
When you are &lt;span style=&quot;font-weight: bold;&quot;&gt;not&lt;/span&gt; working with persistent data (if you are living in a cave or developing wizard interfaces) there are two scopes to store model state: the session context, which raises concurrency issues and is not recommended by the Faces community, and the conversation/process/whatever context, which is not standard and imply installing shale or seam to put even more lipstick on the pig.
&lt;/p&gt;
&lt;p&gt;There&apos;s two problems with Shale and Facelets - the activity on these projects is very low. Shale still has its creators around, so even while its seldom used, you can probably still get your questions answered. However, Facelets seems to be suffering from &quot;&lt;a href=&quot;http://www.nabble.com/Question-to-Jacob%3A-Facelets-status--tf3492717.html&quot;&gt;developer abandonment&lt;/a&gt;&quot;.
&lt;/p&gt;
&lt;p&gt;Conclusion: don&apos;t use JSF simply because it&apos;s a &quot;standard&quot;. Use other frameworks that are more actively developed and designed for the web. For component-based frameworks, the most popular are Tapestry and Wicket. Less popular ones are RIFE and Click. 
&lt;br/&gt;&lt;br/&gt;
If you still want to use JSF, you should probably use Seam, but don&apos;t simply use JSF because it&apos;s a standard. If it was a &lt;a href=&quot;http://hibernate.org&quot;&gt;de&lt;/a&gt;&lt;a href=&quot;http://springframework.org&quot;&gt;-facto&lt;/a&gt; &lt;a href=&quot;http://struts.apache.org&quot;&gt;standard&lt;/a&gt;, that&apos;d be another story. 
&lt;br/&gt;&lt;br/&gt;
Of course, you could also &lt;a href=&quot;http://www.theserverside.com/news/thread.tss?thread_id=44887&quot;&gt;help improve JSF 2.0&lt;/a&gt;. But that&apos;s not scheduled for release until late 2008. I&apos;m sure 2 or 3 commentors will claim we&apos;ll all be using Rails or Grails by then. &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/zero_configuration_in_struts_2</id>
        <title type="html">Zero Configuration in Struts 2</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/zero_configuration_in_struts_2"/>
        <published>2007-03-07T17:19:18-07:00</published>
        <updated>2007-03-08T00:20:32-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="struts2" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Struts 2 has a nifty &lt;a href=&quot;http://struts.apache.org/2.0.6/docs/zero-configuration.html&quot;&gt;zero configuration&lt;/a&gt; feature. However, it&apos;s only useful for registering actions, not for automatically registering results. In other words, you still have to use an @Result annotation to tell your action what page to dispatch to. To use default view names instead of requiring @Result, you can use the &lt;a href=&quot;http://struts.apache.org/2.0.6/docs/codebehind-plugin.html&quot;&gt;Codebehind Plugin&lt;/a&gt;. Also, did you know Struts 2 will autowire your Spring dependencies?  It&apos;s pretty slick.
&lt;br/&gt;&lt;br/&gt;
What does this all mean?  It means you can write your Struts 2 application &lt;em&gt;without writing any XML&lt;/em&gt;. Of course, you can still use XML to tweak behavior, but with these plugins enabled, you won&apos;t have to.
&lt;blockquote style=&quot;font-style: italic&quot;&gt;
IMO, these plugins should be combined into a single zero configuration feature.
&lt;/blockquote&gt;
&lt;p&gt;Here&apos;s how you can enable Struts 2&apos;s Zero Configuration feature in AppFuse 2.0:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add a &lt;strong&gt;packageNames&lt;/strong&gt; parameter to the &quot;struts&quot; filter in your web.xml:&lt;br/&gt;
&lt;pre style=&quot;margin-top: 10px&quot;&gt;
&amp;lt;filter&amp;gt;
    &amp;lt;filter-name&amp;gt;struts&amp;lt;/filter-name&amp;gt;
    &amp;lt;filter-class&amp;gt;org.apache.struts2.dispatcher.FilterDispatcher&amp;lt;/filter-class&amp;gt;
    &amp;lt;init-param&amp;gt;
        &amp;lt;param-name&amp;gt;actionPackages&amp;lt;/param-name&amp;gt;
        &amp;lt;param-value&amp;gt;com.company.newapp.webapp.action&amp;lt;/param-value&amp;gt;
    &amp;lt;/init-param&amp;gt;
&amp;lt;/filter&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Add the Codebehind Plugin as a dependency in your pom.xml:
&lt;pre style=&quot;margin-top: 10px&quot;&gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.apache.struts&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;struts2-codebehind-plugin&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;2.0.6&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Add a &lt;strong&gt;struts.codebehind.pathPrefix&lt;/strong&gt; constant in struts.xml for your default pages directory:
&lt;pre style=&quot;margin-top: 10px&quot;&gt;
&amp;lt;constant name=&quot;struts.codebehind.pathPrefix&quot; value=&quot;/WEB-INF/pages/&quot;/&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That&apos;s it - now you can code away without configuring anything!&lt;/p&gt;
&lt;p&gt;How does this compare to other web frameworks in AppFuse?  Tapestry has a similar feature, but Spring MVC and JSF don&apos;t. Spring MVC still requires you create a bean definition for Controllers and JSF requires you write a chunk of XML for each managed bean.  Of course, if you know how to do something similar with Spring MVC or JSF, please let me know.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/message_driven_pojos_by_mark</id>
        <title type="html">Message Driven POJOs by Mark Fisher</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/message_driven_pojos_by_mark"/>
        <published>2007-02-23T11:25:59-07:00</published>
        <updated>2007-02-24T19:19:29-07:00</updated> 
        <category term="/Java" label="Java" />
        <category term="jms" scheme="http://roller.apache.org/ns/tags/" />
        <category term="nejug" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jmstemplate" scheme="http://roller.apache.org/ns/tags/" />
        <category term="java" scheme="http://roller.apache.org/ns/tags/" />
        <category term="activemq" scheme="http://roller.apache.org/ns/tags/" />
        <category term="spring" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Last night, I attended the &lt;a href=&quot;http://www.nejug.org&quot;&gt;New England Java Users Group&lt;/a&gt; to see &lt;a href=&quot;http://blog.springframework.com/markf/&quot;&gt;Mark Fisher&lt;/a&gt; talk about &lt;a href=&quot;http://www.nejug.org/2007/febSpring07.jsp&quot;&gt;Message Driven POJOs&lt;/a&gt;. This was the first JUG I&apos;ve been to (outside of Denver&apos;s) where I was an attendee instead of a speaker.  It was interesting to see how they do things. They have one main speaker who speaks for two hours. After the first hour, they have a break, offer pizza and do a raffle. Then the speaker continues. They require you to &quot;register&quot; at least 48 hours before the meeting starts. This is because the meeting is held at Sun and they (apparently) need to do it for security purposes. They actually checked my ID and made sure I was registered at the door. After I passed their verification test, I received a name tag. While I like Denver&apos;s Basic Concepts followed by Main Speaker setup, I liked that this JUG meeting was over at 8:15. Below are my notes from the event.
&lt;br/&gt;&lt;br/&gt;
Topics in this Session: Overview of JMS, Spring&apos;s JmsTemplate and implementing a Message Driven POJO.
&lt;br/&gt;&lt;br/&gt;
Goals of JMS: provide  a vendor-neutral abstraction for accessing Message Oriented Middleware from Java. It provides for enterprise messaging systems what JDBC provides for relational databases. See &lt;a href=&quot;http://en.wikipedia.org/wiki/Java_Message_Service&quot;&gt;Wikipedia&apos;s definition of JMS&lt;/a&gt; for more information.
&lt;br/&gt;&lt;br/&gt;
The API is what insulates your code from the JMS implementation you&apos;re using. The JMS implementation will use a message broker to communicate between servers. Tonight, Mark will be using &lt;a href=&quot;http://activemq.apache.org&quot;&gt;ActiveMQ&lt;/a&gt; in his examples.  He plans on doing most of his presentation in Eclipse because he&apos;s been spending 14 hours per day in PowerPoint revamping Interface21&apos;s training courses (I don&apos;t miss that &lt;em&gt;at all&lt;/em&gt;).
&lt;br/&gt;&lt;br/&gt;
The JMS &lt;i&gt;Message&lt;/i&gt; is the central object to JMS. There&apos;s various types of messages, TextMessage, ObjectMessage (I missed the rest). Two types of JMS Destinations are available: Queues and Topics. A JMS Session is used to create messages as well as producers and consumers. Examples calls:
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;&lt;code&gt;session.createTextMessage(String)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;session.createConsumer(dest)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;session.createProducter(dest)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A JMS Connection is obtained from a JMS ConnectionFactory. The ConnectionFactory is typically accessed by a JNDI Lookup.
&lt;br/&gt;&lt;br/&gt;
JMS is most commonly used for internal application communications (not public facing).
&lt;br/&gt;&lt;br/&gt;
Templates are common in the Spring Framework and are used to simply API usage. Their main goal is to reduce boilerplate code (resource management, try/catch, etc.). Examples include JdbcTemplate, JpaTemplate, JndiTemplate, TransactionTemplate and (you guessed it) &lt;a href=&quot;http://www.springframework.org/docs/api/org/springframework/jms/core/JmsTemplate.html&quot;&gt;JmsTemplate&lt;/a&gt;. Spring also translates exceptions to consistent runtime hierarchies. In addition to one-line methods, Spring&apos;s templates supply callbacks that alleviate try/catch blocks - but give you full power of the API.
&lt;br/&gt;&lt;br/&gt;
JmsTemplate has a couple of capabilities: it handles acquisition and release of resources and translates checked JMS Exceptions to a parallel hierarchy of RuntimeExceptions. It&apos;s also capable of converting a payload to the corresponding JMS message type with a MessageConverter strategy. Lastly, it provides convenience methods to allow sending asynchronous messages.
&lt;br/&gt;&lt;br/&gt;
Now Mark is showing us how you configure a ConnectionFactory, Queue and JmsTemplate in a Spring context file. The first couple of beans only take 3 lines of code to configure, the 3rd one takes 4 because it has a dependency on the first two.  Pretty easy configuration if you ask me. After composing bean definitions, Mark created a JUnit test and called &lt;code&gt;jmsTemplate.convertAndSend()&lt;/code&gt; to send a message in 2 lines of Java code.
&lt;br/&gt;&lt;br/&gt;
To receive messages with JmsTemplate (pre Spring 2.0), you could use synchronous receive calls: &lt;code&gt;receive()&lt;/code&gt;, &lt;code&gt;receive(Destination)&lt;/code&gt; and &lt;code&gt;receive(String)&lt;/code&gt;. There are also &lt;code&gt;receiveAndConvert()&lt;/code&gt; methods.
&lt;br/&gt;&lt;br/&gt;
In Spring 2.0, they added the ability to do MessageListener containers to enable asynchronous reception in a non application server environment. Implementations include &lt;a href=&quot;http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/jms/listener/SimpleMessageListenerContainer.html&quot;&gt;SimpleMessageListenerContainer&lt;/a&gt;, &lt;a href=&quot;http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/jms/listener/DefaultMessageListenerContainer.html&quot;&gt;DefaultMessageListenerContainer&lt;/a&gt; and &lt;a href=&quot;http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/jms/listener/serversession/ServerSessionMessageListenerContainer.html&quot;&gt;ServerSessionMessageListenerContainer&lt;/a&gt;. The DMLC adds transactional behavior, and the SSMLC hooks into the server&apos;s SPI. Spring&apos;s &lt;a href=&quot;http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/jms/listener/adapter/MessageListenerAdapter.html&quot;&gt;MessageListenerAdapter&lt;/a&gt; enables the delegation to a POJO for handling the payload.
&lt;br/&gt;&lt;br/&gt;
For the next 1/2 hour or so, Mark wrote a bunch of Java and XML to create a simple Trader application.  About the same time, I got managed to get an internet connection from somewhere and started browsing the net and answering e-mail. Every once in a while I looked up to see Mark&apos;s code - it all looks very simple and straight forward. In Spring 2.1, a &amp;lt;jms:*&gt; namespace will be added to simplify the XML configuration. 
&lt;br/&gt;&lt;br/&gt;
For those of you out there using Spring&apos;s JMS support - are there any issues you&apos;ve run into?  Are you using it in production?  It&apos;s always pimped as &quot;awesome&quot;, so I&apos;m looking for pain points that folks might encounter when using it.
&lt;br/&gt;&lt;br/&gt;
Related: &lt;a href=&quot;http://www.springframework.org/docs/reference/jms.html&quot;&gt;Spring&apos;s JMS Documentation&lt;/a&gt; and &lt;a href=&quot;http://activemq.apache.org/jmstemplate-gotchas.html&quot;&gt;ActiveMQ&apos;s JmsTemplate Gotchas&lt;/a&gt;.
</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/tse_keynote_the_bigger_picture</id>
        <title type="html">[TSE] Keynote: The Bigger Picture with Adrian Colyer</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/tse_keynote_the_bigger_picture"/>
        <published>2006-12-09T19:26:49-07:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <summary type="html">We&apos;ve seen a lot of things over the last few days, but what about the big picture? It&apos;s not just about the Spring Framework anymore, but there&apos;s also a lot of sub-projects: SFW, SWF, SWS, S-OSGi.  Then there&apos;s Enterprise services: clustering, persistence, messaging and scheduling.  Industry trends: SOA, Web 2.0/RIA, RAD stacks.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Agenda&lt;/strong&gt;
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Spring portfolio: unifying themes, fitting the pieces together (by layer) and future direction&lt;/li&gt;
&lt;li&gt;Facing the feature: my boss says I need a SOA, from auto-suggest to RIA and the quest for ever-increasing productivity&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;</summary>
        <content type="html">We&apos;ve seen a lot of things over the last few days, but what about the big picture? It&apos;s not just about the Spring Framework anymore, but there&apos;s also a lot of sub-projects: SFW, SWF, SWS, S-OSGi.  Then there&apos;s Enterprise services: clustering, persistence, messaging and scheduling.  Industry trends: SOA, Web 2.0/RIA, RAD stacks.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Agenda&lt;/strong&gt;
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Spring portfolio: unifying themes, fitting the pieces together (by layer) and future direction&lt;/li&gt;
&lt;li&gt;Facing the feature: my boss says I need a SOA, from auto-suggest to RIA and the quest for ever-increasing productivity&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The first thing that&apos;s Spring has done is to give you a &lt;i&gt;triangular&lt;/i&gt; simple object.  Because a triangle is one of the strongest shapes, this is why Spring holds up to heavy loads and lots of users.  Triangles work much better than circles.  
&lt;/p&gt;
&lt;p&gt;Spring is built on &quot;simple objects&quot; and 3 principles: Dependency Injection, AOP and Portable Service Abstractions.
&lt;/p&gt;
&lt;p&gt;
The &quot;blueprints&quot; that Spring provides are a great way to understand applications.  If a a team uses simple objects + blueprints, chances are an experienced Spring developer can understand how most of the application works.
&lt;/p&gt;
&lt;p&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Data Access Layer&lt;/strong&gt;&lt;br/&gt;
Spring supports JDBC, iBATIS, JDO, Hibernate, TopLink. In addition, Spring 2.0 has JPA Support, including OpenJPA, TopLink Essentials and Hibernate. Further enhancements coming for 2.1: JPA namespace and support for common non-standard features (for example, criteria API and user types).
&lt;/p&gt;
&lt;p&gt;
Other backends: Spring also has support for accessing enterprise systems, CICS and IMS.  Spring has JCA CCI support with the &lt;a href=&quot;http://www.springframework.org/docs/api/org/springframework/jca/cci/core/CciTemplate.html&quot;&gt;CCiTemplate&lt;/a&gt;.
&lt;br/&gt;&lt;br/&gt;
&lt;a href=&quot;http://www.springframework.org/ldap&quot;&gt;Spring LDAP&lt;/a&gt; project adds support for interacting with LDAP servers. I&apos;ve worked with Spring LDAP and it certainly does work nice.  The only thing I found painful was that it didn&apos;t support transactions, but neither does LDAP, so that&apos;s to be expected. If you&apos;ve never used Spring LDAP, you probably already know a lot about &lt;a href=&quot;http://static.springframework.org/spring-ldap/docs/1.1/api/org/springframework/ldap/LdapTemplate.html&quot;&gt;LdapTemplate&lt;/a&gt;, even if you haven&apos;t used it.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Service Layer&lt;/strong&gt;&lt;br/&gt;
You all know how to define business services, but what about scheduling, asynchronous messaging, ESBs, etc?  Spring has support for scheduling with JDK Timer and Quartz.  You can run jobs in background with cron expressions or simple triggers.  &lt;a href=&quot;http://www.springframework.org/docs/api/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.html&quot;&gt;MethodInvokingJobDetailFactoryBean&lt;/a&gt; makes it trivial to execute an operation on a bean.
&lt;br/&gt;&lt;br/&gt;
Asynchronous tasks can be run by &lt;a href=&quot;http://www.springframework.org/docs/reference/scheduling.html#scheduling-task-executor&quot;&gt;TaskExecutor&lt;/a&gt;.  It can be kicked off programmatically or by a scheduler.  Simple confugiration change to switch from thread pool to &lt;a href=&quot;http://dev2dev.bea.com/wlplatform/commonj/&quot;&gt;commonj&lt;/a&gt; work manager.
&lt;br/&gt;&lt;br/&gt;
Messaging: 
Spring 2.0 extended Spring&apos;s JMS support.  JmsTemplate + Message-driven POJOs.  It&apos;s fully Java EE compliant, can participate in a transaction and process a message and send a reply in one unit of work.
&lt;br/&gt;&lt;br/&gt;
For XML payloads, you can use &lt;a href=&quot;http://www.springframework.org/spring-ws&quot;&gt;Spring Web Services&lt;/a&gt; to do OXM (Object XML Mapping).
&lt;br/&gt;&lt;br/&gt;
Is all this heading towards an ESB-like system?  In a sense, so why not just use a full-blown ESB like Mule.  Mule 2.0 is being re-written to be entirely based on Spring. 
&lt;br/&gt;&lt;br/&gt;
ESB - Mule integration: 
Spring application context support simple event framework: ApplicationEventPublisher and ApplicationEventPublisherAware, ApplicationEvent and ApplicationListener.  Simple for a bean to publish and listen to events.  Mule can integrate into this as a custom event multi-caster.
&lt;br/&gt;&lt;br/&gt;
Configure a bean to listen only to events of interest using MuleSubscriptionEventListener.  You can publish events to mule using a normal ApplicationEventPublisher interface and create a MuleApplicationEvent to publish.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Clustering&lt;/strong&gt;&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://www.tangosol.com/html/coherence-overview.shtml&quot;&gt;Tangosol Coherence&lt;/a&gt; and Coherence Data Grid for Spring:
You can use a &amp;lt;datagrid:member&gt; to register application context as a member of a DataGrid.  Application events are grid-wide.  &amp;lt;bean id=&quot;...&quot; scope=&quot;datagrid&quot;&gt;: bean operations &quot;in-place&quot; in the grid.  There&apos;s no need for cluster-wide locking (b/c it&apos;s fast).  DataGridBean transaction management.  &amp;lt;datagrid:cache/&gt; allows you to define a datagrid as a bean.  Furthermore, there&apos;s Java and .NET interoparability for DataGrid beans.&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;http://gigaspaces.com&quot;&gt;GigaSpaces&lt;/a&gt; 5.2 was announced last week.  Use POJOs as space entries, full Spring transaction integration.  There&apos;s also a PlatformTransactionManager implementation.  You can access their DataGrid using a JdbcTemplate and GigaSpaces&apos; JDBC Driver, or you can use the GigaSpacesTemplate.  You can access the GigaSpaces MessageGrid via Spring&apos;s JMS abstraction.  You can submit jobs to the ComputeGrid, which is a parallel processing engine.  It works with Spring AOP to create proxy to remove service and uses a DelegratingWorker from Spring modules for task execution.&lt;/li&gt;
&lt;li&gt;
&lt;a href=&quot;http://www.terracotta.org/&quot;&gt;Terracotta&lt;/a&gt;:
Allows you to cluster any singleton Spring bean.  Beans named in Terracotta configuration file, and clustering is completely transparent to Spring and to your application. The state of that bean will be shared across the cluster.  You can publish ApplicationEvents across the cluster - where application events are propogated to all listers in each JVM.  Terracotta allows clustering Spring Web Flow to enable failover of conversation state.  AOP + clustered beans + Spring JMX = cluster management view (view local vs. clustered data). &lt;i&gt;Now free and open source!&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Security impacts all layers. It starts in remote and web interfaces and can be useful for role-based method-invocations in service layer and data layer.  Furthermore, Acegi&apos;s ACLs can be very useful for fine-grained security on domain objects. &quot;Spring Security is one of the hidden jewels in the bunch here.&quot;
&lt;/p&gt;
&lt;p&gt;
&lt;strong style=&quot;color: #666&quot;&gt;
Presentation Layer&lt;/strong&gt;&lt;br/&gt;
Spring Rich Client is another member of the Spring family that allows you to leverage Spring ideas in a Swing application. Has support for GUI builders and many other features that allow you to write Swing easier.
&lt;br/&gt;&lt;br/&gt;
Spring MVC is great for free navigation and has a nice Controller hierarchy.  Supports many more view options than just JSP.  When developing wizards, it gets a bit more complicated. If you&apos;re stressing AbstractWizardFormController even a little bit, it&apos;s time for Spring Web Flow.
&lt;br/&gt;&lt;br/&gt;
Spring Web Flow is for controlled navigation. You can model a web interaction as a flow and declare states and transitions between them.  By modeling that flow in a blueprint and declaring the various states and transitions, you can easily abstract and compose how to navigate between pages. SWF can be used with servlets, portlets and multiple web frameworks.  It supports post-redirect-get automatically and browser buttons &quot;just work&quot;.
&lt;br/&gt;&lt;br/&gt;
Where is future for SWF: even simpler flow definitions for common patterns (higher level of abstraction in configuration.  Also, first class JSF support.  Apparently, the JSF support is not as good as they&apos;d like it to be.
&lt;br/&gt;&lt;br/&gt;
Spring IDE has support for code-completion in XML, the &quot;p&quot; namespace and composing web flows graphically. Spring IDE also will have AOP support, much like AJT gives you for AspectJ (this is &lt;i&gt;very&lt;/i&gt; cool IMO). With the AOP support, you can navigate between an Aspect and the XML configuration that defines it.
&lt;br/&gt;&lt;br/&gt;
Web 2.0 / Ajax / RIA - what about creating the better using experience with these tools?  Ajax ingredients are UI toolkits, effects and a means of communicating with the server.  To return XML from Spring MVC, you can use AbstractXsltView (with no styleSheetLocation set).  For converting model objects to XML, you can use Spring Web Services OXM stuff.  It can get simpler than that - just use DWR and JSON-RPC.  If you want to secure DWR, Spring Security will allow you to do that.  Acegi is apparently looking at doing better support for Ajax and DWR.  DWR 2.0 has a new Spring &amp;lt;dwr:*&amp;gt; namespace that allows you to easily nest a &amp;lt;dwr:remote&amp;gt; tag in a bean definition and expose that bean as a JavaScript object.
&lt;br/&gt;&lt;br/&gt;
If you need a real web service, Spring supports that. Use XFireExporter for simple RPC style services.  For everything else, there&apos;s Spring Web Services.  It has an Object/XML mapping abstraction, a framework that resembles Spring MVC and it supports WS-Security with Spring Security. Interface21 has heard from many customers that Spring WS is one of their favorite pieces of the Spring portfolio.
&lt;br/&gt;&lt;br/&gt;
OSOA (Open SOA Collaboration) is made up of a number of companies: BEA, IBM, Oracle, SAP, Sun ... and ... Interface21.
&lt;br/&gt;&lt;br/&gt;
Service Component Architecture - course grained SOA.  It has an assembly model with service components, references and wires everything together.  It also contains a policy framework that supports QoS.  Service implementation and client API can be Java, C++, BPEL, EJB or Spring.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;AOP&lt;/strong&gt;&lt;br/&gt;
Spring 2.0 delivered close integration between AspectJ and Spring AOP.  It&apos;s also easy to use the full power of AspectJ with Spring application if you need it. AOP + JMX is particularly compelling - take a look at the &lt;a href=&quot;http://www.glassbox.com&quot;&gt;Glassbox&lt;/a&gt; project for an example of this.  Juergen has also been working on integrating load-time weaving as your application context is being initialized.
&lt;br/&gt;&lt;br/&gt;
Spring-OSGi - allows you to use a SOA across application context within the same application.  Allows a very strong module system, versioning, concurrent deployment (of different versions) and hot re-deploy.
&lt;br/&gt;&lt;br/&gt;
Rapid Application Development: 
Spring 2.0 supports beans written in alternative languages: JRuby, Groovy and Beanshell.  
ROO (Real Object Oriented) application.  Domain first, infrastructure second.  Full static rapid development and has been validated with clients to great success.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Summary&lt;/strong&gt;&lt;br/&gt;
Spring has consistent themes and approach. More than just &quot;The Spring Framework&quot;.  There&apos;s over 20 projects &lt;i&gt;in addition&lt;/i&gt; to core Spring that allow you to do great things and build applications easier.  Eight of these projects are lead by Interface21.  Next year, they&apos;re hoping to do something like Callisto where &lt;i&gt;all&lt;/i&gt; Spring-related projects can do a simultaneous release. 
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;My Thoughts&lt;/strong&gt;&lt;br/&gt;
Interestingly enough, many of the web frameworks that build on Spring aren&apos;t listed here (AppFuse, Grails, Trails, etc.).  That makes sense since these projects are most useful when doing greenfield development and I doubt Interface21 does much of that. 
&lt;br/&gt;&lt;br/&gt;
With all of the Spring projects, Interface21 is starting to look like JBoss.  However, one of the major differences between I21 and JBoss is the majority of Spring projects are actually &lt;em&gt;not&lt;/em&gt; lead by Interface21.
&lt;br/&gt;&lt;br/&gt;
This was one of my favorite talks of the show because it talked about the future of Spring and what&apos;s on the roadmap for many sub-projects.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/tse_spring_osgi_with_adrian</id>
        <title type="html">[TSE] Spring-OSGI with Adrian Colyer</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/tse_spring_osgi_with_adrian"/>
        <published>2006-12-09T14:29:58-07:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <summary type="html">One of the first questions people ask about OSGi is &quot;what the heck is it?&quot;&lt;br/&gt;&lt;br/&gt;
Most people don&apos;t even know what it is. OSGi stands for &lt;b&gt;O&lt;/b&gt;pen &lt;b&gt;S&lt;/b&gt;ervices &lt;b&gt;G&lt;/b&gt;ateway &lt;b&gt;i&lt;/b&gt;nitiative. From the very beginning, it was designed to be lightweight and dynamic. This is the major difference between it and other containers.  It&apos;s always been designed to have things added and removed.  Now it&apos;s tagline is: &quot;The Dynamic Module System for Java&quot;.
&lt;br/&gt;&lt;br/&gt;
It&apos;s designed to allow you to partition a system into a number of modules (a.k.a. bundles).  There&apos;s strict visibility rules (similar to protected and private).  There&apos;s a resolution process (dependencies are satisfied) and it understands versioning.
&lt;br/&gt;&lt;br/&gt;
It&apos;s dynamic! Modules can be installed, started, stopped, uninstalled and updated - all at runtime.</summary>
        <content type="html">Adrian has &lt;i&gt;CTO&lt;/i&gt; as his title on his slides.  Wasn&apos;t he hired as &quot;Chief Scientist&quot; &lt;a href=&quot;http://www.aspectprogrammer.org/blogs/adrian/2005/09/joining_interfa.html&quot;&gt;originally&lt;/a&gt;? I wonder why his title changed?  Maybe having the CTO title is a better way of getting more cash when the buyout happens?  What buyout you ask?  I don&apos;t know, but I can&apos;t help but think that Interface21 is on the radar of major organizations like Oracle and BEA.  While it might suck for those guys to answer to a larger organization, it would be nice to see Rod, Juergen, et. al. benefit ($$) from all their hard work.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Agenda&lt;/strong&gt;
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot; style=&quot;margin-top: 0&quot;&gt;
&lt;li&gt;What is OSGi?&lt;/li&gt;
&lt;li&gt;What problems does it help us to solve?&lt;/li&gt;
&lt;li&gt;How does it work?&lt;/li&gt;
&lt;li&gt;Where does Spring fit in?&lt;/li&gt;
&lt;li&gt;Spring-OSGi&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
One of the first questions people ask about OSGi is &quot;what the heck is it?&quot;
&lt;/p&gt;
&lt;blockquote&gt;&lt;em&gt;
 The 2nd question is &quot;what&apos;s with the lowercase i?&quot; Seriously - does anyone know?&lt;/em&gt;&lt;/blockquote&gt;
&lt;p&gt;
Most people don&apos;t even know what it is. OSGi stands for &lt;b&gt;O&lt;/b&gt;pen &lt;b&gt;S&lt;/b&gt;ervices &lt;b&gt;G&lt;/b&gt;ateway &lt;b&gt;i&lt;/b&gt;nitiative. From the very beginning, it was designed to be lightweight and dynamic. This is the major difference between it and other containers.  It&apos;s always been designed to have things added and removed.  Now it&apos;s tagline is: &quot;The Dynamic Module System for Java&quot;.
&lt;br/&gt;&lt;br/&gt;
It&apos;s designed to allow you to partition a system into a number of modules (a.k.a. bundles).  There&apos;s strict visibility rules (similar to protected and private).  There&apos;s a resolution process (dependencies are satisfied) and it understands versioning.
&lt;br/&gt;&lt;br/&gt;
It&apos;s dynamic! Modules can be installed, started, stopped, uninstalled and updated - all at runtime.
&lt;br/&gt;&lt;br/&gt;
It&apos;s even service oriented (no wonder IBM loves it). Bundles can &lt;i&gt;publish&lt;/i&gt; services (dynamically).  The Service Registry allows other bundles to &lt;i&gt;find&lt;/i&gt; services and &lt;i&gt;bind&lt;/i&gt; to them.  Services come and go at runtime, all taken care of for you.
&lt;br/&gt;&lt;br/&gt;
Where does OSGi come from?  It&apos;s backed by the &lt;a href=&quot;http://www.osgi.org&quot;&gt;OSGi Alliance&lt;/a&gt;. Unfortunately, this site makes it difficult to figure out exactly what OSGi is.  The founders of OSGi understood it needed to be lightweight and dynamic from day one.  It started in 1999, and was originally focues on embedded Java nd networked devices.  In 2003 it was exteneded to support to mobile devices.  In 2004, it had significant ope source community opttion with Eclipse.  In 2006 and 2007, it&apos;s moving into server-side Java.
&lt;br/&gt;&lt;br/&gt;
Who&apos;s doing OSGi containers?&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Open-source implementations: Equinox, Felix (Apache), Knopflerfish&lt;/li&gt;
&lt;li&gt;Significant Enterprise usage: Eclipse, IBM (WebSphere, Lotus), JOnAS, interest from BEA and Oracle&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;So what?&lt;/strong&gt; What problems does OSGi solve?
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color:#666&quot;&gt;Visibility&lt;/b&gt;
By default, a bundle is a black box.  It&apos;s completely protected and you can&apos;t see inside it, not even with reflection or any other classloading trickery. Only exported packages are visible outside of the exporting bundle. This stops unintended coupling between modules, enables independent development, faster development cycles and security.
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color:#666&quot;&gt;Operational Control&lt;/b&gt;&lt;br/&gt;
An OSGi container allows you to see all modules and their status - using the OSGi console or JMX.  You can get information on wiring, install new bundles, activate bundles (and publish services), deactivate bundles (and unregister services), refresh bundles, stop bundles and uninstall bundles.  The beauty?  You can do all of this &lt;i&gt;without stopping or restarting the application!&lt;/i&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color:#666&quot;&gt;What is an OSGi bundle?&lt;/b&gt;&lt;br/&gt;
It&apos;s just a jar file.  There&apos;s no complicated tools or sophisticated packaging required.  All you need is a symbolic name in your META-INF/MANIFEST.MF file.  For example:
&lt;/p&gt;
&lt;pre&gt;
Bundle-SymbolicName: org.swf.beans
&lt;/pre&gt;
&lt;p&gt;There are a number of other attributes you can specify, but the SymbolicName is the only &lt;i&gt;required&lt;/i&gt; one. 
&lt;br/&gt;&lt;br/&gt;
There&apos;s a Maven OSGi Plugin.  The major change from a regular JAR project is &amp;lt;packaging&amp;gt;jar&amp;lt;/packaging&gt; -&gt; &amp;lt;packaging&gt;&lt;b&gt;osgi-bundle&lt;/b&gt;&amp;lt;/packaging&gt;.
&lt;/p&gt;
&lt;blockquote&gt;
Sidenote: You have to love how Maven is so Google un-friendly.  &lt;a href=&quot;http://www.google.com/search?q=Maven+OSGi+Plugin&quot;&gt;Searching for Maven OSGi Plugin&lt;/a&gt; doesn&apos;t seem to provide a definitive answer to the Maven plugin that Adrian is talking about.  I&apos;m guessing Maven has OSGi support natively?
&lt;/blockquote&gt;
&lt;p&gt;
Eclipse has fantastic tooling support for OSGi via &quot;plug-ins&quot;.  You can create a new &quot;plug-in project&quot; and use Eclipse to create/edit your OSGi manifest.  Eclipse calls bundles &quot;plug-ins&quot; - so creating a plug-in project is the same thing as creating a new bundle.
&lt;br/&gt;&lt;br/&gt;
Export-Package is a header (a.k.a. manifest entry) used to export types for other bundles to use.  If it&apos;s not exported, it&apos;s not visible. For example:
&lt;/p&gt;
&lt;pre&gt;
Export-Package: org.xyz.m1.service, 
                org.xyz.m2.service, 
                org.xyz.m3.service
&lt;/pre&gt;
&lt;p&gt;
You can also specify a version by adding a semicolon after the package and specifying &quot;version=#&quot;.  For example:
&lt;/p&gt;
&lt;pre&gt;
Export-Package: org.xyz.m1.service; version=1.0, 
                org.xyz.m2.service; version=1.0, 
                org.xyz.m3.service; version=1.0
&lt;/pre&gt;
&lt;p&gt;
In addition to specifying specific versions, there&apos;s syntax to control a specific versions.  For the examples above, OSGi will actually get any version 1.0 and above.  
&lt;br/&gt;&lt;br/&gt;
For the next 10 minutes, Adrian talked about how class-loading and resolution works.  He also pointed out how to bootstrap a bundle (using the BundleActivator interface) and the basics of the Service Registry. The BundleContext allows you to get and remove services.
&lt;br/&gt;&lt;br/&gt;
What about JSR 277 (Java Module System)? It&apos;s a very crude version of OSGi with its &quot;RequireBundle&quot; mechanism.  The key problem is the lack of dynamics (loading/unloading of modules). Peter Kriens (of the OSGi Alliance) shares his thoughts on this in his &lt;a href=&quot;http://www.osgi.org/blog/2006/10/jsr-277-review.html&quot;&gt;JSR 277 Review&lt;/a&gt;. JSR 291 (Dynamic Component Support for Java SE) may kill 277 because it relies on OSGi. Its goal:
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
Establish a JCP specification for a dynamic component 
framework supporting existing Java SE environments based 
on the OSGi dynamic component model specifications. &quot; 
&lt;/p&gt;
&lt;p&gt;
&lt;strong style=&quot;color: #333&quot;&gt;What about Spring?&lt;/strong&gt;
&lt;br/&gt;
OSGi offers an excellent foundation for building enterprise applications.  How can you exploit the power and sophistication of OSGi w/o adding complexity?  How can you split your application into a number of OSGi bundles? Between bundles, you need an easy way to expose bundles as services and wire service references b/w them.  What about testing?  How can you test bundles w/o running them inside an OSGi container?
&lt;br/&gt;&lt;br/&gt;
&lt;a href=&quot;http://www.springframework.org/osgi&quot;&gt;Spring-OSGi&lt;/a&gt; hopes to allow you to build on OSGi, but deploy in Tomcat, WebSphere, WebLogic or any other application server.  Basically, it gives you an &quot;OSGi powered Web Application&quot;.
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color: #666&quot;&gt;Project Goals:&lt;/b&gt; Bring the benefits of OSGi to enterprise applications and use Spring to configure modules/bundles. In addition, make it easy to code your applications w/o depending on OSGi APIs and make it easy to unit and integration test.
&lt;br/&gt;&lt;br/&gt;

&lt;b style=&quot;color: #666&quot;&gt;Project Collaborators&lt;/b&gt;: Adrian is the lead, and there&apos;s active committers from BEA and Oracle. Input to the project&apos;s specification has been gathered from OSGi Alliance (technical director and CTO), BEA, Oracle, IBM, Eclipse Equinox, Felix and many individuals.
&lt;br/&gt;&lt;br/&gt;
Spring modules (spring-core, spring-beans, spring-aop) will be shipped as OSGi bundles in Spring 2.1.  All the necessary import and export package headers will be pre-defined.  This will enable an OSGi application to import and use Spring packages and services.
&lt;br/&gt;&lt;br/&gt;
&lt;a href=&quot;http://static.springframework.org/maven2/spring-osgi/apidocs/org/springframework/osgi/context/support/OsgiBundleXmlApplicationContext.html&quot;&gt;OsgiBundleXmlApplicationContext&lt;/a&gt; is a Spring application context based on an OSGi bundle.  It uses the bundle context and classloader to load resources and implements Spring&apos;s resource abstraction for OSGi. There is a &quot;bundle:&quot; prefix for specifying an explicit path.
&lt;br/&gt;&lt;br/&gt;
To do integration testing with Spring-OSGi, you can extend &lt;a href=&quot;http://static.springframework.org/maven2/spring-osgi/apidocs/org/springframework/osgi/test/ConfigurableBundleCreatorTests.html&quot;&gt;ConfigurableBundleCreatorTests&lt;/a&gt;.  This automatically creates an OSGi bundle containing the tests on the fly.  This class handles starting an OSGi container, installs all bundles and runs tests inside OSGi.  Currently, it supports Equinox, Felix and Knopflerfish.  If you&apos;re using Maven, it&apos;s simple to switch containers with profiles (i.e. -Pfelix).  Adrian did a demo in Eclipse.  I didn&apos;t seem the OSGi container starting (or him specify which one to use) but the test seemed to finish rather quickly.
&lt;br/&gt;&lt;br/&gt;
To interact with OSGi, there are a number of conveniences that Spring-OSGi provides: BundleContextAware, &amp;lt;osgi:property-placeholder&gt;, &amp;lt;osgi:bundle&amp;gt; (starts other bundles), &amp;lt;osgi:virtual-bundle&gt; (bundle created on the fly).
&lt;br/&gt;&lt;br/&gt;
&lt;b style=&quot;color: #666&quot;&gt;OSGi-based web applications&lt;/b&gt;
&lt;br/&gt;
It&apos;s entirely possible to run an OSGi container embedded in another container. Remember it&apos;s lightweight enough to run in a phone! Even &lt;i&gt;OSGi in OSGi&lt;/i&gt; is supported.
&lt;br/&gt;&lt;br/&gt;
Equinox is the only OSGi container that currently supports web applications.  It uses a &quot;bridge servlet&quot; that acts as a front controller and dispatches servlet requests to bundles. To package your application as and deploy it to Equinox, you basically have to create a WAR with the bridge servlet as the only entry in web.xml and the only JAR in WEB-INF/lib is servletbridge.jar.  Everything else is packaged under /WEB-INF/eclipse.  Here&apos;s what that looks like:
&lt;/p&gt;
&lt;pre&gt;
WEB-INF 
    web.xml  
    lib/servletbridge.jar 
    eclipse 
        launch.ini 
        configuration/config.ini 
        features 
        plugins 
            &amp;lt;your-bundles&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
Adrian did a demo showing a simple &quot;Hello World&quot; example deployed into an OSGi container.  The output from the demo in the browser wasn&apos;t much.  However, he showed how you could use an OSGi Console to interact (start/stop/refresh) all the different bundles.  The fact that you can do this all at runtime has some pretty interesting implications. 
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color:#333&quot;&gt;My Thoughts&lt;/strong&gt;&lt;br/&gt;
The demo makes Servlet/EJB containers look somewhat primitive. Will OSGi containers be the next generation of application servers? It seems somewhat likely, but as Adrian said, most of this stuff is on the bleeding edge (or even &quot;razors edge&quot; to quote Adrian). My guess is OSGi will be a very interesting space in 2007.  However, I don&apos;t see myself deploying WARs to OSGi containers anytime soon. Maybe in 2008.
&lt;br/&gt;&lt;br/&gt;
Can OSGi power a web application&apos;s plugin architecture?  It doesn&apos;t seem like it. The web application would have to be deployed in an OSGi container to make this possible.  Either that, or the web application would have to be an OSGi container itself.

</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/tse_the_holy_grails_of</id>
        <title type="html">[TSE] The Holy Grails of Web Frameworks with Guillaume LaForge</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/tse_the_holy_grails_of"/>
        <published>2006-12-09T12:31:25-07:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <summary type="html">Under the hood, Grails uses Spring MVC.  It has support for &quot;flash scope&quot; between requests. 
&lt;/p&gt;
&lt;blockquote&gt;
I find it funny that flash scope is so popular these days, we&apos;ve had this in AppFuse for four years.  However, web frameworks didn&apos;t add native support for it until it had a name (provided by Rails).  To be fair to Struts Classic, they had support for it before Rails was even invented.
&lt;/blockquote&gt;
&lt;p&gt;Rather than JSPs, Grails uses Grails Server Pages, which look much like JSPs. Grails uses SiteMesh by default and allows you to easily change the layout used with a meta tag.
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;meta name=&quot;layout&quot; content=&quot;main&quot;/&gt;
&lt;/pre&gt;
&lt;p&gt;Most of the dynamic attributes in a GSP are rendered using the various &quot;g&quot; tags.  There&apos;s dynamic taglibs for logic (if, else, elseif), iterating, linking, ajax (remoteFunction, remoteLink, formRemote, submitToRemote), form (select, currencySelect, localeSelect, datePicker, checkBox), rendering (render*, layout*, paginate), validation (eachError, hasError, message) and UI (i.e. richtexteditor). </summary>
        <content type="html">&lt;em&gt;I only made it to the 2nd half of this talk because I got &lt;a href=&quot;http://raibledesigns.com/page/rd?entry=good_ol_i_95&quot;&gt;stuck in traffic on I-95&lt;/a&gt;.&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;
Under the hood, Grails uses Spring MVC.  It has support for &quot;flash scope&quot; between requests. 
&lt;/p&gt;
&lt;blockquote&gt;
I find it funny that flash scope is so popular these days, we&apos;ve had this in AppFuse for four years.  However, web frameworks didn&apos;t add native support for it until it had a name (provided by Rails).  To be fair to Struts Classic, they had support for it before Rails was even invented.
&lt;/blockquote&gt;
&lt;p&gt;Rather than JSPs, Grails uses Grails Server Pages, which look much like JSPs. Grails uses SiteMesh by default and allows you to easily change the layout used with a meta tag.
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;meta name=&quot;layout&quot; content=&quot;main&quot;/&gt;
&lt;/pre&gt;
&lt;p&gt;Most of the dynamic attributes in a GSP are rendered using the various &quot;g&quot; tags.  There&apos;s dynamic taglibs for logic (if, else, elseif), iterating, linking, ajax (remoteFunction, remoteLink, formRemote, submitToRemote), form (select, currencySelect, localeSelect, datePicker, checkBox), rendering (render*, layout*, paginate), validation (eachError, hasError, message) and UI (i.e. richtexteditor). 
&lt;br/&gt;&lt;br/&gt;
Grails also allows you to write your own taglibs with a much simpler syntax. For example:
&lt;/p&gt;
&lt;!-- ======================================================== --&gt;
&lt;!-- = Java Sourcecode to HTML automatically converted code = --&gt;
&lt;!-- =   Java2Html Converter V3.5 2003 by Markus Gebhard  markus@jave.de   = --&gt;
&lt;!-- =     Further information: http://www.java2html.de     = --&gt;
&lt;div class=&quot;java&quot; style=&quot;margin-left: 30px&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot; bgcolor=&quot;#ffffff&quot;&gt;
   &lt;tr&gt;
  &lt;!-- start source code --&gt;
   &lt;td nowrap=&quot;nowrap&quot; valign=&quot;top&quot; align=&quot;left&quot;&gt;
    &lt;code&gt;
&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;class&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;MyTagLib&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt; {&amp;nbsp;&lt;/font&gt;&lt;br/&gt;

&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;def&amp;nbsp;isAdmin=&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;{&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;attrs,&amp;nbsp;body-&amp;gt;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;def&amp;nbsp;user&amp;nbsp;=&amp;nbsp;attrs&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;[&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&amp;#34;user&amp;#34;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;]&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;user!=&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;null&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;&amp;amp;&amp;amp;&amp;nbsp;checkUserPrivs&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;user&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;))&amp;nbsp;&lt;/font&gt;&lt;br/&gt;

&lt;font color=&quot;#ffffff&quot;&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;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;body&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;()&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;}&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#000000&quot;&gt;}&amp;nbsp;&lt;/font&gt;&lt;/code&gt;
    
   &lt;/td&gt;
  &lt;!-- end source code --&gt;
   &lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;!-- =       END of automatically generated HTML code       = --&gt;
&lt;!-- ======================================================== --&gt;

&lt;p&gt;Then you can use it in your GSP:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;g:isAdmin user=&quot;${myUser}&quot;&gt; 
    some restricted content 
&amp;lt;/g:isAdmin&gt; 
&lt;/pre&gt;
&lt;p&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Is Grails Enterprise Ready?&lt;/strong&gt;
&lt;br/&gt;
Yes, because it uses existing Java libraries.  Since you can create a WAR from your Grails project (using &quot;grails war&quot;), you can &quot;protect your investment&quot; and deploy it to your expensive app server.  Although Grails is based on Groovy, it&apos;s a very easy language to learn for Java developers.  In fact, there&apos;s hardly anything to learn.  Most of the learning involves learning &lt;i&gt;simpler&lt;/i&gt; ways of doing things. You can also use GORM (and its dynamic finder methods) outside of Grails.  You can re-use the EJB3 annotated mapped beans and even the taglibs in your JSPs - it&apos;s all Java bytecode in the end.
&lt;br/&gt;&lt;br/&gt;
More to come! On the roadmap: DSL for scripting Spring, plugins, flow/conversation concept with Spring Web Flow, JPA support, Web Services convention, customized URL mapping, JSP custom taglib support and finer-grained DB schema control. &quot;It&apos;s up to you to vote for and prioritize new features!&quot;
&lt;br/&gt;&lt;br/&gt;
Books: &lt;a href=&quot;http://www.manning.com/koenig/&quot;&gt;Groovy in Action&lt;/a&gt; will be printing next week and &lt;a href=&quot;http://www.apress.com/book/bookDisplay.html?bID=10205&quot;&gt;The Definitive Guide to Grails&lt;/a&gt; will be out early next year.  The existing documentation for Grails is 224 pages - so there&apos;s lots of information freely available as well.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;My Thoughts&lt;/strong&gt;&lt;br/&gt;
I didn&apos;t know that Grails allows you to generate Canoo WebTest tests for your UI.  I agree that WebTest is an excellent way to test UIs, but I think Selenium is better.  The major reason they&apos;re using WebTest seems to be because one of the WebTest guys happens to be a Groovy committer. I plan on learning (and hopefully using) Groovy and Grails in 2007.  
&lt;br/&gt;&lt;br/&gt;
The reasons for the Groovy and Grails projects seem kinda strange. I created AppFuse to solve my needs when starting new Java projects. Rails was extracted from Basecamp because it solved problems for DHH. Grails seems to be invented as a Rails clone.  It doesn&apos;t actually solve a problem - except that Groovy needs a &quot;killer app&quot; like Ruby has with Rails. 
&lt;br/&gt;&lt;br/&gt;
Regardless of Grails&apos; reason for living, I still plan on adding it to my toolbox as it seems like a very nice way to develop web applications. Maybe that&apos;s its reason for living?  My question is this: do its developers use it to write real-world applications, or is this another project (like Craig McClanahan and Struts) where the lead guys don&apos;t actually write real-world applications? &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/tse_designing_stateful_web_application</id>
        <title type="html">[TSE] Designing Stateful Web Application Control Flow with Erwin Vervaet</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/tse_designing_stateful_web_application"/>
        <published>2006-12-08T15:47:49-07:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <summary type="html">Spring Web Flow (SWF) does not fit into an application or a feature where free-flow navigation is required. It works best where you need to lock down and control navigation. SWF is not designed to be a web framework, but rather to solve the specific problem of navigation and state management between many pages.
&lt;br/&gt;&lt;br/&gt;
Erwin is a Senior consultant at &lt;a href=&quot;http://www.ervacon.com/&quot;&gt;Ervacon&lt;/a&gt; and has extensive experience using Java SE and Java EE. He is the inventor and co-lead of the Spring Web Flow project.</summary>
        <content type="html">Spring Web Flow (SWF) does not fit into an application or a feature where free-flow navigation is required. It works best where you need to lock down and control navigation. SWF is not designed to be a web framework, but rather to solve the specific problem of navigation and state management between many pages.
&lt;br/&gt;&lt;br/&gt;
Erwin is a Senior consultant at &lt;a href=&quot;http://www.ervacon.com/&quot;&gt;Ervacon&lt;/a&gt; and has extensive experience using Java SE and Java EE. He is the inventor and co-lead of the Spring Web Flow project.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Core Functionality&lt;/strong&gt;
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Navigation is controlled by a flow (complete navigational control)&lt;/li&gt;
&lt;li&gt;Automatic state management (scoping, cleanup)&lt;/li&gt;
&lt;li&gt;A flow is a reusable application module (fully encapsulated: input/output contract, black box)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Spring Web Flow provides Navigational Control.  A &lt;i&gt;flow definition&lt;/i&gt; controls the entire conversation.  The flow &lt;i&gt;is&lt;/i&gt; the controller and drives all navigation.  When user input is required, the flow &lt;i&gt;pauses&lt;/i&gt; and a view is rendered. Clients &lt;i&gt;signal&lt;/i&gt; events and are unaware of overall navigation rules.  The flow reacts to user events and decides what to do next. A flow is a simple Finite State Machine (a set of states with transitions b/w them).  SWF is &lt;i&gt;not&lt;/i&gt; a general purpose workflow engine.  It&apos;s simplified for use with web conversations and lacks features like split and join.
&lt;/p&gt;
&lt;p&gt;SWF provides state management with web continuations. What is a web continuation you ask?
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;A continuation is a saved snapshot of the executable state of a program at any given point in time.  It is possible to restore this state and restart the execution of the program from that point onward.&lt;/p&gt;
&lt;p&gt;The flow execution repository takes a snapshot of flow execution for each request. In a sense, the flow execution &lt;i&gt;becomes&lt;/i&gt; a continuation.
&lt;/p&gt;
&lt;p&gt;Spring Web Flow is a very advanced state management mechanism.  It has fully automatic state management with scopes (converstation, flow, flash, request), cleanup, compatible with browser buttons (back, forward, refresh, new window).  Finally, flows are observable using &lt;code&gt;FlowExecutionListener&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;To link to services (or call service-level beans), you can simply use your normal bean ids. You can subclass SWF&apos;s &lt;a href=&quot;http://static.springframework.org/spring-webflow/docs/1.0.x/api/org/springframework/webflow/execution/Action.html&quot;&gt;Action&lt;/a&gt; and inject your services into it.  However, in most cases, you can simply use SWF&apos;s FormAction class.  SWF can bind to any POJO method.  For example:
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;bean-action bean=&quot;phonebook&quot; method=&quot;search&quot;&amp;gt; 
    &amp;lt;method-arguments&amp;gt; 
        &amp;lt;argument expression=&quot;flowScope.searchCriteria&quot;/&amp;gt; 
    &amp;lt;/method-arguments&amp;gt; 
    &amp;lt;method-result name=&quot;results&quot;/&amp;gt; 
&amp;lt;/bean-action&amp;gt;
&lt;/pre&gt;
&lt;p&gt;This might bind to the following interface, which is wired up as the &quot;phonebook&quot; bean.&lt;/p&gt;
&lt;div class=&quot;java&quot; style=&quot;margin-left: 30px&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot; bgcolor=&quot;#ffffff&quot;&gt;
   &lt;tr&gt;
  &lt;!-- start source code --&gt;
   &lt;td nowrap=&quot;nowrap&quot; valign=&quot;top&quot; align=&quot;left&quot;&gt;
    &lt;code&gt;
&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;public&amp;nbsp;interface&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Phonebook&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;{&amp;nbsp;&lt;/font&gt;&lt;br/&gt;

&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;List&amp;lt;Person&amp;gt;&amp;nbsp;search&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;SearchCriteria&amp;nbsp;criteria&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Person&amp;nbsp;getPerson&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Long&amp;nbsp;id&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;

&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Person&amp;nbsp;getPerson&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;String&amp;nbsp;userId&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#000000&quot;&gt;}&lt;/font&gt;&lt;/code&gt;
    
   &lt;/td&gt;
  &lt;!-- end source code --&gt;
   &lt;/tr&gt;

&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;To deploy a flow definition, you first have to define your flows in a &lt;i&gt;flow registry&lt;/i&gt;.
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;flow:registry id=&quot;flowRegistry&quot;&amp;gt; 
    &amp;lt;flow:location path=&quot;/WEB-INF/flows/**-flow.xml&quot;/&amp;gt; 
&amp;lt;/flow:registry&amp;gt;
&lt;/pre&gt;
&lt;p&gt;A flow id is assigned by convention. For example, &lt;code&gt;/WEB-INF/flows/search-flow.xml&lt;/code&gt; becomes &quot;search-flow&quot;.&lt;/p&gt;
&lt;p&gt;To execute a flow, you need to define a &lt;i&gt;flow executor&lt;/i&gt; that manages flow on behalf of the client.  It loads flow definitions (from flowRegistry), drives flow executions (launch, resume, refresh) and saves/loads flow execution b/w requests (execution repository and state management).
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;flow:executor id=&quot;flowExecutor&quot; registry-ref=&quot;flowRegistry&quot; 
    repository-type=&quot;continuation&quot;/&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Finally, you&apos;ll need to configure a &quot;Flow Controller&quot;.  This is specific to the web framework you&apos;re using.  Below is an example for Spring MVC:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;bean name=&quot;/phonebook.htm&quot; class=&quot;org.springframework.webflow.executor.mvc.FlowController&quot;&amp;gt; 
    &amp;lt;property name=&quot;flowExecutor&quot; ref=&quot;flowExecutor&quot;/&amp;gt; 
&amp;lt;/bean&amp;gt;
&lt;/pre&gt;
&lt;p&gt;SWF exposes some variables to the view model, namely &quot;flowExecutionContext&quot; and &quot;flowExecutionKey&quot;. To participate in a flow execution, you have to submit  &lt;code&gt;_flowExecutionKey&lt;/code&gt; and &lt;code&gt;_eventId&lt;/code&gt; parameters in every request.  For a form, these can be hidden fields:
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;form:form action=&quot;phonebook.htm&quot; commandName=&quot;searchCriteria&quot; method=&quot;post&quot;&amp;gt; 
    &amp;lt;input type=&quot;hidden&quot; name=&quot;_flowExecutionKey&quot; value=&quot;${flowExecutionKey}&quot;&amp;gt; 
    &amp;lt;input type=&quot;submit&quot; class=&quot;button&quot; name=&quot;_eventId_search&quot; value=&quot;Search&quot;&amp;gt; 
    ... 
&amp;lt;/form:form&amp;gt; 
&lt;/pre&gt;
&lt;p&gt;For links, you&apos;ll need to include these parameters as well:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;a href=&quot;phonebook.htm?_flowExecutionKey=${flowExecutionKey}&amp;amp;amp;_eventId=select&amp;amp;amp;id=${colleague.id}&quot;&amp;gt; 
${colleague.firstName} ${colleague.lastName}&amp;lt;/a&amp;gt;
&lt;/pre&gt;
&lt;blockquote&gt;NOTE: This morning, I asked Rob Harrop if the _flowExecutionKey hidden field will ever be auto-generated by the &amp;lt;form:form&amp;gt; tag. His response was that they are doing something to make this more automatic, but it may not happen in the context of the &amp;lt;form:form&amp;gt; tag.&lt;/blockquote&gt;
&lt;p&gt;&lt;strong style=&quot;color: #666&quot;&gt;Best Practices&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;By default, SWF does redirect after POST. To change it, you can configure the flowExecutor bean a bit differently.
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;flow:executor id=&quot;flowExecutor&quot; registry-ref=&quot;flowRegistry&quot; repository-type=&quot;continuation&quot;&amp;gt; 
    &amp;lt;flow:execution-attributes&amp;gt; 
        &amp;lt;flow:alwaysRedirectOnPause value=&quot;false&quot;/&amp;gt; 
    &amp;lt;/flow:execution-attributes&amp;gt; 
&amp;lt;/flow:executor&amp;gt;
&lt;/pre&gt;
&lt;p&gt;You can also explicitly use the &quot;redirect:&quot; prefix in the view name. In other words, the best practice of &quot;Redirect after POST&quot; has been built-in for you.&lt;/p&gt;
&lt;p&gt;SWF comes with 4 repository (storage) implementations:&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;&lt;b&gt;simple&lt;/b&gt;: single flow execution per converstation (flowExecutionKey changes on every request), low resource usage, no browser button support.  Use when you can lock down the browser and resources (memory) are scarce. By default, displays a nice stack trace (&lt;a href=&quot;http://static.springframework.org/spring-webflow/docs/1.0.x/api/org/springframework/webflow/execution/repository/PermissionDeniedFlowExecutionAccessException.html&quot;&gt;PermissionDeniedFlowExecutionAccessException&lt;/a&gt;) when you click back. Use case: your company has removed the back and forward buttons from end-user&apos;s customized browsers.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;singleKey&lt;/b&gt;: same as simple repository, but keeps same flowExecutionKey over the lifecycle of the flow. Tricks the browser into thinking it keeps refreshing the same exact page - there is no browser history. They do this by using the exact same URL for every page. The nice thing about using this repository is it really does disable the back and forward buttons.  Use case: low memory available and want to block back/forward button usage.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;continuation&lt;/b&gt;: the default implementation if you don&apos;t specify the &quot;repository-type&quot; attribute on your flowExecutor. Allows free browsing in a controlled way.  The downside is high memory usage because many snapshots are taken.  Snapshots contain all the data associated with the conversation; more than just request parameters. Use when you have enough resources available and browser buttons need to be supported. The flowExecutionKey is different for each and every request in order to record the unique id of the snapshot.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;client&lt;/b&gt;: flow execution stored &lt;i&gt;in&lt;/i&gt; the flowExecutionKey and on the client. It&apos;s nice because there&apos;s low resource usage on the server.  However, it only supports POST (b/c of GET URL length limits).  It also requires more bandwidth, has security concerns and has no support for double submit out-of-the-box.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Best practice? Use the correct repository for your situation! Somebody asked if SWF provides the information to build a &quot;breadcrumbs&quot; type of menu.  Erwin says &quot;yes&quot;, but there&apos;s no way to easily access that information (i.e. with JSP tags). Another audience member asks if it&apos;s possible to invalid snapshots?  Erwin says &quot;no&quot;, but it is possible to configure the maximum number of snapshots to store.  They are considering adding support for invalidating certain snapshots after you pass a certain state in the flow.&lt;/p&gt;
&lt;p&gt;Even though I knew a lot about SWF going into this talk, I was very impressed with Erwin&apos;s presentation. He did an excellent job at doing live demos that showed the different features of SWF.  Even better, he did them with SWF&apos;s &quot;phonebook&quot; application, so it should be possible to reproduce many of his demos.  At the end of his presentation, Erwin listed a number of resources for Spring Web Flow:&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://www.springframework.org/webflow&quot;&gt;Spring Web Flow Homepage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://forum.springframework.org/forumdisplay.php?f=36&quot;&gt;Community Forum&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ervacon.com/products/swf/&quot;&gt;Ervacon Spring Web Flow Portal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://spring.ervacon.com&quot;&gt;Test the sample applications on-line&lt;/a&gt; 
&lt;li&gt;Books: &lt;a href=&quot;http://www.amazon.com/Expert-Spring-MVC-Web-Flow/dp/159059584X&quot;&gt;Expert Spring MVC and Web Flow&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I recently updated &lt;a href=&quot;http://springlive.com&quot;&gt;Spring Live&apos;s&lt;/a&gt; Chapter 13 for SWF 1.0, but &lt;span style=&quot;text-decoration: line-through&quot;&gt;Erwin and Keith&apos;s&lt;/span&gt; Expert Spring MVC and Web Flow (by Seth Ladd, Darren Davison, Steven Devijver and Colin Yates) is much better than my 10-page example. My updated chapter is currently in tech edit, so you may have to wait another couple weeks before it&apos;s in a released version.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/tse_using_dynamic_languages_with</id>
        <title type="html">[TSE] Using Dynamic Languages with Spring with Rod Johnson and Guillaume LaForge</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/tse_using_dynamic_languages_with"/>
        <published>2006-12-08T13:27:43-07:00</published>
        <updated>2008-05-26T18:30:32-06:00</updated> 
        <category term="/Java" label="Java" />
        <summary type="html">Spring 2.0 has dynamic language support.  To make it work, you do need a Java interface as a contract between callers and dynamic beans.  There&apos;s no special requirements on the interface. It&apos;s a &quot;POJI&quot; and doesn&apos;t have to extend or implement anything. For example:
&lt;/p&gt;
&lt;div class=&quot;java&quot; style=&quot;margin-left: 30px&quot;&gt;
&lt;table bgcolor=&quot;#ffffff&quot; border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot;&gt;
   &lt;tbody&gt;&lt;tr&gt;
  &lt;!-- start source code --&gt;
   &lt;td align=&quot;left&quot; nowrap=&quot;nowrap&quot; valign=&quot;top&quot;&gt;
    &lt;code&gt;

&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;public&amp;nbsp;interface&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Messenger&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;{&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;String&amp;nbsp;getMessage&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;()&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#000000&quot;&gt;}&lt;/font&gt;&lt;/code&gt;
    
   &lt;/td&gt;
  &lt;!-- end source code --&gt;
   &lt;/tr&gt;

&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;There&apos;s 3 ways of configuring &lt;a href=&quot;http://groovy.codehaus.org&quot;&gt;Groovy&lt;/a&gt; beans:
&lt;/p&gt;
&lt;ol style=&quot;margin-bottom: 3px&quot;&gt;
&lt;li&gt; &lt;a href=&quot;http://www.springframework.org/docs/api/org/springframework/scripting/groovy/GroovyScriptFactory.html&quot;&gt;GroovyScriptFactory&lt;/a&gt; &amp;lt;bean&amp;gt; element defining source location and properties
&lt;/li&gt;
&lt;li&gt; &amp;lt;lang:groovy&amp;gt; element from a &amp;lt;lang&amp;gt; namespace
&lt;/li&gt;
&lt;li&gt; POBD (Plain old &amp;lt;bean&amp;gt; definition) - this is unique for Groovy since it can be compiled into Java bytecode
&lt;/li&gt;
&lt;/ol&gt;&lt;p style=&quot;margin-top: 0&quot;&gt;</summary>
        <content type="html">Spring 2.0 has dynamic language support.  To make it work, you do need a Java interface as a contract between callers and dynamic beans.  There&apos;s no special requirements on the interface. It&apos;s a &quot;POJI&quot; and doesn&apos;t have to extend or implement anything. For example:
&lt;/p&gt;
&lt;div class=&quot;java&quot; style=&quot;margin-left: 30px&quot;&gt;
&lt;table bgcolor=&quot;#ffffff&quot; border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot;&gt;
   &lt;tbody&gt;&lt;tr&gt;
  &lt;!-- start source code --&gt;
   &lt;td align=&quot;left&quot; nowrap=&quot;nowrap&quot; valign=&quot;top&quot;&gt;
    &lt;code&gt;

&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;public&amp;nbsp;interface&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Messenger&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;{&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;String&amp;nbsp;getMessage&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;()&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#000000&quot;&gt;}&lt;/font&gt;&lt;/code&gt;
    
   &lt;/td&gt;
  &lt;!-- end source code --&gt;
   &lt;/tr&gt;

&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;There&apos;s 3 ways of configuring &lt;a href=&quot;http://groovy.codehaus.org&quot;&gt;Groovy&lt;/a&gt; beans:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt; &lt;a href=&quot;http://www.springframework.org/docs/api/org/springframework/scripting/groovy/GroovyScriptFactory.html&quot;&gt;GroovyScriptFactory&lt;/a&gt; &amp;lt;bean&amp;gt; element defining source location and properties
&lt;/li&gt;
&lt;li&gt; &amp;lt;lang:groovy&amp;gt; element from a &amp;lt;lang&amp;gt; namespace
&lt;/li&gt;
&lt;li&gt; POBD (Plain old &amp;lt;bean&amp;gt; definition) - this is unique for Groovy since it can be compiled into Java bytecode
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Any of these three options can take injected properties.
&lt;/p&gt;
&lt;p&gt;To configure a dynamic language component using the &lt;tt&gt;GroovyScriptFactory&lt;/tt&gt;, you need to do the following:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; You need a &lt;a href=&quot;http://www.springframework.org/docs/api/org/springframework/scripting/support/ScriptFactoryPostProcessor.html&quot;&gt;ScriptFactoryPostProcessor&lt;/a&gt; to ensure that dynamic bean definitions are processed at startup 
&lt;/li&gt;
&lt;li&gt; Create bean definitions using generic &lt;tt&gt;GroovyScriptFactory&lt;/tt&gt; or other language-specific factory 

&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&amp;lt;bean class=&quot;org.sfw.scripting.support.ScriptFactoryPostProcessor&quot;/&amp;gt; 

&amp;lt;bean id=&quot;messenger&quot; class=&quot;org.sfw.scripting.groovy.GroovyScriptFactory&quot;&amp;gt; 
    &amp;lt;constructor-argvalue=&quot;classpath:org/sfw/scripting/groovy/Messenger.groovy&quot;/&amp;gt; 
    &amp;lt;property name=&quot;message&quot; value=&quot;Hello World&quot;/&amp;gt; 
&amp;lt;/bean&amp;gt;
&lt;/pre&gt;

&lt;p&gt;The 2nd way to configure Spring to use a bean from a dynamic language is to use the &amp;lt;lang&amp;gt; namespace. A namespace handler is appropriate when you need to create multiple beans to configure a single feature.  Another indication that a namespace is appropriate is when your bean definitions follow a certain pattern (i.e. GroovyScriptFactory always requires a constructor argument). Using the &amp;lt;lang&amp;gt; namespace allows the &lt;tt&gt;ScriptFactoryPostProcessor&lt;/tt&gt; to be registered automatically.

&lt;/p&gt;
&lt;pre&gt;&amp;lt;lang:groovy id=&quot;refreshableMessenger&quot; 
    script-source=&quot;classpath:org/fw/scripting/groovy/Messenger.groovy&quot;&amp;gt; 
    &amp;lt;lang:property name=&quot;message&quot; value=&quot;Hello World!&quot;/&amp;gt; 
&amp;lt;/lang:groovy&amp;gt;
&lt;/pre&gt;

&lt;p&gt;Using the namespace, it&apos;s also possible to tell Spring to refresh the bean definition periodically.  With this, callers can hold a reference to the bean, which is thread-safe. It&apos;s possible to do this because Spring uses its AOP and proxy system to dynamically replace the &quot;target&quot; object. Refreshing is made possibly by using the &quot;refresh-check-delay&quot; attribute.
&lt;/p&gt;
&lt;pre&gt;&amp;lt;lang:groovy id=&quot;refreshableMessenger&quot; 
    &lt;span style=&quot;color: green; font-weight: bold;&quot;&gt;refresh-check-delay=&quot;5&quot;&lt;/span&gt;
    script-source=&quot;classpath:org/sfw/scripting/groovy/Messenger.groovy&quot;&amp;gt; 
    &amp;lt;lang:propertyname=&quot;message&quot; value=&quot;Hello World!&quot;/&amp;gt; 
&amp;lt;/lang:groovy&amp;gt;
&lt;/pre&gt;

&lt;p&gt;Another feature with the &amp;lt;lang&amp;gt; namespace is using &quot;inline&quot; scripts. Rod says this can be useful for writing stubs, but he generally doesn&apos;t recommend using it.  You don&apos;t want to &lt;a href=&quot;http://static.springframework.org/spring/docs/2.0.1/reference/dynamic-language.html#dynamic-language-beans-inline&quot;&gt;program in XML&lt;/a&gt;, do you?
&lt;/p&gt;
&lt;p&gt;The last option, which is only possible with Groovy, is to use POBD to define Groovy components. This is only possible with Groovy, because it produces Java classes.
&lt;/p&gt;
&lt;p&gt;Why would you want to use Groovy?
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; May be more concise and simpler than Java to implement a component. Groovy has closures!
&lt;/li&gt;
&lt;li&gt; When the interface doesn?t change but the implementation might, for example with MVC Controllers. This can allow you to rapidly develop web applications. 
&lt;/li&gt;
&lt;li&gt; To use DSL and other capabilities that offer something Java does not.
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The capabilities of developing a DSL in Java is pretty limited. Java 5 and annotations allow you to develop a DSL-ish system, but nothing like what a dynamic language can do.
&lt;/p&gt;
&lt;p&gt;It&apos;s not Rod&apos;s job to sell us Groovy, so he&apos;s now turning it over to &lt;a href=&quot;http://glaforge.free.fr/weblog/&quot;&gt;Guillaume&lt;/a&gt;. Guillaume is the Groovy Project Manager at Codehause and the JSR-241 Spec Lead. I think it&apos;s interesting that &lt;a href=&quot;radio.weblogs.com/0112098&quot;&gt;James Strachan&lt;/a&gt; invented Groovy and doesn&apos;t seem to be involved with Grails. Instead, he&apos;s helping to create &lt;a href=&quot;http://wiki.opensymphony.com/display/ABLE/Home&quot;&gt;Able&lt;/a&gt;. I digress...
&lt;/p&gt;
&lt;p&gt;To get started playing and working with Groovy is pretty simple.  &lt;a href=&quot;http://groovy.codehaus.org/Download&quot;&gt;Download&lt;/a&gt;, install, add GROOVY_HOME to your environment variables and GROOVY_HOME/bin to your path. I&apos;m downloading it now. The 1.0-RC1 release is around 13 MB.
&lt;/p&gt;
&lt;p&gt;Groovy is a dynamic and agile scripting language for the JVM. It&apos;s an OSS project hosted by &lt;a href=&quot;http://codehaus.org&quot;&gt;Codehaus&lt;/a&gt;. It was inspired by Ruby, Python and Smalltalk. It generates bytecode for the JVM so it natively integrates with Java libraries. Groovy differentiates itself with its GDK and MOP. The GDK (Groovy Development Kit) has additional libraries to simplify complex APIs and MOP (Meta Object Protocol) has advanced meta-programming features.
&lt;/p&gt;
&lt;p&gt;Groovy Syntax and Language Constructs:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; Expressive Java-like syntax (flat learning curve) 
&lt;/li&gt;
&lt;li&gt; Same OO model as Java 
&lt;/li&gt;
&lt;li&gt; Properties support 
&lt;/li&gt;
&lt;li&gt; Supports ?duck typing?, and strong typing 
&lt;/li&gt;
&lt;li&gt; Native syntax constructs for Lists, Maps, regex 
&lt;/li&gt;
&lt;li&gt; Permits operator overloading 
&lt;/li&gt;
&lt;li&gt; GStrings: interpolated strings 
&lt;/li&gt;
&lt;li&gt; Closures: reusable and assignable code blocks
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sample class and script:
&lt;/p&gt;
&lt;div class=&quot;java&quot; style=&quot;margin-left: 30px&quot;&gt;
&lt;table bgcolor=&quot;#ffffff&quot; border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot;&gt;
   &lt;tbody&gt;&lt;tr&gt;
  &lt;!-- start source code --&gt;
   &lt;td align=&quot;left&quot; nowrap=&quot;nowrap&quot; valign=&quot;top&quot;&gt;

    &lt;code&gt;
&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;class&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Speaker&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;{&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;String&amp;nbsp;name&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;def&amp;nbsp;age&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;String&amp;nbsp;toString&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;()&amp;nbsp;{&amp;nbsp;&lt;/font&gt;&lt;br/&gt;

&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&quot;My&amp;nbsp;name&amp;nbsp;is&amp;nbsp;$name&amp;nbsp;and&amp;nbsp;I&apos;m&amp;nbsp;$age&quot;&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;}&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#000000&quot;&gt;}&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#000000&quot;&gt;def&amp;nbsp;speakers&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;[&lt;/font&gt;&lt;br/&gt;

&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Speaker&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;name:&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&quot;RodJohnson&quot;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;,&amp;nbsp;age:&lt;/font&gt;&lt;font color=&quot;#990000&quot;&gt;36&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;,&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#7f0055&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;Speaker&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;name:&lt;/font&gt;&lt;font color=&quot;#2a00ff&quot;&gt;&quot;GuillaumeLaforge&quot;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;,&amp;nbsp;age:&lt;/font&gt;&lt;font color=&quot;#990000&quot;&gt;29&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;)&amp;nbsp;&lt;/font&gt;&lt;br/&gt;

&lt;font color=&quot;#000000&quot;&gt;]&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#000000&quot;&gt;def&amp;nbsp;upper&amp;nbsp;=&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;{&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;it.toString&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;()&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;.toUpperCase&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;()&amp;nbsp;}&amp;nbsp;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#000000&quot;&gt;speakers.findAll&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;{&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;name&amp;nbsp;-&amp;gt;&amp;nbsp;name&amp;nbsp;=~&amp;nbsp;/.*od.*/&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;}&amp;nbsp;&lt;/font&gt;&lt;br/&gt;

&lt;font color=&quot;#ffffff&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;.collect&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;(&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;upper&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;)&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;.each&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;{&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;println&amp;nbsp;it&amp;nbsp;&lt;/font&gt;&lt;font color=&quot;#000000&quot;&gt;}&lt;/font&gt;&lt;br/&gt;
&lt;font color=&quot;#ffffff&quot;&gt;&lt;/font&gt;&lt;font color=&quot;#ffffff&quot;&gt;
&lt;/font&gt;&lt;/code&gt;
    
   &lt;/td&gt;
  &lt;!-- end source code --&gt;
   &lt;/tr&gt;

&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;At this point, I pretty much tuned out. The slides I have in front of me match most of what Guillaume was saying.  In other words, I was able to read the slides and know what I was going to learn for the next 20 minutes. I generally blog these sessions because I&apos;ve found it&apos;s a good way of capturing the information w/o having to pack around the printed slides.  However, now that I have all the presentations in PDF form, I&apos;m a little less motivated. I wonder if there&apos;s any rules against me simply uploading the PDFs to this site?
&lt;/p&gt;
&lt;p&gt;Comment from Rod: &quot;This is the 2nd presentation I&apos;ve co-presented today and the 2nd enhancement I&apos;ve recognized we should add.&quot;  Apparently, he received a number of suggestions from Mike Keith in their JPA talk earlier today. I&apos;m not sure what Groovy-support enhancement was suggested.
&lt;/p&gt;
&lt;p&gt;One nifty thing I did see in Guillaume&apos;s demo was a &lt;a href=&quot;http://groovy.codehaus.org/IntelliJ+IDEA+Plugin&quot;&gt;Groovy Plugin for IDEA&lt;/a&gt;. Not only does it provide syntax highlighting, but it seems to allow compiling and running Groovy classes as well.
&lt;/p&gt;
&lt;p&gt;My take away from this presentation? Spring 2.0 allows you to easily use a dynamic language in your application. This can allow you to externalize business rules, programmatic configuration and possibly even write your UI layer with it.  With a backend that can CRUD any object (we have this in AppFuse 2.0), a front-end in a dynamic language could be one heck of a combination.  Of course, I could just use Grails. I like the ideas behind Grails, but I expect it&apos;d be hard to sell to clients - many of mine haven&apos;t even heard of Tapestry!</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/tse_rapid_web_application_development</id>
        <title type="html">[TSE] Rapid Web Application Development with Rob Harrop</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/tse_rapid_web_application_development"/>
        <published>2006-12-08T11:42:37-07:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <summary type="html">There&apos;s a couple of other sessions I should probably go to, namely Juergen&apos;s talk on Transactions and Mark Fisher&apos;s Message Driven POJOs Rock! However, transactions is generally a pretty boring topic and I don&apos;t see myself developing any MDPs in the next two weeks.  If you don&apos;t use your knowledge in two weeks, you generally lose it, so I&apos;ll wait to learn more about MDPs until someone pays me to.  I know a fair bit already, so I don&apos;t know that there&apos;s a whole lot more to learn.
&lt;br/&gt;&lt;br/&gt;
I&apos;m attending Rob Harrop&apos;s &lt;a href=&quot;http://www.thespringexperience.com/speaker_topic_view.jsp?topicId=240&quot;&gt;Rapid Web Application Development Essentials&lt;/a&gt; talk. With any luck, I&apos;ll learn some new tips that we can use in AppFuse.</summary>
        <content type="html">There&apos;s a couple of other sessions I should probably go to, namely Juergen&apos;s talk on Transactions and Mark Fisher&apos;s Message Driven POJOs Rock! However, transactions is generally a pretty boring topic and I don&apos;t see myself developing any MDPs in the next two weeks.  If you don&apos;t use your knowledge in two weeks, you generally lose it, so I&apos;ll wait to learn more about MDPs until someone pays me to.  I know a fair bit already, so I don&apos;t know that there&apos;s a whole lot more to learn.
&lt;br/&gt;&lt;br/&gt;
I&apos;m attending Rob Harrop&apos;s &lt;a href=&quot;http://www.thespringexperience.com/speaker_topic_view.jsp?topicId=240&quot;&gt;Rapid Web Application Development Essentials&lt;/a&gt; talk. With any luck, I&apos;ll learn some new tips that we can use in AppFuse.
&lt;br/&gt;&lt;br/&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Agenda:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://raibledesigns.com/page/rd?entry=tse_rapid_web_application_development#recipe&quot;&gt;Recipe for rapid development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://raibledesigns.com/page/rd?entry=tse_rapid_web_application_development#tools&quot;&gt;Basic Tool Set&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://raibledesigns.com/page/rd?entry=tse_rapid_web_application_development#springmvc&quot;&gt;Accelerating Spring MVC development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://raibledesigns.com/page/rd?entry=tse_rapid_web_application_development#swf&quot;&gt;Exploiting Web Flow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://raibledesigns.com/page/rd?entry=tse_rapid_web_application_development#cool&quot;&gt;Cool tools to save you time&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;a name=&quot;recipe&quot;&gt;&lt;/a&gt;
The recipe for rapid development is an easy compile/test cycle (eliminate deployment), an easy deployment for view testing (hot deploy, auto-detect changes) and reduce repetition (can often be fixed with convention over configuration, especially by defaulting model and view names). In addition:
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Encapsulate common patterns: binding and validation, multi-page navigation, redirect after POST&lt;/li&gt;
&lt;li&gt;Reusable tools for common tasks: site-wide formatting, layout, testing and monitoring&lt;/li&gt;
&lt;li&gt;Plan and design for maintenance: profiling, tracing, monitoring&lt;/li&gt;
&lt;li&gt;Aspects and JMX are the perfect solution&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong style=&quot;color: #666&quot;&gt;&lt;a name=&quot;tools&quot;&gt;&lt;/a&gt;Basic Tool Set&lt;/strong&gt;
&lt;br/&gt;&lt;br/&gt;
Why do we need tools? To reduce the compile/deploy/test life-cycle.  This is live testing, not unit testing. Many ideas also support view creation, code completion in view pages and previewing.
&lt;br/&gt;&lt;br/&gt;
What can you do without tools? Test, test and test some more. Unit and integration testing should be possible out-of-container.
&lt;br/&gt;&lt;br/&gt;
First thing you should is get a good IDE! Rob recommends IDEA and used it for all his demos. Make sure your IDE has the following features:
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;View creation support: JSP, Velocity, JSF&lt;/li&gt;
&lt;li&gt;App server integration: Tomcat, Jetty, WebLogic, WebSphere; deploy/debug from the IDE&lt;/li&gt;
&lt;li&gt;Good candidates: IntelliJ IDEA, Eclipse with WTP/MyEclipse or NetBeans&lt;/li&gt;
&lt;li&gt;Webapp aware - so you can simply click &quot;run&quot; to view it in a browser&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
&lt;em&gt;
Jetty is your friend!&lt;/em&gt; It allows you to rapidly deploy, it&apos;s resilient to hot deploy, starts everything in about 2 seconds and integrates with everything.
&lt;/p&gt;

&lt;p&gt;
Maven is your other friend. It allows you to kick-start a web project very easily. It also has Jetty integration that allows you to hot deploy. The Jetty plugin also detects changes and redeploys automatically. It even creates project files for IDEA and Eclipse.
&lt;/p&gt;
&lt;blockquote&gt;
Caveats with Maven: Its online repositories are full of junk: many different versions of POMs. To solve this, use &lt;a href=&quot;http://mvnrepository.com&quot;&gt;mvnrepository.com&lt;/a&gt; to browse and find the right JARs. Also, lots of things are missing from the central repo: Trying finding a full Jamon distro.
&lt;br/&gt;&lt;br/&gt;
Solution: Get your own in-house repo (easy to manage, overcome missing dependency woes).&lt;/blockquote&gt;
&lt;p&gt;
Now Rob is doing a Maven QuickStart demo. He&apos;s using the maven-archetype-webapp to create a web application with Maven. He then added the Jetty Plugin and showed how it&apos;s easy to get started. For those of you that aren&apos;t aware, there&apos;s also a &lt;a href=&quot;http://mojo.codehaus.org/tomcat-maven-plugin/introduction.html&quot;&gt;Tomcat Maven Plugin&lt;/a&gt; that allows you to use Tomcat instead of Jetty. There&apos;s also a debate ensuing on whether Cargo should have this functionality or whether these plugins are better.  I&apos;m currently leaning towards the plugins since their easier to setup and configure (and they work too!).
&lt;br/&gt;&lt;br/&gt;
&lt;a name=&quot;springmvc&quot;&gt;&lt;/a&gt;&lt;strong style=&quot;color: #666&quot;&gt;Accelerating Spring MVC Development&lt;/strong&gt;
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot; style=&quot;margin-top: 10px&quot;&gt;
&lt;li&gt;Important existing features: testing outside the container and controller infrastructure&lt;/li&gt;
&lt;li&gt;Important new features in Spring 2.0: code by convention, JSP form tags, quick prototype with dynamic languages&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Spring has many different Controller options: Controller/AbstractController, MultiActionController and SimpleFormController/AbstractWizardFormController.
All of these &lt;i&gt;can&lt;/i&gt; be tested outside the container. Unfortunately, SFC and AWFC are not so simple to test.
Rob recommends using with Controller and MultiActionController and using Web Flow for most other things.
&lt;br/&gt;&lt;br/&gt;
The fact that Rob doesn&apos;t recommend using SimpleFormController is quite interesting.  I&apos;ve never liked that I have to use Controllers for displaying data and SimpleFormController for forms, and apparently the Spring guys don&apos;t either. Rob says that if you&apos;re new to Spring MVC, it&apos;s better to skip learning/using SFC and use Web Flow instead.
&lt;br/&gt;&lt;br/&gt;
Testing outside of the container is one of the best things in Spring MVC (I agree). Spring Mock provides the necessary infrastructure with MockHttpServletRequest and MockHttpServletResponse. The most value can be gained from transaction integration in tests (using my favorite class - &lt;a href=&quot;http://www.springframework.org/docs/api/org/springframework/test/AbstractTransactionalDataSourceSpringContextTests.html&quot;&gt;AbstractTransactionalDataSourceSpringContextTests&lt;/a&gt;). Mock test are useful to test error conditions and hard-to-reproduce conditions, but integration tests are better in the web tier.
&lt;br/&gt;&lt;br/&gt;
Code by convention: Spring 2.0 introduces many Code by Convention features: view names, model parameter names, URL mappings. This reduces duplication and increases uniformity.
&lt;br/&gt;&lt;br/&gt;
JSP form tags: Creating forms in Spring 1.* was painful. The &amp;lt;spring:bind&amp;gt; tags were verbose and unclear. Spring 2.0 introduces new &amp;lt;form:*/&gt; tags.  These tags are much easier to read &lt;i&gt;and&lt;/i&gt; write. They clearly express the intent and handle all the common cases such as binding and error handling.
&lt;br/&gt;&lt;br/&gt;
Dynamic Languages: Spring 2.0 introduces support for beans written in other languages: JRuby, Groovy and BeanShell.
These are just plain beans: inject into them, advise them and expose them via JMX.
Change detection is built in (see live changes). Difficult integration is taken care of.  For example, how do you call methods in a dynamic object from Java.
&lt;br/&gt;&lt;br/&gt;
Now Rob is doing a demo of developing with Spring MVC and using CoC.
&lt;br/&gt;&lt;br/&gt;
One of the new things in MultiActionController is you don&apos;t have to return ModelAndView - you can return Map or have void methods as well.
&lt;br/&gt;&lt;br/&gt;
The ControllerClassNameHandlerMapping is a new class in Spring 2.0 that figures out the URLs for you based on Controller names.  If you&apos;re using a MultiActionController, the URL is the first part of the name and anything after it, for example: /catalog/*.  By configuring an additional property, you can make * map to method names. For regular Controllers, the mapping doesn&apos;t have the trailing slash (i.e. /catalog.html).
&lt;br/&gt;&lt;br/&gt;
Another new class in Spring 2.0 is ModelMap.  This class figures out your model names based on the simple class name.  Single objects are simply lowercased, whereas collections of objects are available as objectnameList (i.e. a Set of User objects will be userList).
&lt;br/&gt;&lt;br/&gt;
A method in AbstractTransactionalDataSourceSpringContexts that&apos;s quite useful is countRowsInTable(tableName).
&lt;br/&gt;&lt;br/&gt;
To debug from your IDE is generally pretty easy. If you setup your IDE to debug a &quot;Remote Application&quot;, it&apos;ll tell you the parameters you need to start that application with.  For example, to debug the Maven Jetty Plugin in IDEA, create a new Remote Application in IDEA (Run -&gt; Edit Configurations -&gt; Add -&gt; Remote) and then copy the command line arguments (listed below as well) into your MAVEN_OPTS environment variable.
&lt;/p&gt;
&lt;pre&gt;
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
&lt;/pre&gt;
&lt;p&gt;After doing this, you should be able to restart Jetty and set breakpoints in your IDE.&lt;/p&gt;
&lt;p&gt;
Now Rob is showing us a JRuby example, where he&apos;s writing a Controller in JRuby and changing it/refreshing it in his browser. The code looks fairly simple and the configuration (in his *-servlet.xml file) looks like the following:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;lang:jruby id=&quot;stocklistController&quot; 
    script-source=&quot;WEB-INF/script/StocklistController.rb&quot;
    script-interfaces=&quot;org.springframework.web.servlet.mvc.Controller&quot;
    ... /&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Unfortunately, I didn&apos;t get a chance to write down the entire bean definition, but hopefully you get the idea.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
Summary: Rapid Development with Spring MVC
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Use a project template: Build your own (simply create a ZIP file) or use Maven 2 archetypes.&lt;/li&gt;
&lt;li&gt;Make sure you can deploy quickly and frequently: Jetty is the way to go here.&lt;/li&gt;
&lt;li&gt;Build deployment into your build script: slapped wrists for using Tomcat Manager!&lt;/li&gt;
&lt;li&gt;Adhere to a code/test cycle: create mock tests to test error conditions. Use integration tests to verify end-to-end functionality.&lt;/li&gt;
&lt;li&gt;Code by Convention reduces repetition and increases uniformity.&lt;/li&gt;
&lt;li&gt;Dynamic languages: rapid prototyping, take advantage of additional language features&lt;/li&gt;
&lt;li&gt;JSP form tags: Largely replace &amp;lt;spring:bind/&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;a name=&quot;swf&quot;&gt;&lt;/a&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Exploiting Web Flow&lt;/strong&gt;
&lt;br/&gt;&lt;br/&gt;
What is Web Flow? 
&lt;br/&gt;&lt;br/&gt;
A component for defining and managing interactions with the user. Typically long-running interactions. &lt;b&gt;Workflow for the web&lt;/b&gt;.
&lt;br/&gt;&lt;br/&gt;
Integration with traditional MVC frameworks: Spring MVC and Struts. SWF was originally designed to work with Struts.
&lt;br/&gt;&lt;br/&gt;
Why bother using Web Flow?
&lt;br/&gt;&lt;br/&gt;
&lt;em&gt;Productivity!&lt;/em&gt; It removes plumbing from your code: state management, flow management, allowed actions/security, isolation and concurrency.  By removing this plumbing, it allows you to focus on the business code.
&lt;br/&gt;&lt;br/&gt;
Key Components of SWF:
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;&lt;i&gt;Flow Definition&lt;/i&gt;: A definition of a process in the application.  For example: checkout, register and CRUD.&lt;/li&gt;
&lt;li&gt;&lt;i&gt;State&lt;/i&gt;: A single state in the execution of a flow.&lt;/li&gt;
&lt;li&gt;&lt;i&gt;View State&lt;/i&gt;: A pause state that displays a view to the user and typically prompts for input.&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Action state&lt;/i&gt;: A stat that executes on or more actions and then moves to another state (where the logic happens).&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Decision state&lt;/i&gt;: a routing state, evaluates or or more expressions (against data in the various scopes) and routes to a given state.&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Action&lt;/i&gt;: The logic inside the Action state that gets executed.&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Event&lt;/i&gt;: The user signaled event (submit, cancel, process, etc.).&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Transaction&lt;/i&gt;: a movement from one state to another in response to some event.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The three configuration elements of Spring Web Flow are: Flow Executor, Flow Repository and Flow Registry.
&lt;br/&gt;&lt;br/&gt;
One of Robs favorite things about Web Flow is the Testing support. SWF provides full testing support with &lt;a href=&quot;http://static.springframework.org/spring-webflow/docs/1.0.x/api/org/springframework/webflow/test/execution/AbstractXmlFlowExecutionTests.html&quot;&gt;AbstractXmlFlowExecutionTests&lt;/a&gt;. This class provides an API for you to start and stop the flow. It also allows you to override the &lt;code&gt;registerMockServices()&lt;/code&gt; method to register mock implementations of your services. You can also override &lt;code&gt;createFlowServiceLocator()&lt;/code&gt; to do integration testing. There are also a number of useful testing-related methods available on &lt;code&gt;AbstractXmlFlowExecutionTests&lt;/code&gt; to verify things are happening correctly within your flow execution. The &lt;code&gt;MockParameterMap&lt;/code&gt; makes it easy to set parameters to pass into the flow.
&lt;/p&gt;
&lt;p&gt;&lt;a name=&quot;cool&quot;&gt;&lt;/a&gt;
&lt;strong style=&quot;color: #666&quot;&gt;Cool and useful stuff&lt;/strong&gt; 
&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://opensymphony.com/sitemesh&quot;&gt;SiteMesh&lt;/a&gt;: Apply site-wide formatting, use it in conjunction with a CSS Framework (Rob is using the same one that AppFuse does - Mike Stenhouse&apos;s CSS Framework).&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.eclipse.org/aspectj/&quot;&gt;AspectJ&lt;/a&gt;: Great for adding in filtering, monitoring and profiling.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jamonapi.sourceforge.net/&quot;&gt;Jamon&lt;/a&gt;: Great in conjunction with AspectJ.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/&quot;&gt;JMX&lt;/a&gt;: Adds in management functionality.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
If you liked the ideas that Rob presented in this talk, don&apos;t miss &lt;a href=&quot;http://www.thespringexperience.com/speaker_topic_view.jsp?topicId=288&quot;&gt;my talk&lt;/a&gt; on Saturday night. AppFuse 2.0 will have most of these components and ideas built-in by default.
&lt;br/&gt;&lt;br/&gt;
This was an excellent talk by Rob.  I certainly enjoyed myself, which is likely obvious since I wrote almost everything down. ;-)




</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/how_do_you_get_open</id>
        <title type="html">How do you get open source frameworks past the red tape?</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/how_do_you_get_open"/>
        <published>2006-11-16T08:04:24-07:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">From an e-mail I received earlier this month, with a subject of &quot;Acceptance red tape&quot;:
&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
After requesting permission to use the Spring Framework for the business logic and data access layers of an application, how do you fight something like this?

&lt;span style=&quot;display: block; margin: 10px 20px; background: #eee; border: 1px solid silver; padding: 5px&quot;&gt;
Spring is not an approved Framework for the ********** environment. We
understand the benefits of the framework.  However, we have not
certified it in our environment. Additionally, we have concerns that
this framework will not gain long standing traction among the J2EE
community.  We would like to reduce the number of frameworks used in our
environment, and do not want to be left with &quot;legacy&quot; frameworks that
have little acceptance or support as is the case with the pico
container.
&lt;/span&gt;

This is a response from one of our clients after asking about the use of
a framework in our development after another vendor had used the
PicoContainer without their permission.  We have Spring experience and
we love it.  My responses have been to ask what they have certified that
we could use and to ask their business staff to override their tech
staff.  I&apos;m caught needing to redesign an aging J2EE application with an
awfully over-architected original design confined to EJB 2.1, JSP 2.0,
Servlet 2.4, and JDK 1.4.X in a very short amount of time.  The
additional responses were that they have only certified Struts and
although both the business staff and the tech staff admit they know the
benefits of Spring, neither of them are allowing us to use it.
&lt;/p&gt;
&lt;p&gt;My response:&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
Wow - I don&apos;t know what to say, especially when they say
&lt;span style=&quot;display: block; margin: 10px 20px; background: #eee; border: 1px solid silver; padding: 5px&quot;&gt;
&quot;Additionally, we have concerns that this framework will not gain long
standing traction among the J2EE community.&quot;
&lt;/span&gt;
They&apos;re probably using Struts and they thinks it&apos;s wonderful, eh? &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;
&lt;br/&gt;&lt;br/&gt;
I could compose a long response with lots of details, but the fact
that they prefer EJB over Spring is baffling.  Spring is so much
easier to program with, it&apos;s not even funny.  Granted, EJB does have
its place, but it&apos;s often used as a hammer for a problem that doesn&apos;t
exist.
&lt;/p&gt;
&lt;p&gt;Have you experienced similar &quot;Acceptance red tape&quot; in your company?  If so, how did you work around or work through it?</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/using_the_java_persistence_api</id>
        <title type="html">Using the Java Persistence API with Mike Keith and Patrick Linskey</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/using_the_java_persistence_api"/>
        <published>2006-09-26T12:23:24-06:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">I&apos;m sitting in a presentation on JPA from Mike Keith from Oracle and Patrick Linskey from BEA. They asked the room how many folks are using (or have used) JPA.  About 6 hands went up in a room of 50-60 folks.  JPA is definitely bleeding-edge, and based on my experience, it&apos;s not quite ready for prime-time yet.  I think this is obvious as most products that implement JPA haven&apos;t had a final release yet.
&lt;br/&gt;&lt;br/&gt;
Background: Part of JSR-220 (EJB 3.0).  It began as a simplification of entity beans and evolved into POJO persistence technology. JPA&apos;s primary features are:&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;POJO-based persistence model (simple Java classes-not components)&lt;/li&gt;
&lt;li&gt;Support for enriched domain modeling (inheritance, polymorphism, etc.)&lt;/li&gt;
&lt;li&gt;Expanded Query Language&lt;/li&gt;
&lt;li&gt;Standardized object/relational mapping (using annotations and/or XML)&lt;/li&gt;
&lt;li&gt;Usable in Java EE and Java SE Environments&lt;/li&gt;
&lt;li&gt;Support for pluggable persistence providers&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At this point, I tuned out to post &lt;a href=&quot;http://raibledesigns.com/page/rd?entry=spring_forward_2006_the_keynote&quot;&gt;my presentation&lt;/a&gt; from this morning.  Most of the talk seemed to be pretty standard, as in they showed annotations, the EntityManager interface, and some JPA QL.  Interestingly enough, they used the same entities that Thomas did in our Kickstart application.  I wonder if there&apos;s a JPA tutorial out there that everyone is building their presentations from. &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;
&lt;br/&gt;&lt;br/&gt;
One interesting thing I heard from &lt;a href=&quot;http://blog.exis.com/colin/&quot;&gt;Colin&lt;/a&gt; is that Spring/Interface21 is looking into creating ready-to-go starter applications.  For example, something that allows you to start with Spring + Hibernate right away, or to create something like Salesforce.com with minimal effort.  Sounds similar to AppFuse, but who knows.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/spring_forward_2006_the_keynote</id>
        <title type="html">Spring Forward 2006 - The Keynote</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/spring_forward_2006_the_keynote"/>
        <published>2006-09-26T08:14:01-06:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">After a 1 and a 1/2 hour cab ride, I arrived at &lt;a href=&quot;http://www.springforward2006.com/&quot;&gt;Spring Foward 2006&lt;/a&gt; just in time for the opening keynote.   It looks like I&apos;ll be doing a 2nd talk this afternoon as &lt;a href=&quot;http://www.springforward2006.com/node/28&quot;&gt;Clark Richey&lt;/a&gt; was unable to make the show.  I was given a choice of talks, and I chose &quot;Comparing Web Frameworks&quot; because that&apos;s a fun talk to do.
&lt;br/&gt;&lt;br/&gt;
Thomas Risberg introduced the show (and the new &lt;a href=&quot;http://phillyspring.org&quot;&gt;Philadelphia Spring User group site&lt;/a&gt;), and now Colin  Sampaleanu is talking about Spring. Spring 2.0 is fully backwards-compatible.  There&apos;s a huge user base that demands full backwards compatibility so their old code still works.  Spring 2.0 will run on your existing infrastructure: Java 1.3, 1.4 or 5.  It&apos;ll run on all major application servers, as well as a simple servlet container. &lt;br/&gt;&lt;br/&gt;
The first major new features in Spring 2.0 are the simpler (extensible) XML configuration, as well as new AOP mechanisms.
&lt;br/&gt;&lt;br/&gt;
&lt;b&gt;XML Configuration in Spring 2.0&lt;/b&gt;&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Ability to define new XML tags to produce one or more Spring bean definitions&lt;/li&gt;
&lt;li&gt;Tags out of the box for common configuration tasks&lt;/li&gt;
&lt;li&gt;Problem-specific configuration (easier to write and to maintain)&lt;/li&gt;
&lt;li&gt;XML schema validation (better out of the box tool support, code completion for free)&lt;/li&gt;
&lt;li&gt;Exploits the full power of XML (namespaces, tooling, etc.)&lt;/li&gt;
&lt;li&gt;Backwards compatible (full support for &amp;lt;beans&gt; DTD, complete interoperability b/w classic and extended configuration)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
JNDI Lookup example (Spring 1.2.x):
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;bean id=&quot;dataSource&quot; class=&quot;...JndiObjectFactoryBean&quot;&amp;gt;
    &amp;lt;property name=&quot;jndiName&quot; value=&quot;jdbc/StockData&quot;/&amp;gt;
    &amp;lt;property name=&quot;resourceRef&quot; value=&quot;true&quot;/&amp;gt;
&amp;lt;/bean&amp;gt;
&lt;/pre&gt;
&lt;p&gt;In Spring 2.0:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;jee:jndi-lookup id=&quot;dataSource&quot; jndiName=&quot;jdbc/StockData&quot; 
    resourceRef=&quot;true&quot;/&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;AOP in Spring 2.0&lt;/b&gt;&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Simplified XML configuration using &amp;lt;aop:*&gt; tags&lt;/li&gt;
&lt;li&gt;Closer AspectJ integration (pointcut expression language, AspectJ-style aspects in Spring AOP, @AspectJ-style aspects in Spring AOP that are fully interoperable with ajc compiled aspects)&lt;/li&gt;
&lt;li&gt;Build on strengths, eliminate weaknesses&lt;/li&gt;
&lt;li&gt;Preserve ease of adoption (still zero impact on development process/deployment, easier to adopt)&lt;/li&gt;
&lt;li&gt;Benefit from the power of AspectJ&lt;/li&gt;
&lt;li&gt;Spring and AspectJ are still separate projects, but work close together since both projects&apos; leads work for Interface21&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;
AOP is about pointcuts:&lt;/b&gt;&lt;/p&gt;
&lt;ul class=&quot;glassList&quot;&gt;
&lt;li&gt;Pointcuts give us the tool to think about program structure in a different way to OOP&lt;/li&gt;
&lt;li&gt;Without a true pointcut model, you only have trivial interception&lt;/li&gt;
&lt;li&gt;By integrating AspectJ&apos;s pointcut expressions in Spring AOP, it&apos;s a much more powerful AOP framework&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Hot on the heals of Spring 2.0, Spring Web Flow 1.0 will be released.  It&apos;s a full Spring subproject and part of Spring&apos;s web stack.  Using SWF, you can capture a logical flow of your web application as a self-contained module, at a higher level.  
Another interesting project is &lt;a href=&quot;http://www.springframework.org/ldap&quot;&gt;Spring LDAP&lt;/a&gt;.  It&apos;s a Spring subproject that simplifies LDAP operations - based on the pattern of Spring&apos;s JdbcTemplate.  It encapsulates nasty boilerplate plumbing code traditionally required for LDAP.
&lt;br/&gt;&lt;br/&gt;
Finally, Spring 2.0+ will support OSGI.  So what is OSGI?  It&apos;s an industry driven framework specification, with multiple implementations.  It has a dynamic omponent model, based around the idea of &lt;i&gt;bundles&lt;/i&gt;.  It&apos;s a full component model with classloading (for isolation and versioning), lifecycle control definition, etc.  It&apos;s the foundation of Eclipse&apos;s plugin architecture.
&lt;br/&gt;&lt;br/&gt;
Why do you need Spring-OSGi? &lt;a href=&quot;http://www.springframework.org/osgi&quot;&gt;Spring-OSGi&lt;/a&gt; is an integration library for Spring in OSGi environments. &lt;i&gt;For those that need it&lt;/i&gt;, allows a more powerful component programming model.  Without Spring having to re-invent the wheel, ApplicationContexts become bundles that are able to import and export services with full isolation and integration into OSGi lifecycles.  The project is moving along rapidly, with large amounts of interest and involvement from vendors such as BEA, Oracle, IBM members of the OSGi foundation and the general public.   
&lt;br/&gt;&lt;br/&gt;
Finally, don&apos;t forget about &lt;a href=&quot;http://thespringexperience.com&quot;&gt;The Spring Experience 2006&lt;/a&gt;.  It&apos;s 3 days, 55 sessions across 5 tracks, including: Core Spring 2.0, Core Enterprise 2.0, Core Web 2.0, Domain-Driven Design and Just Plain Cool. </content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/validation_framework_consolidation</id>
        <title type="html">Validation Framework Consolidation</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/validation_framework_consolidation"/>
        <published>2006-07-11T14:05:37-06:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">Looks like Jason Carreira has stepped up to the plate to try and &lt;a href=&quot;http://jaybose.com/archives/jsr-303-bean-validation/&quot;&gt;consolidate the validation frameworks&lt;/a&gt; we have in Java. I&apos;m sure it was a joint effort among many, but Jason&apos;s name is the only one I see on &lt;a href=&quot;http://jcp.org/en/jsr/detail?id=303&quot;&gt;the JSR&lt;/a&gt;. I applaud this effort - it&apos;s definitely needed.
&lt;br/&gt;&lt;br/&gt;
I&apos;ve used Commons Validator, the XWork Validation Framework as well as Hibernate&apos;s Validator. While Commons and XWork work, the ability to annotate a class and validate it anywhere/anyhow is pretty cool.  I reviewed an article a couple months ago that hooked Hibernate Validator into Spring MVC and &lt;a href=&quot;http://raibledesigns.com/page/rd?entry=better_client_side_validation_with&quot;&gt;Prototype for client-side validation&lt;/a&gt;. There&apos;s a lot of good stuff in this space - let&apos;s hope this JSR creates something even better.  More than anything, let&apos;s hope it doesn&apos;t brush off client-side validation like JSF did. &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;
&lt;br/&gt;&lt;br/&gt;
In an ideal world, the RIFE, Spring MVC, Stripes, Struts, Tapestry and Wicket developers will all participate and allow JSR-303&apos;s result to be used as their framework&apos;s validation engine. I think it&apos;s a given that this will be usable with JSF.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/seam_1_0</id>
        <title type="html">Seam 1.0</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/seam_1_0"/>
        <published>2006-06-13T16:45:48-06:00</published>
        <updated>2012-11-08T14:44:09-07:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">I&apos;ve posted my thoughts on Seam 1.0 to my &lt;a href=&quot;http://www.virtuas.com/node/229&quot;&gt;Virtuas blog&lt;/a&gt;.  What are your thoughts?&lt;/p&gt;
&lt;p class=&quot;quote&quot;&gt;
It&apos;s great to see the &lt;a href=&quot;http://www.infoq.com/news/JBoss-SEAM-1.0-Gavin-interview&quot;&gt;release of Seam 1.0&lt;/a&gt;.  Seam is similar to many full-stack frameworks like &lt;a href=&quot;http://rubyonrails.com&quot;&gt;Rails&lt;/a&gt;, &lt;a href=&quot;http://rifers.org&quot;&gt;Rife&lt;/a&gt; and &lt;a href=&quot;http://appfuse.org&quot;&gt;AppFuse&lt;/a&gt; in that it gives you all the pieces you&apos;ll need to build a kick-ass web application.  
&lt;br/&gt;&lt;br/&gt;
I&apos;ve &lt;a href=&quot;http://raibledesigns.com/page/rd?entry=seam&quot;&gt;blogged my thoughts on Seam&lt;/a&gt; before, so there&apos;s no need to do that again.  I like the idea, especially the lack of interfaces and the 3-files-for-each page idea.  However, I don&apos;t know that this concept will fly with Java developers.  I agree there&apos;s a need to simplify, but many of us are mesmerized by the de-coupling that Spring gives us.  So now we&apos;re programming to interfaces, and every-so-often swapping implementations. I don&apos;t know that we can switch to this simpler model. And then there&apos;s the &quot;EJB&quot; thing. I think there will be a fair amount of developers that don&apos;t use EJB3 simply because it has the &quot;EJB&quot; name.  The best thing the EJB Expert Group could have done for EJB3 would be to give it a new name.
&lt;br/&gt;&lt;br/&gt;
The other thing I worry about with Seam is that it wasn&apos;t developed from an existing application.  AFAIK, it didn&apos;t get extracted from a real-world application that had all the problems that Seam solves. I know that Gavin is a smart guy, and he&apos;s probably seen these problems in the real world, but there&apos;s nothing like developing a real-world application with a technology - and then extracting the framework from that.
&lt;br/&gt;&lt;br/&gt;
In reality, I&apos;m probably jealous.  Seam has some really cool features, JBoss has done a great job of marketing it, and it seems to be a really cool way to develop applications.  If I&apos;m going to &lt;a href=&quot;http://raibledesigns.com/page/rd?entry=re_thoughts_on_the_future&quot;&gt;make AppFuse a direct competitor to Seam&lt;/a&gt;, it&apos;s gonna be quite the uphill battle.
&lt;/p&gt;
&lt;p&gt;</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/re_thoughts_on_the_future</id>
        <title type="html">RE: Thoughts on the future direction of AppFuse</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/re_thoughts_on_the_future"/>
        <published>2006-05-22T20:16:53-06:00</published>
        <updated>2007-04-26T17:22:27-06:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">Sanjiv has some interesting thoughts on the &lt;a href=&quot;http://jroller.com/page/sjivan?entry=thoughts_on_appfuse_direction&quot;&gt;future direction of AppFuse&lt;/a&gt;. To summarize: take on Seam head-to-head, but use Spring instead. Get rid of all the other frameworks except for JSF, Spring and Hibernate. Furthermore, focus on making Web 2.0 applications easy to create and use.&lt;br/&gt;&lt;br/&gt;
I like Sanjiv&apos;s ideas, but I&apos;m not so hot on ditching all the other web frameworks in favor of JSF. I&apos;m still not convinced it&apos;s the best solution for Java web development.  The idea behind JSF is great, but the implementation has warts.  Maybe that&apos;ll be fixed with JSF 1.2, but it will likely be quite a few months before MyFaces supports it. Yeah, I know there&apos;s the RI, but it &lt;em&gt;is&lt;/em&gt; an RI and you remember the 1.1 version don&apos;t you? &lt;img src=&quot;https://raibledesigns.com/images/smileys/wink.gif&quot; class=&quot;smiley&quot; alt=&quot;;-)&quot; title=&quot;;-)&quot; /&gt;
&lt;br/&gt;&lt;br/&gt;
I&apos;d hate to give up WebWork support because I&apos;ve used it on a couple of projects and really like it.  Ditching Spring MVC would likely be a mistake as well since it&apos;s the most popular web framework among AppFuse users today. While I love what Tapestry brings to the table, it is harder (for the newbie) than JSF. Also, it seems to be the least-used web framework in AppFuse, which means I&apos;m doing a lot of maintenance for no reason. AppFuse 2.0 will definitely make things simpler (JDK 5, Maven 2, standard directory layout, better IDE integration), but it will still be difficult to support 5 web frameworks and 2 persistence frameworks. 
&lt;br/&gt;&lt;br/&gt;
What do you think about Sanjiv&apos;s proposal? It sounds good to me. However, I&apos;d rather see different lead developers for each framework and continue to support them all - except for Struts of course.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/tssjs_friday_morning_rife_and</id>
        <title type="html">[TSSJS] Friday Morning: RIFE and Seam</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/tssjs_friday_morning_rife_and"/>
        <published>2006-03-24T11:56:30-07:00</published>
        <updated>2007-02-10T20:07:57-07:00</updated> 
        <category term="/Java" label="Java" />
        <content type="html">This is my 2nd day in Vegas and so far this town is treating me fairly well.  I haven&apos;t lost &lt;em&gt;all&lt;/em&gt; of my money, but the $25/hand blackjack tables haven&apos;t been kind. Yesterday, I woke up with a glass full of Berocca next to my bed - which means I passed out before drinking it. I needed it too, Matt Filios won a poker tourney and a bunch of us enjoyed &quot;bottle table&quot; (with Kettle One vodka) to celebrate. Spendy and good, but painful the next day.
&lt;br/&gt;&lt;br/&gt;
Last night, I heard it was Crazy Bob&apos;s bachelor party, so I went to bed early to avoid the debauchery. Julie and a good friend of mine are flying in tonight, so there will be plenty of that this evening. So after a good night&apos;s sleep, I&apos;m up early and attending the conference.  The first hour has a lot of good sessions: Introduction to Seam (Gavin), Dive into RIFE (Geert), OSWorkflow (Hani) and Transforming Enterprise Java into a Commodity (Geir).
&lt;br/&gt;&lt;br/&gt;
I&apos;m sitting in Geert Bevin&apos;s session titled &quot;Dive into RIFE&quot; and it&apos;s a pretty small audience - maybe 20 people.  Geert is the CTO of Uwyn, a small custom application development company.  He&apos;s the founder of &lt;a href=&quot;http://rifers.org&quot;&gt;RIFE&lt;/a&gt; and creator of many RIFE projects: RIFE/Crud, RIFE/Jumpstart, RIFE/Continuations, Bamboo (forum), Bla-bla List (RIA todo list), Drone (Information bot) and Elephant (blog).
&lt;br/&gt;&lt;br/&gt;
What is RIFE? It&apos;s a full-stack component framework to &lt;b&gt;quickly&lt;/b&gt; and &lt;b&gt;consistently&lt;/b&gt; develop and maintain Java web applications.
&lt;/p&gt;
&lt;ul class=&quot;classList&quot;&gt;
&lt;li&gt;Integrated layers allow you to quickly get results with a minimal amount of code&lt;/li&gt;
&lt;li&gt;Best practices are enforced in a pleasant way, providing many additional features and a consistent approach throughout all applications&lt;/li&gt;
&lt;li&gt;Components can easily be resused in many contexts&lt;/li&gt;
&lt;li&gt;Creating maintainable applications is our first goal&lt;/li&gt;
&lt;li&gt;A lot of attention goes to code-level developer comfort&lt;/li&gt;
&lt;li&gt;Frustration reduction by instant changes and reloads&lt;/li&gt;
&lt;li&gt;Creative solutions for difficult problems&lt;/li&gt;
&lt;li&gt;Embraces established standards (XHTML, HTTP, SQL, ...)&lt;/li&gt;
&lt;li&gt;Geared to developing web applications and doesn&apos;t abstract away too much&lt;/li&gt;
&lt;li&gt;Everything besides the web engine is designed to be independently usable&lt;/li&gt;
&lt;li&gt;Attention to the whole life-cycle of your application&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Geer is now talking about all the different pieces of RIFE - how it has a JDBC abstraction like Spring JDBC, web services support (even publishing of RSS Feeds) and a content management framework. Now we&apos;re going to look at RIFE/Jumpstart.
&lt;br/&gt;&lt;br/&gt;
What is RIFE/Jumpstart? It&apos;s a source archive that you unzip and run. It makes it easy to start with new RIFE applications and contains everything you need (including Jetty).  It has immediate support for more common development environments (X-develop, Netbeans, Eclipse, IDEA and Ant). Geert just showed us a video of getting started with Jumpstart and how you can easily use X-develop to build and deploy the app to Jetty. The Jumpstart application currently uses JUnit, but since the RIFE teams is starting to use TestNG more and more, it&apos;s likely they&apos;ll change in the near future. RIFE Jumpstart looks similar to AppFuse, except they have the save+reload problem solved - using JVM HotSwapping.
&lt;br/&gt;&lt;br/&gt;
Now I&apos;ve moved to the &lt;b&gt;Introduction to Seam&lt;/b&gt; session. Gavin King is the presenter and the room is packed.  It&apos;s a big room, so that&apos;s saying a lot. Gavin is talking about JSF, how backing beans work and what&apos;s in the faces-config.xml. How does Seam compare to J2EE? &lt;i&gt;Much&lt;/i&gt; simpler code.  There&apos;s fewer artifacts (no DTOs). Less noise (EJB boilerplate, Struts boilerplate). More transparent (no direct calls to HttpSession or HttpRequest). It&apos;s also much more powerful for complex problems. 
&lt;br/&gt;&lt;br/&gt;
JSF is amazingly flexible and extensive. EJB interceptors support a kind of &quot;AOP lite&quot; and EJB3 is a powerful ORM engine. Everything (except for the JSP pages) is unit testable can be tested with JUnit or TestNG. For testing the view layer, Gavin recommends using Selenium.
&lt;br/&gt;&lt;br/&gt;
A backing bean is often &quot;pure glue&quot; and is just noise. Furthermore, it accounts for more LOC than any other component. It doesn&apos;t really decouple layers, in fact the couple is more coupled than it otherwise would be. Gavin calls this &quot;wedding cake architecture.&quot; These applications look good in the window, but don&apos;t taste good when you eat them.  I get his point, but have to disagree on the taste of wedding cake. It&apos;s always been good at the wedding&apos;s I&apos;ve attended. ;-)
&lt;br/&gt;&lt;br/&gt;
By default, web applications in general do not work in a multi-window application. To make it work, it generally requires a major architecture change. A couple of other areas for improvement in traditional web applications: application leaks memory (not cleaning up session objects) and &quot;flow&quot; is weakly defined. Navigation rules are totally ad hoc and difficult to visualize. How can this code be aware of the long-running business process?
&lt;br/&gt;&lt;br/&gt;
JBoss Seam - what does it do? It unifies the EJB3 and JSF component models. It simplifies Java EE 5, filling a gap. In addition, it integrates jBPM and makes it more developer-friendly. Deprecate so-called stateless architecture. Decouple the technology from the execution environment. Run EJB3 apps in Tomcat or in TestNG or use Seam with JavaBeans and Hibernate. Gavin is using Tomcat for the first time and thinks it&apos;s hot-deploy architecture is totally broken.  Of course, he usually uses JBoss and never has a problem with hot-deploy. It&apos;s interesting to hear this from Gavin, especially since I&apos;ve heard from others that Hibernate breaks the reloading - and it&apos;s not the server&apos;s fault.
&lt;br/&gt;&lt;br/&gt;
I&apos;m going to head to another session now, but I did look ahead at some of Gavin&apos;s slides. Interestingly enough, the jPBM pageflow definition&apos;s XML looks quite similar to Spring Web Flow. Speaking of flows, I heard an interesting comments from someone yesterday after they attended Geert&apos;s continuations talk.  Apparently, after seeing his talk, they think that RIFE&apos;s continuations offer a much more elegant solution to pageflow than these &quot;XML programming&quot; mechanisms.
&lt;br/&gt;&lt;br/&gt;
I tried to go to Hani&apos;s OSWorkflow talk, but he was doing Q&amp;A when I walked in.  Apparently, he finished 25 minutes early. Then I walked into Geir&apos;s talk only to find Dan Deiphouse finishing up an XFire talk. Oh well, there&apos;s nothing wrong with having a few minutes to mingle between talks.</content>
    </entry>
</feed>

