CXF 2.2 snapshot supports JSR311 1.0. So, you should be able to use @FormParam
in CXF restful resources.
A simple example of using @FormParam using JSR311 API.
@Path("/rest")
public class Resource {
@POST
@ConsumeMime(MediaType.APPLICATION_FORM_URLENCODED)
public String post(
@FormParam("a") String a,
@FormParam("b") String b) {
return a + b;
}
I am not sure whether CXF implementation supports a rest client api, but with
Jersey you could do like this.
WebResource r = Client.create().resource("/rest");
Form form = new Form();
form.add("a", "foo");
form.add("b", "bar");
String s = r.post(String.class, form);
You could have your resources implemented in CXF and probably use Jersey
Client. I have seen this working.
Other option could be to use multiparts. I have recently blogged[1] about using
MIME multiparts in a JAX-RS service, but it uses Jersey multipart API.
@FormParam processing in jersey-multipart is supported in the latest 1.0.2
snapshots, in case if you need this support.
-Arul
[1] http://aruld.info/handling-multiparts-in-restful-applications-using-jersey/
----- Original Message -----
From: kpalania
[mailto:[email protected]]
To: [email protected]
Sent: Tue, 30 Dec 2008
21:35:11 -0700
Subject: FormParam support and usage..
>
> I am using CXF-2.1.2 and I don't believe this has support for @FormParam
> since it uses jsr-311*.jar version 0.8 (as opposed to 0.10). I have a need
> to POST a large piece of content (over 4K) via the RESTful Services and I
> believe I would need to use the FormParam. First of all, is that right?
> Where can I get the extension JAR and could someone also give me a sample
> Client call?
> --
> View this message in context:
> http://www.nabble.com/FormParam-support-and-usage..-tp21227224p21227224.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>