post - Get body content using HttpServletRequest in Jersey -
i using jersey 1.7 , trying access request body in method similar question: how read post parameters restful service using jersey? body value comes in fine email=xx@ws.com&password=test1
i tried using @context httpservletrequest request , tried access email request.getparameter("email") nothing. there nothing inside request.getparametermap() either.
my api looks this: @post @produces(...) public response getdata(@formparam("email") string email, @formparam("password") string password, string body, @context httpservletrequest request) { ....
i tried changing position of string body , request no avail.
the string body gets value fine(it coming iphone device , not through form submit , shows in string body). right now, trying parse body content(email=xx@ws.com&password=test1) , each variable email out painful.
is there way values using request.getparameter("email") ?
or there quick utility convert body content string email , string password ?
tia, vijay
i never used form parameters myself, docs should work since forever:
@post @consumes("application/x-www-form-urlencoded") public void post(multivaluedmap<string, string> formparams) { // store message } http://wikis.sun.com/display/jersey/overview+of+jax-rs+1.0+features
Comments
Post a Comment