由于没有建议使用内置方法来获取POST负载,因此我继续编写了一个自定义过滤器来转储负载的内容。特别:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; LOG.debug("payload: " + requestWrapper.getRequestBody());
和web.xml:
<filter> <filter-name>PayloadLoggingFilter</filter-name> <filter-class>com.host.PayloadLoggingFilter</filter-class></filter><filter-mapping> <filter-name>PayloadLoggingFilter</filter-name> <url-pattern>/resources/*</url-pattern></filter-mapping>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)