-2

in a springcloud project if a backend microservice has the following:

@RequestMapping("/test")
pubilc void test(@RequestBody MyPram myParam){
    ...
}

how can I retrive the "myParam" value in a zuul filter? in other words, since I can have the following code segment in a zuul filter

    RequestContext ctx = RequestContext.getCurrentContext();
    HttpServletRequest request = ctx.getRequest();

how can I retrive the "myParam" value from a request?

wen
  • 17
  • 2

1 Answers1

0

i don't know in Spring Cloud but tried in springMVC (spring version 3) we can get the Request body HttpServeletRequest object or method.

@RequestMapping(value="/employee/{id}") public @ResponseBody String demo(HttpServletRequest request, @PathVariable("id") Integer id) {

    if (request.getMethod().equalsIgnoreCase("POST")) {
        return "POST MEhod";
    } else if (request.getMethod().equalsIgnoreCase("GET")) {
        return "GET Method";
     }
      }

Its not exact what you are looking but it will give you hint to solve your problem

iragond
  • 60
  • 6