But at least some consumers will prefer a json response to an XML
response.  
XML can be converted to non-idiomatic JSON using a convention called
BadgerFish.  The problem is that it's ugly -- it translates <x>123</x>
to x : {'$' : '123'}, instead of x : 123.  
We can do better.  We should be able to write some sort of schema
defining how documents conforming to a given XML schema can be converted
idiomatically to json.  This requires human labor to write the
conversion rules, but then the conversion can be done automatically.
I'm thinking something like this (for
http://maps.trimet.org/maps/model/xml/Itinerary.xsd):
<response jc:type="object" success="boolean field">
  <date />
  <time />
  <request jc:type="object">
    <url />
    <param jc:field_from_attribute="name" />
  </request>
  <from jc:type="object">
    <pos type="object>
      <x jc:type="numeric"/>
      ...
    </pos>
    <description />
  </from>
  <itineraries jc:type="list">
     <itinerary jc:type="object" id="numeric field" viaRoute="string
field">
...
This would result in a response looking something like:
{'success' : true,
'date' : '10/09/2009',
'time' : '10:22:22',
'request' : {
    'url' : 'http://...',
    'params' {'Mode' : 'A',
              'fromPlace' : 'pdx',
              ...}
     }
'from': {
     'pos' : {
          'x' : 7666295.0,
          ...
          }
     },
     'description' : 'PDX (Portland)',
}
'itineraries' : [
{'id' : 1, 
'viaRoute': '90', 
...
------------------
Does this sound like the right strategy?
Nick actually coded a Java GeoJSON reader for a training project when he 
started TOPP (GeoServer/GeoTools just had a writer, as we just produced 
it).  Gabriel just spent some time cleaning it up, and we're using it in 
another project.  Should be useful for the client to send geojson 
requests to a java server.
David or Gabriel can point you at the repository, and we should work to 
move it to a common area like GeoTools.  Though I think it's specific to 
a library, so you may code up something special for Jersey - it's a 
pretty easy format.
Also, just FYI, GeoServer uses RESTlet for all it's rest api stuff.  And 
xstream to produce the json or the xml (it handles writing both from the 
same model).  RESTlet gives you a bit more control, but is also more 
work.  Jersey at the time was immature, the spec wasn't even done.  But 
it's probably the right call now.
C
> On Oct 9, 11:08 am, David Turner <nova...@novalis.org> wrote:
>> Does this sound like the right strategy?
-- 
Chris Holmes
OpenGeo - http://opengeo.org
Expert service straight from the developers.