<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6220336561704295514</id><updated>2011-08-13T23:13:58.231-07:00</updated><category term='sitemesh'/><category term='javascript'/><category term='java'/><category term='ejb'/><category term='spring framework'/><category term='ajax'/><category term='browser'/><category term='security'/><category term='dev tools'/><category term='web development'/><category term='spring acegi'/><category term='j2ee'/><category term='jdk1.5'/><title type='text'>-Xmx1024</title><subtitle type='html'>A blog of a Java developer.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-2168859563385209208</id><published>2011-06-15T15:21:00.000-07:00</published><updated>2011-08-13T23:13:58.292-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='spring framework'/><title type='text'>Decoupling Domain Objects</title><content type='html'>&lt;div id="_blog"&gt;

&lt;div&gt;
&lt;h2&gt;Overview&lt;/h2&gt;
Given a top down design where the domain objects do not match the entity objects, one of the common techniques in object oriented design is to decouple the object layers.  One decoupling technique is to use composite objects.  Each level of abstraction will utilize its own composite object (Domain and View).  It seems like a lot to write from the looks of it but most IDE supports creations of delegate methods now anyways.
&lt;/div&gt;

&lt;h2&gt;Components&lt;/h2&gt;

&lt;h3&gt;Service Layer&lt;/h3&gt;
&lt;div class="codex"&gt;&lt;pre&gt;
public interface BlogManager {

    Blog load(String name) throws EntityNotFoundException;

}

public class BlogManagerImpl implements BlogManager {

    // Fictitious EntityManager
    EntityManager em;

    public Blog load(String name) throws EntityNotFoundException {
        Blog blog = null;
        BlogData data = em.query("select b from BlogData b where b.name = ?", name);
        return new Blog(data);
    }

}
&lt;/pre&gt;&lt;/div&gt;

&lt;h2&gt;Given the following objects&lt;/h2&gt;

&lt;div&gt;
&lt;h3&gt;Persistent Object&lt;/h3&gt;
BlogData: an entity-managed persistent object (managed by hibernate for example)
&lt;/div&gt;

&lt;div class="codex"&gt;&lt;pre&gt;   
@Peristent
public class BlogData {

   private String name;

   public String getName() {
      return name;
   }
   
   public void setName(String name) {
      this.name = name;
   }
}

&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;h3&gt;Domain&lt;/h3&gt;
   Blog (First-class citizen)
&lt;/div&gt;

&lt;div class="codex"&gt;&lt;pre&gt;   
public class Blog {

    private BlogData delegate;
    
    public Blog(BlogData delegate) {
        this.delegate = delegate;
    }
    
    // Example delegate methods
    public getName() {
        return delegate.getName();
    }

    public BlogData getData() {
        return delegate;
    }
}
&lt;/pre&gt;&lt;/div&gt;

&lt;div&gt;
&lt;h3&gt;View Object&lt;/h3&gt;
&lt;/div&gt;
&lt;div class="codex"&gt;&lt;pre&gt;
public class BlogBean {

    private Blog delegate;
    
    public BlogBean(Blog delegate) {
        this.delegate = delegate;
    }
    
    public String getName() {
        return delegate.getName();
    }
    
    // custom UI method
    
    public boolean isActive() {
        // custom code (UI Logic)
    }
}
&lt;/pre&gt;&lt;/div&gt;




&lt;h2&gt;Example Controller&lt;/h2&gt;
&lt;div class="codex"&gt;&lt;pre&gt;
@Controller
public class BlogController {

    @RequestMapping("/getBlog")
    public void getBlog(String name) {
        ModelMap model = new ModelMap();
        BlogBean blog = blogManager.load(name);
        model.addAttribute("blog", blog);        
    }

}
&lt;/pre&gt;&lt;/div&gt;


&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-2168859563385209208?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/2168859563385209208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=2168859563385209208' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/2168859563385209208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/2168859563385209208'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2011/06/decoupling-domain-objects.html' title='Decoupling Domain Objects'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-3426581376887316156</id><published>2009-09-10T23:17:00.000-07:00</published><updated>2009-07-20T19:05:02.428-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web development'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='spring framework'/><title type='text'>Binding Tabular Data with SpringFormControllers</title><content type='html'>&lt;!-- Binding Tabular Data with SpringFormControllers --&gt;

&lt;div id="_blog"&gt;
   &lt;div&gt;
       &lt;p&gt;
           This blog discusses the nature of dynamic tabular data in web
           applications and how this is handled in Spring Framework. The main
           point here is that the tabular data cannot be modified in any way or
           else an IndexOutOfBoundsException will occur.
       &lt;/p&gt;
   &lt;/div&gt;

   &lt;div&gt;
       &lt;p&gt;
           Assume for a moment that we have tabular data we want to edit the
           quantity on our cart items. The tabular field is indexed using open
           and closing square brackets [].
       &lt;/p&gt;

       &lt;div class="codex"&gt;
           &lt;pre&gt;&amp;lt;c:forEach var="item" items="${shoppingCartForm.items}" varStatus="s"&amp;gt;
   &amp;lt;spring:bind path="shoppingCart.items[${s.count-1}].quantity"&amp;gt;
   &amp;lt;input type="text" name="${status.expression}" value="${status.value}"
       style="width: 100%;"/&amp;gt;
   &amp;lt;/spring:bind&amp;gt;
&amp;lt;/c:forEach&amp;gt;&lt;/pre&gt;
       &lt;/div&gt;



       &lt;div class="codex"&gt;
           &lt;p&gt;
               Override SimpleFormController's formBackingObject method in your
               form controller class:
           &lt;/p&gt;
           &lt;pre&gt;protected Object formBackingObject(HttpServletRequest request)
       throws Exception {
   Long cartId = RequestUtils.getRequiredLongParameter(request, "cartId");
   ShoppingCart cart = shoppingCartManager.findShoppingCart(cartId);
   return new ShoppingCartCommand(cart);
}&lt;/pre&gt;
       &lt;/div&gt;

   &lt;/div&gt;

   &lt;b&gt;The Detailed Explanation&lt;/b&gt;
   &lt;div&gt;
       &lt;p&gt;
           When spring binds the array it expects items to have contents.
           Therefore, we need to override the
           SimpleFormController.formBackingObject to always retrieve the
           current data.
       &lt;/p&gt;

       &lt;p&gt;
           During the form rendering (showForm()) our page is rendered and the
           moment the Controller processes the request after the form is
           submitted, the controller will retrieve the most current data via
           the SimpleFormController.formBackingObject().
       &lt;/p&gt;

       &lt;p&gt;
           If for some reason the shopping cart items increased (via some
           method in the JSP) the binding will throw an
           IndexOutOfBoundsException because the items currently in our
           database will be less than what we are trying to bind.
       &lt;/p&gt;

       &lt;p&gt;
           If we have this situation we need to explicitly correlate the number
           of items to be persisted with the ShoppingCartCommand.items to avoid
           the exception.
       &lt;/p&gt;&lt;p&gt;
           Number of items from the database: 3
          

           The user added another item which totals to 4
          

           In the SimpleFormController.formBackingObject() method we need to
           figure out how many new items were added and increase the list size
           so the binding can occur. In our case we need to increase the list
           size by 1.
       &lt;/p&gt;
   &lt;/div&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-3426581376887316156?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/3426581376887316156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=3426581376887316156' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/3426581376887316156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/3426581376887316156'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/09/binding-tabular-data-with.html' title='Binding Tabular Data with SpringFormControllers'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-3196390024158645430</id><published>2009-06-14T11:13:00.000-07:00</published><updated>2009-07-20T19:03:40.786-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='spring framework'/><title type='text'>Secure SMTP with Spring JavaMailSender</title><content type='html'>&lt;!-- Secure SMTP with Spring JavaMailSender --&gt;

&lt;div id="_blog"&gt;

  &lt;div&gt;
      &lt;p&gt;
          Like many cost-effective individuals out there I migrated most of my email service which
          I was paying approximately $50/year for to use
          &lt;a href="http://www.google.com/a/" target="_new"&gt;Google Apps For Your Domain&lt;/a&gt;. This
          is a free service that in fact I am very satisfied with. But using the smtp service with
          the Spring JavaMailSender on my old email account was straight forward. The problem I
          now have is that
          &lt;em&gt;Google Apps For Your Domain&lt;/em&gt; uses the smtps protocol to send emails and because
          I was using an older version of Java Mail (1.3) I could not programmatically send emails
          using the secure smtp protocol. In addition to that, the default implemation of
          JavaMailSender (JavaMailSenderImpl.java) in
          &lt;a href="http://www.springframework.org/"&gt;Spring Framework&lt;/a&gt; currently does not have
          the ability to smoothly handle sending messages using the secure smtp (smtps) protocol.
      &lt;/p&gt;

      &lt;p&gt;
          I stumbled into this when developing a web application that requires an SMTP account to
          send test emails and other email notifications to the users of this application. Not
          having the luxury to run my own SMTP server I decided that I would just temporarily use
          a
          &lt;a href="http://www.gmail.com/"&gt;Gmail (TM)&lt;/a&gt; account for sending the messages during
          development. It just so happens that Gmail uses Secure SMTP to send email messages and
          on top of that it requires the user to authenticate.
      &lt;/p&gt;
  &lt;/div&gt;

  &lt;div&gt;
      &lt;h4&gt;
          Java Libraries You Will Need
      &lt;/h4&gt;
      &lt;p&gt;
          In further investigating this issue it turns out that pre Java Mail 1.4, there is no
          support for SMTPS Protocol. So we need to download the latest version at
          &lt;a href="http://java.sun.com/products/javamail/"&gt;Java Mail&lt;/a&gt;.
      &lt;/p&gt;

      &lt;ul&gt;
          &lt;li&gt;
              Option #1:
              &lt;p&gt;
                  Download the latest Java Mail API jars.
                

                  When using this route be warned that on the final click to download the java
                  mail product you will be re-routed to install the Sun(TM) Download Manager. I am
                  just really puzzled why Sun(TM) has the need to create their own download
                  managers.
              &lt;/p&gt;
          &lt;/li&gt;
          &lt;li&gt;
              Option #2:
            
              &lt;p&gt;
                  Download the latest
                  &lt;a href="http://java.sun.com/javaee/" target="_new"&gt;Java Platform Enterprise
                      Edition&lt;/a&gt; and use the mail.jar that came with that product.
              &lt;/p&gt;
          &lt;/li&gt;
      &lt;/ul&gt;

      &lt;p&gt;
          The particular class file that you want to check for in these jars are:
          &lt;i&gt;com.sun.mail.smtp.SMTPSSLTransport&lt;/i&gt;.
        

          Please note that for either options you will still need the Java Activation Framework
          (activation.jar).
      &lt;/p&gt;
  &lt;/div&gt;

  &lt;div&gt;
      &lt;h4&gt;
          JavaMailSenderImpl with Secure SMTP/SMTPS Support
      &lt;/h4&gt;
      &lt;p&gt;
          In my own extension of the the JavaMailSenderImpl.java (see Source Code), it will
          automatically set the protocol to smtps and add Java Mail smtps properties if the
          property
          &lt;i&gt;smtp.isSecure&lt;/i&gt; is set to true. Basically, the properties smtp host, username,
          password, and port will be required.  Also note the property
          &lt;i&gt;smtp.isSecure&lt;/i&gt; is not a Java Mail property. It is just the property name that I
          came up with so that the code can toggle between normal smtp and smtps protocol.
      &lt;/p&gt;
      &lt;p&gt;
          I also created an override for the
          &lt;em&gt;super.doSend(..)&lt;/em&gt; method so that after calling the
          &lt;em&gt;Transport.connect(..)&lt;/em&gt; method, it will test for connection via the
          &lt;em&gt;Transport.isConnected()&lt;/em&gt; method. This is just an extra step to make sure that we
          are connected to the SMTPS server and may not be needed in some cases.
      &lt;/p&gt;
      &lt;p&gt;
          Futhermore, If you have a
          &lt;a href="http://en.wikipedia.org/wiki/Create%2C_read%2C_update_and_delete" target="_new"&gt;CRUD&lt;/a&gt;
          for the server configuration,  the mail.properties value may be replaced with an
          implementation that retrieves its values from the database as well.
      &lt;/p&gt;
  &lt;/div&gt;

  &lt;div&gt;
      &lt;b&gt;Source Code:&lt;/b&gt;
      &lt;ul&gt;
          &lt;li&gt;
              &lt;a href="http://j2ee-example-code.googlecode.com/svn/blogs/xmx1024/secure_javamail_sender/applicationContext-mail.xml" target="_new"&gt;applicationContext-mail.xml&lt;/a&gt;
          &lt;/li&gt;
          &lt;li&gt;
              &lt;a href="http://j2ee-example-code.googlecode.com/svn/blogs/xmx1024/secure_javamail_sender/JavaMailSenderImpl.java" target="_new"&gt;JavaMailSenderImpl.java (with smtps support)&lt;/a&gt;
          &lt;/li&gt;
          &lt;li&gt;
              &lt;a href="http://j2ee-example-code.googlecode.com/svn/blogs/xmx1024/secure_javamail_sender/mail.properties" target="_new"&gt;mail.properties&lt;/a&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;

  &lt;div&gt;
      &lt;b&gt;References:&lt;/b&gt;
      &lt;ul&gt;
          &lt;li&gt;
              &lt;a href="http://static.springframework.org/spring/docs/2.0.1/reference/mail.html" target="_new"&gt;Spring Framework 2.x (Chapter 22. Email)&lt;/a&gt;
          &lt;/li&gt;
          &lt;li&gt;
              &lt;a href="http://java.sun.com/javaee/" target="_new"&gt;Java Platform Enterprise
                  Edition&lt;/a&gt;
          &lt;/li&gt;
          &lt;li&gt;
              &lt;a href="http://forum.springframework.org/archive/index.php/t-17638.html" target="_new"&gt;Spring Framework Forum (JavaMailSenderImpl halts when using
                  SSL-secure server?)&lt;/a&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-3196390024158645430?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/3196390024158645430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=3196390024158645430' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/3196390024158645430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/3196390024158645430'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2007/01/secure-smtp-with-spring-javamailsender.html' title='Secure SMTP with Spring JavaMailSender'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-2252188930445754438</id><published>2009-01-12T14:10:00.000-08:00</published><updated>2009-07-20T19:04:31.290-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web development'/><category scheme='http://www.blogger.com/atom/ns#' term='spring acegi'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='spring framework'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Spring Acegi: Force Re-Authenticating Other Users When Roles Change</title><content type='html'>&lt;!-- Spring Acegi: Force Re-Authenticating Other Users When Roles Change --&gt;

&lt;div id="_blog"&gt;

   &lt;div&gt;
       &lt;b&gt;Here's the Scenario that I have an issue with:&lt;/b&gt;
       &lt;p&gt;
           A System Administrator edits a user role and the user whose role is currently logged in
           could possibly already be logged in.
       &lt;/p&gt;
       &lt;p&gt;
           When System Administrators log into a website and edit a user role, the default
           implementation of Spring Acegi does not re-authenticate the user if the user is
           currently logged in to the system. In short, if the user in question is an administrator
           and you remove the admin role from the user the changes doesn't take effect until the
           next time this user re-authenticates--i.e. log-out then log back in.
       &lt;/p&gt;

       &lt;b&gt;The Solution:&lt;/b&gt;
       &lt;p&gt;
           The ideal solution would be for the system without turning on the
           &lt;b&gt;alwaysReauthenticate&lt;/b&gt; to detect that the user information has changed and will
           automatically re-authenticate user in question is already logged in to the system.
       &lt;/p&gt;
   &lt;/div&gt;

   &lt;div&gt;
       &lt;p&gt;
           How do I get acegi to re-authenticate the user who is currently logged in whenever this
           person's user roles are edited? I don't want to turn on
           &lt;i&gt;alwaysReauthenticate&lt;/i&gt; property on the
           &lt;i&gt;FilterSecurityInterceptor&lt;/i&gt;. The solution I came up with is whenever the
           &lt;i&gt;EditUserFormController&lt;/i&gt; executes (only executed by admins) to save the user
           information (including but not limited to user roles), I clear the userCache entry for
           that user and added a filter that will check whether the user exists in the userCache.
           If it doesn't it will set the Authentication.authenticated property to false, hence to
           be forced to re-authenticate in
           &lt;i&gt;FilterSecurityInterceptor&lt;/i&gt;. This filter executes before the
           &lt;i&gt;FilterSecurityInterceptor&lt;/i&gt; in the filter chain.
       &lt;/p&gt;
       &lt;p&gt;
           This seems to work fine but without turning on the alwaysReauthenticate property this is
           the most perfomance-saavy solution until a functionality like this (if it makes sense to
           implement) is implemented in Spring Acegi.
       &lt;/p&gt;

       &lt;b&gt;Here's the code snippet from the filter I created:&lt;/b&gt;

       &lt;div class="codex"&gt;
           &lt;pre&gt;protected void reAuthenticateAsNeeded() {
   Authentication authentication = SecurityContextHolder.getContext()
           .getAuthentication();
   if (!("anonymous".equalsIgnoreCase(authentication.getName()))
           &amp;amp;&amp;amp; authentication.isAuthenticated()
           &amp;amp;&amp;amp; m_userCache.getUserFromCache(authentication.getName()) == null) {
       authentication.setAuthenticated(false);
   }
}&lt;/pre&gt;
       &lt;/div&gt;
       &lt;p&gt;
           Please note that the following
           &lt;i&gt;FilterSecurityInterceptor&lt;/i&gt; is then executed and will re-authenticate the user.
          

           (see also
           &lt;i&gt;AbstractSecurityInterceptor#beforeInvocation()&lt;/i&gt;)
       &lt;/p&gt;
   &lt;/div&gt;

   &lt;div&gt;
       &lt;b&gt;References:&lt;/b&gt;
       &lt;ul&gt;
           &lt;li&gt;
               &lt;a href="http://acegisecurity.org/" target="_new"&gt;Spring Acegi&lt;/a&gt;
           &lt;/li&gt;
           &lt;li&gt;
               &lt;a href="http://forum.springframework.org/showthread.php?p=95451#poststop" target="_new"&gt;Spring Acegi Forum Thread (Re-Authenticating Other Users When
                   Roles Change)&lt;/a&gt;
           &lt;/li&gt;
           &lt;li&gt;
               &lt;a href="http://forum.springframework.org/showthread.php?t=23831&amp;amp;highlight=reloading+authentication" target="_new"&gt;Spring Acegi Forum Thread (Reloading GrantedAuthority[] in
                   Authentication?)&lt;/a&gt;
           &lt;/li&gt;
       &lt;/ul&gt;
   &lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-2252188930445754438?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/2252188930445754438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=2252188930445754438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/2252188930445754438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/2252188930445754438'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2007/01/spring-acegi-re-authenticating-for.html' title='Spring Acegi: Force Re-Authenticating Other Users When Roles Change'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-1420351843190659313</id><published>2008-12-08T00:44:00.000-08:00</published><updated>2009-07-20T19:06:10.900-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>I Hate Casting!</title><content type='html'>&lt;div id="_blog"&gt;

&lt;p&gt;
I don't mean to sound like Grumpy Smurf but did I tell you I hate casting?
Thanks to the new JDK 1.5 templating I can finally eliminate them!
&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;  Eliminate Them!&lt;/i&gt; (A quote from Star Trek Insurrection)
&lt;/p&gt;


&lt;h5&gt;An Enterprise Java Bean Example&lt;/h5&gt;

&lt;div class="codex"&gt;
&lt;pre&gt;// Old
private UserSessionHome getUserSessionHome() throws Exception {
  return (UserSessionHome) initialContext.lookup("ejb/UserSession");
}

private AccountHome getAccountHome() throws Exception {
  return (AccountHome) initialContext.lookup("ejb/Account");
}


// New
private UserSessionHome getUserSessionHome() throws Exception {
  return getHome("ejb/UserSession");
}

private AccountHome getAccountHome() throws Exception {
  return getHome("ejb/Account");
}

private &amp;lt;T&amp;gt; T getHome(String jndiName) throws Exception {
  return (T) initialContext.lookup(jndiName);
}

Usage Example:

UserSession userSession = getUserSessionHome().create();
userSession.createUser(userInfo);&lt;/pre&gt;
&lt;/div&gt;




&lt;h5&gt;A Spring DAO example&lt;/h5&gt;

&lt;div class="codex"&gt;
&lt;pre&gt;@SuppressWarnings("unchecked")
public &amp;lt;T&amp;gt; T get(Class entityClass, Serializable id) {
  return (T) super.getHibernateTemplate().get(entityClass, id);
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;In your DAO Implementation Class:&lt;/p&gt;

&lt;div class="codex"&gt;
&lt;pre&gt;// OLD (with Casting)
public User getUser(String username) {
  return (User) super.getHibernateTemplate().get(User.class, username);
}

// New
public User getUser(String username) {
  return get(User.class, username);
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
Hey, wouldn't it be nice if the Spring developers
provide an IBatis SqlMapTemplate and HibernateTemplate specifically for JDK5
to eliminate casting.



My 2 cents...
&lt;/p&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-1420351843190659313?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/1420351843190659313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=1420351843190659313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/1420351843190659313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/1420351843190659313'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/12/i-hate-casting.html' title='I Hate Casting!'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-8212254785268719185</id><published>2008-09-10T18:08:00.000-07:00</published><updated>2009-07-20T19:05:32.302-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web development'/><category scheme='http://www.blogger.com/atom/ns#' term='sitemesh'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='spring framework'/><title type='text'>Sitemesh decorator goes berzerk with Spring MultipartResolver</title><content type='html'>&lt;!-- Sitemesh decorator goes berzerk with Spring MultipartResolver --&gt;

&lt;div id="_blog"&gt;

   &lt;b&gt;The Issue&lt;/b&gt;
   &lt;div&gt;
       This particular blog disscusses a particular issue with Sitemesh when
       used with Spring Framework. The issue in sitemesh occurs when the size
       of the uploaded file exceeds the maximum settings set in Spring. A
       workaround is also provided for those who are seeking for alternatives.
   &lt;/div&gt;

   &lt;b&gt;Framework Versions&lt;/b&gt;
   &lt;div&gt;
       &lt;ul&gt;
           &lt;li&gt;
               Spring Framework: 1.x
           &lt;/li&gt;
           &lt;li&gt;
               Sitemesh: 2.2.1
           &lt;/li&gt;
       &lt;/ul&gt;
   &lt;/div&gt;

   &lt;b&gt;Given the Following Situation&lt;/b&gt;
   &lt;div&gt;
       &lt;p&gt;
           Given the following multipartResolver in my spring servlet xml
           config file:
       &lt;/p&gt;

       &lt;p&gt;
           1.) servlet-xml file
       &lt;/p&gt;

       &lt;div class="codex"&gt;
           &lt;pre&gt;&amp;lt;bean id="multipartResolver"
       class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
   &amp;lt;property name="maxUploadSize"&gt;
     &amp;lt;value&gt;20000&amp;lt;/value&gt;
   &amp;lt;/property&gt;
   &amp;lt;property name="maxInMemorySize"&gt;
     &amp;lt;value&gt;0&amp;lt;/value&gt;
   &amp;lt;/property&gt;
&amp;lt;/bean&gt;&lt;/pre&gt;
       &lt;/div&gt;

       &lt;p&gt;
           2.) A multi-part form page that uploads a file.
       &lt;/p&gt;

       &lt;p&gt;
           3.) One or more sitemesh decorators applied to the page (1 main
           decorator and a few inline decorators).
       &lt;/p&gt;

   &lt;/div&gt;

   &lt;b&gt;When Submitting the Form&lt;/b&gt;
   &lt;div&gt;
       &lt;p&gt;
           Upon submitting the form, the request goes to the DispatcherServlet
           and calls the checkMultipart(request) method. If the size of the
           file being uploaded exceeds the max, a MultipartException gets
           thrown but does not get propagated. Spring tries to resolve the view
           assigned to this exception mapped with
           SimpleMappingExceptionResolver. The implication to this is that all
           pages being decorated by sitemesh are showing the default error page
           assigned.
       &lt;/p&gt;

       &lt;p&gt;
           So if a decorator is used on the menu, header, sidebar, and body of
           the page then the user will see 4 exception pages.
       &lt;/p&gt;

       &lt;p&gt;
           I've created a workaround for this by extending the
           DispatcherServlet and overloading the processHandlerException(...)
           method to rethrow any exceptions of type MultipartException (and not
           try to resolve the exception page assigned in spring).
       &lt;/p&gt;
   &lt;/div&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-8212254785268719185?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/8212254785268719185/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=8212254785268719185' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/8212254785268719185'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/8212254785268719185'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/09/sitemesh-decorator-goes-berzerk-with.html' title='Sitemesh decorator goes berzerk with Spring MultipartResolver'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-592937233369987028</id><published>2008-09-10T17:19:00.000-07:00</published><updated>2009-07-20T19:05:52.314-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='web development'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><title type='text'>Session Timeout Issue of an AJAX Driven Page</title><content type='html'>&lt;!-- Session Timeout Issue of an AJAX Driven Page --&gt;

&lt;div id="_blog"&gt;

   &lt;div&gt;
       &lt;p&gt;
           I love AJAX and I use it when it's necessary. I use Rico AJAX, dwr,
           and Yahoo UI Library in particular because it works. The only issue
           I'm having is I haven't figured out a way to detect session
           timeouts.
       &lt;/p&gt;
   &lt;/div&gt;

   &lt;div&gt;

       &lt;p&gt;
           Suppose I have the following page:
       &lt;/p&gt;

       &lt;ul&gt;
           &lt;li&gt;
               A view users page.
           &lt;/li&gt;
           &lt;li&gt;
               When user clicks on an item (a user) on the list of users, the
               detailed information about this user is retrieved via AJAX.
           &lt;/li&gt;
           &lt;li&gt;
               The user detail response coming back is an XMLResponse and
               contents of this reponse is processed by the Rico AJAX API and
               rendered in the user details &amp;lt;div&amp;gt; element.
           &lt;/li&gt;
       &lt;/ul&gt;

       &lt;pre&gt;#################################
# List of Users #               #
#               # [User Detail] #
# user1         #               #
# user2         #               #
# user[n]       #               #
#################################&lt;/pre&gt;

   &lt;/div&gt;


   &lt;b&gt;So what happens when the user session times out?&lt;/b&gt;
   &lt;div&gt;
       &lt;p&gt;
           In a standard web application, the request would then be redirected
           to the login page, user authenticates, then redirected back to the
           original URL.
       &lt;/p&gt;

       &lt;p&gt;
           In our AJAX driven User Detail page, the XML Response coming back
           turns out to be an HTML response, in this case the designated login
           page. So, the AJAX API (Rico) or any AJAX API will fail to render
           the &amp;lt;div&amp;gt;. In the frames world, the contents of the User
           Detail section would be a login page. In our case it is blank.
       &lt;/p&gt;

       &lt;p&gt;
           I think the AJAX API's should somehow detect this and refresh the
           page itself. Otherwise, what's going to end up happening is that all
           developers using the AJAX API would end up implementing their own
           scheme.
          

          


           For instance, I would resolve this by creating a BaseAjaxController
           class and let that base class handle what happens when a session
           times out (like refresh the page) so the user would be forced to
           re-authenticate him/herself.
       &lt;/p&gt;
   &lt;/div&gt;

&lt;/div&gt;
&lt;!--  _blog --&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-592937233369987028?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/592937233369987028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=592937233369987028' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/592937233369987028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/592937233369987028'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/09/session-timeout-issue-of-ajax-driven.html' title='Session Timeout Issue of an AJAX Driven Page'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-594740048274861360</id><published>2006-12-20T12:45:00.000-08:00</published><updated>2007-01-01T22:06:49.422-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='dev tools'/><title type='text'>Got MyEclipseIDE?</title><content type='html'>&lt;!--  Got MyEclipseIDE? --&gt;

&lt;div id="_blog"&gt;

    &lt;div&gt;
        &lt;p&gt;
            I've been a Java/J2EE Consultant for over 8 years now and I've been
            a MyEclipse subscriber since approximately 1993. I am always
            impressed in how fast MyEclipse kept up with the version of Eclipse
            and Eclipse plugins being released. New technologies emerge all the
            time and before you could think about it, the tools you love to use
            is already integrated on their next beta and eventually GA release.
        &lt;/p&gt;

        &lt;p&gt;
            When pair-programming with other developers I noticed that they are
            always in awe when they observe how I can modify my code on-the-spot
            without re-starting the web or application server. Of course the
            hot-code replace feature was never a surprise to me because I've
            been a MyEclipse user for quite a while now and previously a
            WebSphere/Rational Application Developer (WSAD) user as well which
            had similar set of tools for development (only WSAD is more
            expensive).
        &lt;/p&gt;


        &lt;p&gt;
            WebSphere/Rational Application Developer is a very similar IDE that
            comes with it's own suite of tools that will aid developers in
            whatever aspect of programming they are tasked to do. The big
            difference is that MyEclipseIDE uses mostly open source plugins and
            IBM develop its own. I think this price difference is worth noting.
            I have had the priviledge to read a couple of email responses to
            MyEclipseIDE lately and these emails were shaming MyEclipseIDE for
            &amp;quot;stealing&amp;quot; opensource tools. The responses really
            surprised me since on the other side IBM Develops it's own suite of
            tools and a single license cost $2220 while MyEclipseIDE uses
            opensource tools and their lowest subscription cost $31.75. Why are
            these people slamming MyEclipseIDE for delivering quality low-cost
            development tools?
        &lt;/p&gt;

        &lt;p&gt;
            I have also been in several projects where WebSphere was used and
            compared to MyEclipseIDE, WSAD was so bloated that normal day-to-day
            tasks would take longer than expected. Not to mention that it takes
            literally a day or two to install WSAD. I honestly am not sh*tting
            you. I hated installing WSAD. Take a look at the
            &lt;a
                href="https://www-112.ibm.com/software/howtobuy/buyingtools/paexpress/Express?P0=E1&amp;part_number=D54NBLL,D54N4LL,D54SDLL&amp;catalogLocale=en_US&amp;Locale=en_US&amp;country=USA"&gt;pricing&lt;/a&gt;
            for
            &lt;a
                href="http://www-306.ibm.com/software/awdtools/developer/application/index.html"&gt;IBM
                Rational Application Developer&lt;/a&gt; (formerly known as WebSphere
            Application Developer) and try not to freak out. WSAD is a very nice
            tool but the price-to-performance ratio for WSAD just doesn't
            compare to MyEclipseIDE.
        &lt;/p&gt;
    &lt;/div&gt;

    &lt;div align="center"&gt;
        &lt;h4&gt;
            &lt;a target="_new"
                href="http://www.myeclipseide.com/images/tutorials/feature_overview/MEFO%20-%20Main%20-%20Low%20Quality.htm"&gt;MyEclipseIDE
                Features Overview&lt;/a&gt;
        &lt;/h4&gt;
    &lt;/div&gt;

    &lt;b&gt;Cost Justification&lt;/b&gt;
    &lt;div&gt;
        For every consulting company that I have been in I have always used
        MyEclipse. Most of a consultants effort on the first week is getting
        setup with the company's development environment and most will have a
        base eclipse and numerous plug-ins to install. At an average, it will
        take at least 2 to 4 to set someone up on a new machine.
        &lt;ul&gt;
            &lt;li&gt;
                Install plug-ins
                &lt;br /&gt;
                (Struts, Spring Framework, Subversion, a plug-in to run an
                application server)
            &lt;/li&gt;
            &lt;li&gt;
                Install Database tools
            &lt;/li&gt;
        &lt;/ul&gt;

        &lt;div&gt;
            &lt;p&gt;
                So to do a calculation for 2 people at an average cost of
                $40/hr.
            &lt;/p&gt;

            &lt;div class="indent"&gt;
                2 people x $40 x 4 hours = $320.
            &lt;/div&gt;

            &lt;p&gt;
                This applies for all new employees or consultant that needs to
                be setup. I want to note that as of now, here are the different
                types of MyEclipse subscriptions:
            &lt;/p&gt;

            &lt;ul&gt;
                &lt;li&gt;
                    Standard Edition (SE) $31.75
                &lt;/li&gt;
                &lt;li&gt;
                    Professional Edition $52.95
                &lt;/li&gt;
            &lt;/ul&gt;

        &lt;/div&gt;


        &lt;div&gt;
            &lt;p&gt;
                I have also witnessed a setup time of one hour but then later on
                the users of these inferior plugins continue to have day-to-day
                issues and it does get costly when your IDE is crashing all the
                time and in addition you experience code synchronization issues
                between the source in your IDE and the application server (just
                to note some examples).
            &lt;/p&gt;

            &lt;p&gt;
                So I hope that this is a no-brainer for all managers out there.
                Got MyEclipseIDE?
            &lt;/p&gt;
        &lt;/div&gt;

    &lt;/div&gt;

    &lt;h4&gt;
        MyEclipseIDE Features That Stand Out
    &lt;/h4&gt;

    &lt;b&gt;Web Deployment Tools&lt;/b&gt;
    &lt;div&gt;
        &lt;p&gt;
            This feature has been around since day one and it's got to be one of
            my favorite. This particular feature handles how a web project
            deploys it's sources and reference libraries. If your web
            application refers to dependent projects, they can either be placed
            in the specified web classes output directory or be deployed as a
            [project].jar files. What typically happens in a non-MyEclipseIDE
            environment is that if you have a situation where a project refers
            to another project. When the child project changes, a ant build task
            is manually launched and jar the dependent project and gets placed
            in the WEB-INF/lib web project directory. Now, try and imagine if
            you are working on the child project. You would have to do this
            every time you make a code change and then restart your application
            server. How annoying is that? MyEclipseIDE updates the code every
            time you save so even when running Tomcat the hot-code-replace is
            awesome. Which developer do you think will be more productive?
        &lt;/p&gt;
    &lt;/div&gt;

    &lt;b&gt;Asynchronous JavaScript (AJAX) Tools&lt;/b&gt;
    &lt;div&gt;
        &lt;p&gt;
            If you've already jumped in the AJAX bandwagon you might be dreading
            it right now because it's hard to debug javascript code. But thank
            goodness that MyEclipseIDE comes with it's own suite of AJAX tools
            and the most useful tool to me is the AJAX debugger.
        &lt;/p&gt;

        &lt;p&gt;
            The debugger is so neat you can debug any live web address and then
            put a bookmark on any of its javascript code (this is possible since
            javascript is a public html resource). I urge you to watch this
            &lt;a target="_new"
                href="http://www.myeclipseide.com/images/tutorials/feature_overview/MEFO%20-%20Main%20-%20Low%20Quality.htm"&gt;MyEclipseIDE
                Features Overview&lt;/a&gt; (also mentioned above).
        &lt;/p&gt;
    &lt;/div&gt;

    &lt;b&gt;Database Tools&lt;/b&gt;
    &lt;div&gt;
        &lt;p&gt;
            I love this feature and is compatible with any JDBC-compliant
            database servers. What I find handy for this is the generation of
            the database entity relationship diagram (or ERD). I may have a task
            to implement a feature and as a consultant I am what you call a
            "business-rule" blind and I need to see the big picture. This allows
            you to generate the entire ERD or selectively. It prints out really
            nice as well. This is a cool feature to show to other
            non-MyEclipseIDE users because it is a developer productivity aid. I
            wanted to also note that it supports typical JDBC queries, table
            creates, etc..
        &lt;/p&gt;
    &lt;/div&gt;

    &lt;b&gt;Other Features Worth Noting&lt;/b&gt;
    &lt;div&gt;
        &lt;p&gt;
            There are several others worth noting like the hot-code-replace for
            launching application servers; Framework integration plug-ins for
            Spring, Hibernate, Java Server Faces, Struts, JSTL, Tapestry, etc...
        &lt;/p&gt;

    &lt;/div&gt;

    &lt;b&gt;Upgrading&lt;/b&gt;
    &lt;div&gt;
        &lt;p&gt;
            When new features come up, the freebie developer (a developer using
            Eclipse with manually installed plug-ins), will get the word somehow
            that a new upgrade for a particular plug-in has been released. That
            developer then downloads and installs the plug-in to find out later
            one that the plug-in is not compatible with the current version of
            Eclipse they are using. What I usually see happen is that other
            developers download and install the plug-ins as well, so now you
            have N developers that are *screwed* because no one has tested this
            plug-in. And if someone has tested them it's only for a particular
            version of Eclipse and not everyone is running the same version of
            it. So what ends up happening is that developers refrain from
            downloading a plug-in until someone else can guarantee that this
            will not break their current install. This could end up costing the
            company some amount of money as well for the time spent trying to
            resolve this issue, not to mention it will hinder developer
            productivity and lowers the developer tool confidence level as well.
        &lt;/p&gt;

        &lt;p&gt;
            So here I am at my workstation LMAO because I never have those
            issues being a MyEclipseIDE user. When I upgrade to the newest GA
            version the plug-ins in MyEclipseIDE are guaranteed to work. I never
            have to question whether this will break my development environment.
            It is always guaranteed that the integrated plug-ins are tested. And
            if a bug arises there's a place that I can go to for support and
            this rarely happens for me. For as long as I can remember I have
            never rolled back a GA version of MyEclipseIDE.
        &lt;/p&gt;

    &lt;/div&gt;

    &lt;b&gt;The MyEclipseIDE Influence&lt;/b&gt;
    &lt;div&gt;
        I don't usually convince or sell MyEclipseIDE to people and I think most
        of them will find that there a lot of benefits using this tool and I
        myself demonstrating developer productivity first hand is enough for
        companies to start buying several subscriptions themselves.
    &lt;/div&gt;

    &lt;b&gt;MyEclipseIDE: A Killer App?&lt;/b&gt;
    &lt;div&gt;
        I don't believe MyEclipseIDE is a killer app but I believe it's overall
        the best Java Development IDE out there that focuses on (1) low cost,
        (2) minimal bugs and (3) fast support turn-around at a very low price
        per seat. Every now and then when new features come out some of them may
        be quirky (like the Hibernate support tools) but they usually get better
        on future versions.
    &lt;/div&gt;



    &lt;b&gt;Reference:&lt;/b&gt;
    &lt;div&gt;
        &lt;ul&gt;
            &lt;li&gt;
                &lt;a href="http://www.myeclipseide.com/"&gt;MyEclipseIDE&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;a
                    href="http://jroller.com/page/myeclipseblog?entry=are_free_tools_really_free"&gt;Are
                    Free Tools Really Free? by Jens&lt;/a&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;

&lt;/div&gt;
&lt;!-- blog --&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-594740048274861360?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/594740048274861360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=594740048274861360' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/594740048274861360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/594740048274861360'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/12/got-myeclipseide.html' title='Got MyEclipseIDE?'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-9089656850069661417</id><published>2006-12-08T21:03:00.000-08:00</published><updated>2007-01-01T02:16:45.126-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web development'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Dealing with Html Buttons</title><content type='html'>&lt;!-- Dealing with Html Buttons --&gt;

&lt;div id="_blog"&gt;

&lt;p&gt;
I've gone through several deviations and techniques of handling HTML buttons in
an action handler code and so far this is the best and proven code that I have
came up with.&lt;/p&gt;

&lt;p&gt;The class is called &lt;a href="http://j2ee-example-code.googlecode.com/svn/spring-framework/trunk/src/main/org/j2ee/example/web/HtmlButtons.java"&gt;HtmlButtons&lt;/a&gt;
 and it is designed to handle buttons and image buttons in your HTML/JSP page.
&lt;/p&gt;

&lt;div class="codex"&gt;
&lt;p&gt;Suppose we have the follwing HTML form:&lt;/p&gt;
&lt;pre&gt;&amp;lt;form action="/createNewUser.do"&amp;gt;
&amp;lt;input type="text" name="username"/&amp;gt;
&amp;lt;input type="password" name="password"/&amp;gt;
&amp;lt;input type="submit" name="createButton" value="createButton"/&amp;gt;
&amp;lt;input type="image" name="deleteButton" value="deleteButton"/&amp;gt;
&amp;lt;/form&amp;gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
With HtmlButtons, the way to handle this in your action handler class would be very simple.
The following is an example of a Struts Action handler:&lt;/p&gt;

&lt;div class="codex"&gt;
&lt;pre&gt;public ActionForward execute(ActionMapping mapping, ActionForm form, 
        HttpServletRequest request, HttpServletResponse response) 
            throws Exception {
            
    ActionForward forward = mapping.getInputForward();
    HtmlButtons buttons = new HtmlButtons(request);
    if (buttons.pressed("createButton")) {
        // Create User
    } else if (buttons.pressed("deleteButton")) {
        // Delete User
    }
    return forward;
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
On top of that, if you create an abstract base action class, you could actually make the
HtmlButtons class be a part of your method arguments:&lt;/p&gt;

&lt;div class="codex"&gt;
&lt;pre&gt;// ActionBase#executeAction (abstract)
public ActionForward execute(ActionMapping mapping, ActionForm form, 
    HttpServletRequest request, HttpServletResponse response) 
        throws Exception {
        
    return executeAction(mapping, form, request, response, new HtmlButtons(request));
}

// Action Class Implementation
public ActionForm executeActionActionMapping mapping, ActionForm form, 
    HttpServletRequest request, HttpServletResponse response, 
    HtmlButtons buttons) throws Exception {
    
    if (buttons.pressed("createButton")) {
        // Create User
    } else if (buttons.pressed("deleteButton")) {
        // Delete User
    }    
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
View &lt;a href="http://j2ee-example-code.googlecode.com/svn/spring-framework/trunk/src/main/org/j2ee/example/web/HtmlButtons.java"&gt;HtmlButtons.java&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;&lt;!-- _blog --&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-9089656850069661417?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/9089656850069661417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=9089656850069661417' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/9089656850069661417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/9089656850069661417'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/12/dealing-with-html-buttons.html' title='Dealing with Html Buttons'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-8303986260496512801</id><published>2006-09-10T22:22:00.000-07:00</published><updated>2007-01-01T17:30:07.686-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web development'/><category scheme='http://www.blogger.com/atom/ns#' term='browser'/><title type='text'>Internet Explorer Submit Button Bug</title><content type='html'>&lt;!-- Internet Explorer Submit Button Bug --&gt;

&lt;div id="_blog"&gt;

    &lt;div&gt;
        &lt;p&gt;
            I've know about this problem for almost 3 years now. I guess It's
            time to put the blog out.
        &lt;/p&gt;

        &lt;p&gt;
            Affeted IE Version: 5 and 6
            &lt;br /&gt;
            Opera: ???
            &lt;br /&gt;
            Firefox, Bon Echo: Not affected
            &lt;br /&gt;
        &lt;/p&gt;


        &lt;b&gt;The Bug&lt;/b&gt;
        &lt;div class="codex"&gt;
            &lt;p&gt;
                If we have a form where only one text field exists:
            &lt;/p&gt;
            &lt;pre&gt;&amp;lt;form&amp;gt;
    First Name: &amp;lt;input type="text" name="firstName"/&amp;gt;&amp;lt;br/&amp;gt;
    Roles:&amp;nbsp;&amp;nbsp;
    admin: &amp;lt;input type="radio" name="role" value="admin" /&amp;gt;
    user: &amp;lt;input type="radio" name="role" value="user"checked="checked"/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;
    &amp;lt;input type="submit" name="submitButton" value="submit"/&amp;gt;
&amp;lt;/form&amp;gt;&lt;/pre&gt;
        &lt;/div&gt;

    &lt;/div&gt;


    &lt;div&gt;
        &lt;p&gt;
            When the user enters a first name and hits the enter button, here's
            the query string and by George the submitButton is missing!
        &lt;/p&gt;

        &lt;div class="codex_nsb"&gt;
            &lt;pre&gt;ie_submit_button_form.htm?firstName=John&amp;role=user&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/pre&gt;
        &lt;/div&gt;
    &lt;/div&gt;


    &lt;div&gt;
        &lt;p&gt;
            I know what you're thinking: IE sucks! Microsoft is Evil!
            Son-of-a-$*#@@#&amp;!
            &lt;br /&gt;
            I know. I know. But nobody writes perfect code so I'll show you how
            to fix this problem.
        &lt;/p&gt;
        &lt;p&gt;
            What's suppose to happen by default is that the first declared
            submit button should be set. In our case it's the submitButton. In
            IE, this doesn't happen.
        &lt;/p&gt;
    &lt;/div&gt;

    &lt;b&gt;The Workaround&lt;/b&gt;
    &lt;div class="codex"&gt;
        &lt;p&gt;
            So the way to fix this bug is add another text field.
            &lt;br /&gt;
            In most cases where you don't have a choice and there's only 1 text
            field in the form, you can add an invisible text field (a hack):
        &lt;/p&gt;

        &lt;div class="codex_nsb"&gt;
            &lt;pre&gt;&amp;lt;input type="text" style="display:none;"/&amp;gt;&lt;/pre&gt;
        &lt;/div&gt;

        &lt;p&gt;
            Now let's try this again, given the following code:
        &lt;/p&gt;
        &lt;pre&gt;&amp;lt;form&amp;gt;
    First Name: &amp;lt;input type="text" name="firstName"/&amp;gt;&amp;lt;br/&amp;gt;
    Roles:&amp;nbsp;&amp;nbsp;
    admin: &amp;lt;input type="radio" name="role" value="admin" /&amp;gt;
    user: &amp;lt;input type="radio" name="role" value="user" checked="checked"/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;
    &amp;lt;input type="submit" name="submitButton" value="submit"/&amp;gt;
&amp;lt;/form&amp;gt;&lt;/pre&gt;
    &lt;/div&gt;

    &lt;div&gt;
        &lt;p&gt;
            Focus on the first name field and type a name, then press Enter key.
        &lt;/p&gt;

        &lt;div class="codex"&gt;
            &lt;p&gt;
                Here is the query string and the submitButton is set:
            &lt;/p&gt;
            &lt;pre&gt;ie_submit_button_form.htm?firstName=George&amp;role=user&amp;submitButton=submit&lt;/pre&gt;
        &lt;/div&gt;

        &lt;p&gt;
            Putting an invisible text field is not a bad hack and does not
            require code change when new versions of IE come out. It's also not
            going to affect the other browsers that are functioning
            properly...nevertheless, it's a hack!
        &lt;/p&gt;
    &lt;/div&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-8303986260496512801?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/8303986260496512801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=8303986260496512801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/8303986260496512801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/8303986260496512801'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/12/internet-explorer-submit-button-bug.html' title='Internet Explorer Submit Button Bug'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-3906435522471856842</id><published>2006-09-10T14:01:00.000-07:00</published><updated>2007-01-01T17:33:25.722-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='spring framework'/><title type='text'>A Spring MultiActionController with Command</title><content type='html'>&lt;!-- A Spring MultiActionController with Command  --&gt;

&lt;div id="_blog"&gt;

    &lt;div&gt;
        &lt;p&gt;
            The following is an example Spring code on how to create a handler
            methond within a Spring MultiActionController that includes a
            Command object. The MultiActionController implementation simple
            checks whether a method with an additional object in the handler
            method signature exists. If that's the case it assumes that it is a
            command object and binds the request parameters to the command
            object.
        &lt;/p&gt;
    &lt;/div&gt;

    &lt;b&gt;Here Are Some Code Examples&lt;/b&gt;
    &lt;div&gt;
        &lt;div class="codex"&gt;
            &lt;p&gt;
                A typical Spring MultiActionController does not contain a
                command object in the method signature.
            &lt;/p&gt;

            &lt;pre&gt;public ModelAndView myHandler(HttpServletRequest request, 
        HttpServletResponse response) {
    // handler methods here
}&lt;/pre&gt;
        &lt;/div&gt;

        &lt;div class="codex"&gt;
            &lt;p&gt;
                A Spring MultiActionController with a Command object passed as
                an additional parameter in the method signature.
            &lt;/p&gt;

            &lt;pre&gt;public ModelAndView myHandler(HttpServletRequest request, 
        HttpServletResponse response, Object command) {
    MyObjectCommand command = (MyObjectCommand) command; 
}&lt;/pre&gt;
        &lt;/div&gt;



        &lt;div class="codex"&gt;
            &lt;p&gt;
                The creation of the command object can be overloaded as well.
            &lt;/p&gt;
            &lt;pre&gt;protected Object newCommandObject(Class clazz) 
        throws Exception {
    return new MyObjectCommand();
}&lt;/pre&gt;
        &lt;/div&gt;

    &lt;/div&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-3906435522471856842?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/3906435522471856842/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=3906435522471856842' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/3906435522471856842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/3906435522471856842'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/12/spring-multiactioncontroller-with.html' title='A Spring MultiActionController with Command'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-5813814490805223206</id><published>2006-09-10T12:17:00.000-07:00</published><updated>2007-01-02T12:20:49.799-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web development'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><title type='text'>Customizing Rico AJAX to process JavaScript Response Types</title><content type='html'>&lt;!-- Customizing Rico AJAX to process JavaScript Response Types --&gt;

&lt;div id="_blog"&gt;

    &lt;b&gt;The Issue&lt;/b&gt;
    &lt;div&gt;
        &lt;p&gt;
            &lt;a target="_new" href="http://openrico.org/"&gt;Rico Ajax&lt;/a&gt; currently
            does not know how to process xml responses of type
            "text/javascript". In a situation when We want to be able to send a
            javascript ajax response back, we totally are out of option. An
            example use would be is an XML Reponse that updates the state of an
            image (i.e., highlighted version of an image).
        &lt;/p&gt;
    &lt;/div&gt;

    &lt;b&gt;Consider the Ajax XML Response:&lt;/b&gt;
    &lt;div class="codex_nsb"&gt;
        &lt;pre&gt;&amp;lt;ajax-response&amp;gt;
    &amp;lt;response type="javascript" id="myResponseId"&amp;gt;
         function testFunction() {
            alert('Hello World');
         }
    &amp;lt;/response&amp;gt;
&amp;lt;/ajax-response&amp;gt;&lt;/pre&gt;

    &lt;/div&gt;

    &lt;b&gt;The Workaround&lt;/b&gt;
    &lt;div&gt;
        &lt;p&gt;
            Basically what we need to do is create a function to process a
            javascript content type. This method should do nothing more than
            call the javascript "eval" built-in function. The modification code
            is commented with "// Add This" below.
        &lt;/p&gt;

        &lt;div class="codex"&gt;
            &lt;pre&gt;_processAjaxResponse: function( xmlResponseElements ) {
  for ( var i = 0 ; i &lt; xmlResponseElements.length ; i++ ) {
     var responseElement = xmlResponseElements[i];

     // only process nodes of type element.....
     if ( responseElement.nodeType != 1 )
        continue;

     var responseType = responseElement.getAttribute("type");
     var responseId   = responseElement.getAttribute("id");

     if ( responseType == "object" )
        this._processAjaxObjectUpdate( this.ajaxObjects[ responseId ], responseElement );
     else if ( responseType == "element" )
        this._processAjaxElementUpdate( this.ajaxElements[ responseId ], responseElement );
     // Add This
     else if ( responseType == "javascript" )
        this._processAjaxJavascript( this.ajaxElements[ responseId ], responseElement );
     else
        alert('unrecognized AjaxResponse type : ' + responseType );
  }
},

_processAjaxObjectUpdate: function( ajaxObject, responseElement ) {
    ajaxObject.ajaxUpdate( responseElement );
},

_processAjaxElementUpdate: function( ajaxElement, responseElement ) {
    ajaxElement.innerHTML = RicoUtil.getContentAsString(responseElement);
},

// Add this
_processAjaxJavascript: function( ajaxElement, responseElement ) {
    eval( RicoUtil.getContentAsString( responseElement ) );
}&lt;/pre&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;b&gt;Reference:&lt;/b&gt;
    &lt;div&gt;
        &lt;ul&gt;
            &lt;li&gt;
                &lt;a target="_new" href="http://openrico.org/"&gt;OpenRico.org&lt;/a&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-5813814490805223206?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/5813814490805223206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=5813814490805223206' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/5813814490805223206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/5813814490805223206'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/09/customizing-rico-ajax-to-process.html' title='Customizing Rico AJAX to process JavaScript Response Types'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6220336561704295514.post-3717234295960259135</id><published>2006-09-01T17:08:00.000-07:00</published><updated>2007-01-02T17:48:37.900-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jdk1.5'/><category scheme='http://www.blogger.com/atom/ns#' term='ejb'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><title type='text'>Refactoring the EJBHomeFactory in JDK 1.5</title><content type='html'>&lt;!-- Refactoring the EJBHomeFactory for JDK 1.5 --&gt;

&lt;div id="_blog"&gt;

    &lt;div&gt;
        &lt;p&gt;
            Here's nifty way of refactory the EJBHomeFactory. What I really
            wanted to do if it's possible is to do to make a call to the factory
            without having to pass the EJBHome class. I have that implemented
            here but with the expense of a JNDI Name to EJBHome class mapping.
        &lt;/p&gt;

        &lt;p&gt;
            This is a code snippet of what I wish Java Templating could do.
            That's too bad that Java Templating doesn't support the T.class
            static property.
        &lt;/p&gt;

        &lt;div class="codex"&gt;
            &lt;pre&gt;public &amp;lt;T extends EJBHome&amp;gt; T getRemoteHome(String jndiHomeName)
        throws RemoteException {
    T home = null;
    try {
        InitialContext ctx = new InitialContext().lookup(jndiHomeName);
        home = (T) PortableRemoteObject.narrow(objRef, &lt;b style="color: red;"&gt;T.class&lt;/b&gt;);
    } catch (NamingException e) {
        throw (new RemoteException("Failed lookup on jndi [" + jndiHomeName
                + "]", e));
    }
    return home;
}&lt;/pre&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;b&gt;The old way&lt;/b&gt;
    &lt;div class="codex"&gt;
        &lt;pre&gt;try {
    AccountManagerHome remoteHome = (AccountManagerHome) EJBHomeFactory
            .getInstance().getRemoteHomeTheOldWay("ejb/AccountManager");
    AccountManager mgr = remoteHome.create();
    mgr.doSomething();
} catch (RemoteException e) {
    e.printStackTrace();
} catch (CreateException e) {
    e.printStackTrace();
}&lt;/pre&gt;
    &lt;/div&gt;

    &lt;b&gt;Using JDK 1.5 Typesafety&lt;/b&gt;
    &lt;p&gt;
        The only difference here is that the typcasting is ommitted.
    &lt;/p&gt;
    &lt;div class="codex"&gt;
        &lt;pre&gt;// Using JDK 1.5 Typesafety
try {
    AccountManagerHome remoteHome = EJBHomeFactory.getInstance()
            .getRemoteHome("ejb/AccountManager");
    AccountManager mgr = remoteHome.create();
    mgr.doSomething();
} catch (RemoteException e) {
    e.printStackTrace();
} catch (CreateException e) {
    e.printStackTrace();
}&lt;/pre&gt;
        To View the source code click:&amp;nbsp;
        &lt;a target="_new"
            href="http://j2ee-example-code.googlecode.com/svn/spring-framework/trunk/src/main/org/j2ee/example/ejb/factory/EJBHomeFactory.java"&gt;EJBHomeFactory.java&lt;/a&gt;
        or simply just browse the
        &lt;a target="_new"
            href="http://j2ee-example-code.googlecode.com/svn/spring-framework/trunk/src/main/org/j2ee/example/ejb/factory/"&gt;package
            contents&lt;/a&gt;.

    &lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6220336561704295514-3717234295960259135?l=xmx1024.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://xmx1024.blogspot.com/feeds/3717234295960259135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6220336561704295514&amp;postID=3717234295960259135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/3717234295960259135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6220336561704295514/posts/default/3717234295960259135'/><link rel='alternate' type='text/html' href='http://xmx1024.blogspot.com/2006/09/refactoring-ejbhomefactory-in-jdk-15.html' title='Refactoring the EJBHomeFactory in JDK 1.5'/><author><name>Antonio Lagnada</name><uri>http://www.blogger.com/profile/09955138968125520890</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://1.bp.blogspot.com/-IxtOvaca-m8/TjAvy8FbPrI/AAAAAAAAB_A/-KDCh2ELX0U/s220/IMG_4232.JPG'/></author><thr:total>0</thr:total></entry></feed>
