On Oct 5, 2007, at 11:37 AM, Farrukh Najmi wrote:
>
> In my app's search protcol there is the ability to search using any
> parameterized query that may dynamically be added to the server.
> The query is invoked by specifying a URL of the following template:
>
> /search?queryId={queryId}&{param1Name}={param1Value}&{param2Name}=
> {param2Value}...
>
> The queryId is required. All of the other query params are optional
> and may be specified in any order/
>
> What is the best way to model this in wadl?
>
Assuming the list of parameter names is fixed then you can list all
of the parameters for the resource and set the required attribute to
true for queryId.
> Note that the likely best way to model the variable number of
> optional and dynamic query params is to use a Map as a method
> parameter where each key/value pair represents a paramname and a
> paramValue.
>
Right. wadl2java doesn't do that for query parameters but IIRC I did
something along those lines for matrix parameters which creates a
getter/setter pair for each optional parameter. That would give you a
URI like:
/search;{param1Name}={param1Value}&{param2Name}={param2Value}...?
queryId={queryId}
assuming you left queryId as a query parameter. The same approach
could be used for query parameters without too much effort I think
but I'm heads-down on another project at the moment so can't commit
to implementing that for a while.
Marc.
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.