Monday, June 02, 2008

I love SOA. I use servlets to send back JSON data and I honestly believe it's the most elegant approach to asynchronous data over the web. Sure, AJAX and XML is great but JSON has some real flexibility when it comes to small size and larger payloads. I frequently use Java with a tomcat server to handle the data coming from the database. I get to use Hibernate and it makes life very easy.

Today's post is about parsing servlet parameters. If you use SOA enough you'll find youre coding new servlet parameters all the time and your head begins to swim with all the work involved in reading and validating parameters. This is where this tasty nugget comes into play. I developed this to read the parameters and place them into a hashmap. The nice part about this is that you read the parameter set one time and the hashmap handles all sorts of things for you.

First its easy to find stuff and check for missing parameters. You simply need to see if the key exists to know if you have a parameter. Next, there is no code overhead here in maintaining a list of the parameters you are checking and assigning them to variables, fields, etc. You simply reference the hash and convert when necessary. So you get cleaner code by having less of it. Try using this the next time you're coding a servlet and you'll find it makes your SOA go much faster.



Please remember to make a post here if you use anything. I like to see how people are using my code.
Comments: Post a Comment

Links to this post:

Create a Link

<< Home


Recent Posts


Gave up on Vista
Do it yourself SEO. Free, Cheap SEO, no strings.
New Websites
Vista Laptop and Development
JDIC Just Works
Multiple Line JSF Data Tables
Code Syntax Highlighter/Formatter
Why aren't you using Damn Small Linux?
EJB3, Glassfish, MySQL, Toplink Working Together C...
EJB3, Glassfish, MySQL, Toplink Working Together


Archives

01/01/2005 - 02/01/2005
02/01/2006 - 03/01/2006
03/01/2006 - 04/01/2006
04/01/2006 - 05/01/2006
05/01/2006 - 06/01/2006
09/01/2006 - 10/01/2006
10/01/2006 - 11/01/2006
11/01/2006 - 12/01/2006
12/01/2006 - 01/01/2007
04/01/2007 - 05/01/2007
05/01/2007 - 06/01/2007
01/01/2008 - 02/01/2008
02/01/2008 - 03/01/2008
05/01/2008 - 06/01/2008
06/01/2008 - 07/01/2008
08/01/2008 - 09/01/2008
09/01/2008 - 10/01/2008
11/01/2008 - 12/01/2008
12/01/2008 - 01/01/2009
01/01/2009 - 02/01/2009
02/01/2009 - 03/01/2009
04/01/2009 - 05/01/2009
05/01/2009 - 06/01/2009
07/01/2009 - 08/01/2009
01/01/2010 - 02/01/2010

My Software

Blinky - GBPVR Plugin
PhotoCopy - GBPVR Plugin
QTC - Quick Test Case
rBoop - Rob's Timers

Programming Links

C# Formatter
NSIS

Other Links

Damn Small Linux

Sites I Manage

Do it yourself SEO. Cheap.
Pet Supplies
Dog toy of the month club
SqueakerZ pet Deals
Geocaching Community
Hitch hiker Tracking