Spring web: Controllers with annotated mappings - Getting HttpServletRequest / form data

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?

--------------Solutions-------------

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) {..}

Category:java Time:2010-04-09 Views:0

Related post

Copyright (C) pcaskme.com, All Rights Reserved.

processed in 0.530 (s). 13 q(s)