Spring Boot + Gradle: как собрать исполняемый jar

Решение

@RequestMapping(value = "processing", method = RequestMethod.GET)
public @ResponseBody ProcessResponse processData(@RequestParam("workflow") final String workflow,
    @RequestParam("conf") final String value, @RequestParam("dc") final String dc, HttpServletRequest request) {

        System.out.println(workflow);
        System.out.println(value);
        System.out.println(dc);
        System.out.println(request.getRemoteAddr());
        // some other code
    }

Добавить HttpServletRequest request в определение вашего метода, а затем использовать сервлет API

Spring Documentation здесь , указанный в

15.3.2.3 Поддерживаемые аргументы метода обработчика и возвращаемые типы

blockquote>
Handler methods that are annotated with @RequestMapping can have very flexible signatures.
Most of them can be used in arbitrary order (see below for more details).

Request or response objects (Servlet API). Choose any specific request or response type,
for example ServletRequest or HttpServletRequest

16
задан sva605 25 October 2017 в 19:37
поделиться