dev@jsr311.java.net

Re: JSR311: Issue 18: XML Descriptor

From: Stefan Tilkov <stefan.tilkov_at_innoq.com>
Date: Tue, 1 Jul 2008 09:33:01 +0200

On Jun 30, 2008, at 6:45 PM, Marc Hadley wrote:

>> I would love to be able to specify the mapping from resources/verbs/
>> content types to classes/methods in a central location, as opposed
>> to spreading that knowledge all over the place. This excludes the
>> mapping of specific message or header parts to parameters, so I
>> would not suggest doing a complete XML alternative.
>>
> The issue with that is that the two are interrelated and I'm not
> convinced it makes sense to separate them. E.g. if the Java method
> has a parameter annotated with @PathParam then the path template
> better use the same template parameter name otherwise it won't work.

Of course they are related. But if I want to e.g. change my URI naming
scheme from /category/{name}/{topic} to /categories/{name}/{topic},
this is doable without changing the code.

I admit, though, that it would even more sense if there were no
distinction between path, query and matrix params. (In fact, I'm
starting to wonder why we even have it - if it weren't there, I could
change a URI convention from /cat?name={name}&id={id} to /{name}/{id}
without affecting the code. It would also open up the opportunity to
do something similar to "named routes" in Rails - i.e. I could refer
to it by name and pass it parameters to construct a URI.)

Stefan
--
Stefan Tilkov, http://www.innoq.com/blog/st/