We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add interceptor the example, response message loss (no {"msg": "error"})
public class MainInterceptor implements AsyncHandlerInterceptor { final ObjectMapper objectMapper = new ObjectMapper(); @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { Map<String, Object> map = new HashMap<>(); map.put("msg", "error"); response.setStatus(200); response.setContentType("application/json;charset=UTF-8"); response.getWriter().append(objectMapper.writeValueAsString(map)); return false; } }
`@Configuration public class MainMvcConfig implements WebMvcConfigurer {
@Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new MainInterceptor()) .addPathPatterns("/**") .excludePathPatterns("/req-param"); }
}`
>curl http://localhost:8080/
The text was updated successfully, but these errors were encountered:
I'm not very sure what's your question...
Sorry, something went wrong.
HttpServletResponse -> loss data
If I return a response in the interceptor, the data will be lost.@piomin
SYanalyser
No branches or pull requests
add interceptor the example, response message loss (no {"msg": "error"})
`@Configuration
public class MainMvcConfig implements WebMvcConfigurer {
}`
>curl http://localhost:8080/
The text was updated successfully, but these errors were encountered: