Hi,
You probably need to add an application/x-www-form-urlencoded ContentType
header to a Post object :
post.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
Does post.setParameter() results in a request body being sent ? I did not know
that...
You might want to try with CXF :
WebClient client = WebClient.create("http://localhost:8080/rest/");
Response r = client.path("login").form(new Form().set("userName", "bar").set("password",
"foo"));
// just a sample
SSOToken token = fromResponseHeaderOrBody(r);
// back to http://localhost:8080/rest/
client.back().header("SSOToken", token);
// continue using the client
cheers, Sergey
----- Original Message -----
From: "Srikanth R Chinthala" <[email protected]>
To: <[email protected]>
Sent: Monday, May 11, 2009 2:23 PM
Subject: @FormParam not working
Hi,
I am using CXF 2.2 for implementing restful services. I have a post method
in the service
Ex:
@POST
@Path("/login")
public boolean login(@FormParam("userName") String userName,
@FormParam("password") String password )
I am not able to get the form param values in the service class there are
always null. Does CXF 2.2 support @FromParam? If yes, is there any
configuration to make it to work?
I am using apache commons http client to test my service:
Ex:
PostMethod post = new PostMethod("http://localhost:8080/rest/login");
post.addParameter("userName", "testuser");
post.addParameter("password", "testpassword");
HttpClient httpclient = new HttpClient();
int result = httpclient.executeMethod(post);
Could any one suggest me where am i doing wrong?
Thanks,
--
View this message in context:
http://www.nabble.com/%40FormParam-not-working-tp23483232p23483232.html
Sent from the cxf-user mailing list archive at Nabble.com.