Posts

Showing posts with the label REST

Complex JAX-RS

Working with JAX-RS to create a REST web service, I recently had the need to accept a List of a complex type as a parameter.  I was not able to find a complete example but I did read some Jersey documentation which I had not looked at in quite some time.  I read the  Jersey Parameter Annotations  section. The issue I was running into was the lack of a constructor for the complex type I wanted to pass in a list as a parameter to a REST web service method.  The documentation made me realize that I did not have a constructor which accepted a single String parameter from which an instance could be properly created. I also had some trouble with JSON marshalling/unmarshalling.  This may be a topic for another time but for now I solved it using the ObjectMapper from Jackson. Ultimately I put a trivial demo app together which is available here .  The application was created using NetBeans 7.4 as a maven web app to run on Glassfish 4.0 for convenience. ...

A bit of Python and some nice arguments

I really don't  use scripting languages on a regular basis but I do like to use the right tool for a job.  Or at least recognize that technologies with which we are most familiar are not always the best choice for any given use.   Python  is not a difficult language.  I have heard for years that it's the new Perl  which I find funny because of those I know using Perl, I have yet to learn of one contemplating a switch to Python. Depending on what you read, Google seems to like Python.  At least enough to create some course materia l and a whole lot of examples for their various efforts. It's been a good while since I looked at Python but it only took a short time today to write a simple script to call a REST service (as well it should).  Finding a nice little library, I chose  argparse , for the command line parameter processing ultimately required the most time (probably an hour after spending a lot less on the actual need).  This wa...