Austin Kottke's Code Site

Thoughts about Architecture – Java, C/C++, JS, Objective-C, Swift, Groovy, Grails, (RIP Flash)
Archive for January, 2011

I combined Stripes and Velocity into a J2EE filter that came out to be extremely useful, so I could have Stripes/JSPs and have Velocity rendering with every request. I love the toolbox.xml concept of velocity so I couldnt live without it, but wanted to use stripes for its amazing action controller functionality. Here is a filter which modifies the stripes response and then parses the response through the Velocity Template Engine.   package org.adk.java.viewfilter;   import org.adk.java.locale.LocaleTool; import java.io.CharArrayWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Collection; import java.util.Iterator; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.adk.java.store.StoreWebApplication; import org.adk.java.store.WebSessionBean; import org.adk.java.log.KLogger; import org.adk.java.secure.SecureRedirectorActionBean; import org.adk.java.stripes.ActionBeanUrlManager; import org.adk.java.viewfilter.tools.BaseTool; import org.adk.java.viewfilter.tools.BreadCrumbTool; import org.adk.java.viewfilter.tools.PropertyTool; import org.adk.java.viewfilter.tools.RequestTool; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.apache.velocity.tools.view.XMLToolboxManager;   /******************************************************************************************** * <p> * Our basic filter, all it does is take our WebSessionBean which is a wrapper around * the current session and passes it in the request, so that all jsps and other objects * can access the data, such as the current users shopping cart, his user info, and * other pertinent details to the session for this user. * <p> * In addition to basic session addition, we also take the content and * add in the velocity template engine so the session can be accessed from * velocity, and all content, after stripes is done with it is modified * with velocity. * <p> * We perform the…

For the last few years I’ve been developing in flex. One of the very nice features is RSLs to save on file space, but no matter how much optimization work you end up with a huge SWF right? Which is why developers end up using flash for web development. How many times have you wanted to use the RPC components but ended up scrapping them because they bloat your SWFs? I’ve had to resort to custom AS3 soap libraries, or even have had to hack an existing AS3 web service implementation because it wasn’t compatible with ALL SOAP specs, as in each server has little nuances which can potentially break an AS3 implementation. The joys =) Ive been doing a lot of flash dev recently, and one option which I think a lot of flash developers miss over is the fact that they compile assets within assets that are shared across multiple SWF files. E.g. you have the Pure MVC framework or cairngorm classes compiled into 5 swfs, when really, all you need to load in a single shell SWF and all future SWF files can reference the classes normally WITHOUT compiling in the entire framework. So how do you do this? How do you make your other SWFs not compile the entire framework such as ui components and buttons and flash? Well, instead of doing all the runtime instantiation and non strong typing – you know like var myClass:* – which is prone to errors, use mxmlc -load-externs. So the steps are as follows:…

I found an awesome video that came out last month from one of the Spring Source engineers on building an entire application in Grails. I think if anything this video shows the true simplicity of grails. It outlines security, ajax, authentication, jdbc, validation and how fast it is to develop with grails. You see how robust and quick to develop a data-base driven twitter clone. Please follow and like us:0

I come from a myriad of development backgrounds, actually started doing C/8086 assembly back in the day. Went into playstation development, and then moved onto flash, qt c++, win 32, java, and ajax. I developed heavily in java for the last few years and stumbled upon rails – couldn’t stand the syntax although I loved the power and the scaffolding. I then discovered grails and man this is like a new world. The power of ruby on rails but in a java-like syntax. The key problems I see in web development are: 1. Properly planning the development project2. Allocating enough time to do the project without shortcutting it3. Implementing the project in the time allotted4. Getting management to work with the clients to properly allocate enough time/money to spend on the lifecycle without shortcutting the features I think projects that are heavily ajax/html or flex projects can be GREATLY simplified by using grails as it writes a lot of the code for you and can really make some of the back-end development which we never want to do a breeze and very integrated. The problem with writing entity beans in java is that the annotations and amount of code written pales in comparison to a grails entity bean and how simple it is to add validation, etc. I plan to do some more examples as I get more and more familiar with the grails code base. Check it out: http://www.grails.org/ Please follow and like us:0