views:

301

answers:

1

Hi,

I have a controller mapped using annotations; the URL is being accessed by the client app and it sends POST / GET data. How do I access the request object in this method?

Thanks,

+1  A: 

Just add an argument of type HttpServletRequest to the method.

Check 13.11.4. Supported handler method arguments and return types in the spring mvc docs

so:

public String yourMethod(HttpServletRequest request) {..}

You can use specific request parameters the following way:

public String yourMethod(@RequestParam("petId") int petId) {..}
Bozho
Thanks, yeah I found it as well. :-)
Srirangan