Spring安全过滤器和发布的数据

Spring安全过滤器和发布的数据,spring,spring-security,Spring,Spring Security,我编写了一个定制的Spring安全过滤器,需要使用发布到其中的XML数据。过滤器将如何获取发布的数据 这不是真正的Spring安全特定问题,因为您可能只是实现了javax.servlet.Filter接口。在本例中,您正在实现以下方法: public void doFilter ( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletExcepti

我编写了一个定制的Spring安全过滤器,需要使用发布到其中的XML数据。过滤器将如何获取发布的数据

这不是真正的Spring安全特定问题,因为您可能只是实现了
javax.servlet.Filter
接口。在本例中,您正在实现以下方法:

public void doFilter ( ServletRequest request, ServletResponse response, 
   FilterChain chain ) throws IOException, ServletException;
如果需要HTTP特定数据(通常是必需的),则可以将
ServletRequest
强制转换为
HttpServletRequest


如果您正在扩展一个标准的Spring安全过滤器,请确保查看要扩展的过滤器的源代码!他们中的许多人已经重写了doFilter,并期望您重写另一个方法来增强他们的行为

通读文档(根据前面的问题,我猜这是自定义筛选器扩展的类),要实现的抽象方法是,它接收HttpServletRequest和HttpServletResponse作为参数:

Parameters:
    request - from which to extract parameters and perform the authentication
    response - the response, which may be needed if the implementation has to do a redirect as part of a multi-stage authentication process (such as OpenID). 
Parameters:
    request - from which to extract parameters and perform the authentication
    response - the response, which may be needed if the implementation has to do a redirect as part of a multi-stage authentication process (such as OpenID).