# springBoot modify servelet request before Controller handling ref: [link](https://stackoverflow.com/questions/50932518/how-to-modify-request-body-before-reaching-controller-in-spring-boot) reminder --- 0. filter update the serveletRequest ```java= HttpServletRequest mod = (HttpServletRequest)servletRequest; mod.setAttribute("trueName",userId ); //filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(mod, servletResponse); ``` 1. controller method use ```java= @PostMapping("/getFuncAuth") public Map<String, Object> getFuncAuth(@RequestBody Map<String, Object> params,@RequestAttribute("trueName") String customAttribute) throws Exception { Map<String, Object> returnMap = new HashMap<>(); params.put("user_id", customAttribute); returnMap.put("auth", service.getFuncAuth(params)); return returnMap; } ``` ###### tags: `SPRINGBOOT`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up