Hi,
Because of the changes to unify injection it made it much easier to
support form-based parameters. It is nice when solving one problem for
another problem to be solved as well :-)
With the latest bits [*] you can now do this:
@Path("/")
public class Resource {
@POST
@ConsumeMime(MediaType.APPLICATION_FORM_URLENCODED)
public String post(
@FormParam("a") String a,
@FormParam("b") String b) {
return a + b;
}
}
And this can be tested with the client API as follows:
WebResource r = Client.create().resource("/")'
Form form = new Form();
form.add("a", "foo");
form.add("b", "bar");
String s = r.post(String.class, form);
This is only supported for non GET HTTP methods where all method
parameters must be annotated and there must be as least one annotated
with @FormParam. This means one cannot do this:
@POST
public String post(@FormParam("a") String a, String content) { ... }
A runtime exception will be thrown when attempting to obtain the
@FormParam value.
The same rules apply to @FormParam as they do for the other @*Param,
including overriding support for other types (excepted that
encoded/decoded form is not currently supported).
Paul.
[*] The internal Hudson server is still down so if you want to try it
out you need to build from the trunk.
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109