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?
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) {..}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With