Archive for the 'Java' Category

Apr 21 2013

Play Framework 2.1: The Bloom is Off The Rose

Published by under Java,Web

On a recent project, my team evaluated several web frameworks for an upcoming web application. We chose The Play Framework. I was very attracted to its simplicity and the rapidity with which we could get things working. The Scala templates are also very powerful and much simpler (for me at least) than JSP templates. All in all it seemed like a match made in heaven. We were all really enjoying working with it. Unfortunately the honeymoon ended shortly thereafter.
Continue Reading »

19 responses so far

Dec 07 2011

Windows CoffeeScript Auto-Compiler using Groovy and JDK 7 WatcherService

Published by under CoffeeScript,Groovy,JDK 7

Update: Node.js for Windows has been improved since this post, so this information is obsolete. Last time I checked I was able to run CoffeeScript the same on Windows as I do on Linux and OSX.

If you’re using the CoffeeScript compiler for Windows (By Alexey Lebedev) you’ve probably noted a lack of a -w or “–watch” argument. These arguments can be very handy if you are working with a coffeescript file and want to quickly see the results of your edits. Given this lack of functionality and my desire to write some code in Groovy 1.8 using some of the NIO2 JDK 7 features I decided to write a little script that wraps this CoffeeScript compiler and fills in this missing feature.
Continue Reading »

2 responses so far

Feb 26 2010

Spring 3.0 REST Release Update

Published by under Java,REST,Spring

In December 2009 I talked about getting a RESTful web service up and running using Spring 3.0.0.RC3. Since then Spring has had 3.0.0.RELEASE and 3.0.1.RELEASE. One of these releases caused my code example from this post to fail, so I’ve re-worked it and tested with Spring 3.0.1.RELEASE. Continue Reading »

2 responses so far

Dec 01 2009

Spring 3.0 RESTful Web Services By Example

Published by under Java,REST,Spring

Update:See this post for an updated code example that works with Spring 3.0.1.RELEASE.

If you’re reading this then you’re probably aware that the new Spring 3.0 release will have REST support (If you’re not familiar with REST here is a nice intro).  In this article I’m going to describe the basic steps required to quickly get a RESTful XML web service going using the latest Spring 3 release candidate (3.0.0.RC3).  In future follow-up articles I will describe how to switch between JSON and XML using selectors and how to use the Spring REST Template to read RESTful web services.
Continue Reading »

31 responses so far

Nov 27 2009

Closures Are in Again

Published by under Java,News

According to Sun, the controversial language feature, Closures, that was previously removed from the JDK 7 feature list has now been added in again (via).  I’m looking forward to the JSR on this one.  While I can’t see it being more elegant that using Scala, it will definitely make certain algorithms much nicer to implement in Java.

No responses yet

Jul 24 2008

Useful Java Utilities and Frameworks

Published by under Java

There are so many useful Java frameworks and utilities out there that are free and open source that it boggles the mind. Here are a few of my recent favorites. Feel free to add your own to the list. There are many many more that I did not add to this list because they are very common (e.g. log4J, JUnit, etc.)
Continue Reading »

4 responses so far

Apr 08 2008

Using Apache Commons DBUtils and DBCP

Published by under Java

For a project recently, I had the pleasure of working with both DBUtils and DBCP (Database Connection Pooling) from the Apache commons libraries. Both of these libraries together helped me to quickly create a simple, extensible DAO layer for my project. Both libraries include some great default features that I used right out of the box, without any configuration or fuss. In the post I’ll be talking about, and showing an example of using DBUtils. I will also show a quick and easy way to get a DataSource using DBCP.
Continue Reading »

2 responses so far

Dec 21 2007

Using the New java.io.Console Class

Published by under Java

The 1.6 release of the JDK included a new java.io.Console class, which adds some new features to enhance and simplify command-line applications. Notably, Console includes a method specifically for reading passwords that disables console echo and returns a char array; both important for security.
Continue Reading »

11 responses so far

Oct 18 2007

Yummy Web Service Goodness

Published by under Java,Web

I’m not sure why I haven’t ventured into the realm of web services before this week. It probably has a lot to do with time (or lack thereof) and the type of projects I’ve worked on. But, I finally got my feet wet this week. My employer asked me to create a web service that publishes a service that we currently offer via a JSP web application. As I found out, the back-end logic is unnecessarily complex. To complicate matters the app is written using old-style JSP that is inundated with scriptlets and scattered across many smaller pages which are included based on if-then logic within the scriptlets. Yeah, it’s a mess. So, I read up on XML Schema and WSDL formats and created a WSDL. I know a lot of frameworks create the WSDL for you based on your objects, but I’ve heard that the WSDL-first approach is better for interoperability across platforms. I used Apache Axis as the WS framework because that’s what our project already used to consume web services, I just found out we’re switching from Tomcat to WebLogic and using the WebLogic web service framework. Nice. Good thing I used the WSDL-first approach. Should be a snap to convert. We’ll see.

No responses yet

Sep 17 2007

Cloning an Object Using Reflection

Published by under snippets

Here’s a quick and dirty way to do a shallow copy of an object by overriding the clone method of Object. If you want to do deep copying, you’ll have to fidget with this a little more…or maybe I’ll do another blog about doing recursive cloning for deep copying. We’ll see.
Continue Reading »

3 responses so far