@SuppressWarnings("unchecked")
    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException,
            ServletException {
        HttpServletRequest request = (HttpServletRequest) req;

        String actor = null;

        if (userSessionAttrName != null && !userSessionAttrName.equals("")) {
            HttpSession session = request.getSession(false);
            actor = (String) session.getAttribute("userSessionAttrName");
        }
        String ipAddress = request.getRemoteAddr();
        String url = request.getRequestURL().toString();

        EventBuilder builder = new EventBuilder();
        builder.addAction(url).addOrigin(ipAddress);
        if (actor == null) {
            builder.addActor(ipAddress);
        } else {
            builder.addActor(actor + "[" + ipAddress + "]");
        }

        Map<String, String[]> params = req.getParameterMap();

        for (final Map.Entry<String, String[]> entry : params.entrySet()) {
            builder.addField(entry.getKey(), entry.getValue());
        }

        AuditManager.getInstance().audit(builder.build());
        chain.doFilter(req, res);
    }
@ SuppressWarnings ( "unchecked" ) @ Override public void doFilter ( ServletRequest req , ServletResponse res , FilterChain chain ) throws IOException , ServletException { HttpServletRequest request = ( HttpServletRequest ) req ; String actor = null ; if ( userSessionAttrName != null && ! userSessionAttrName . equals ( "" ) ) { HttpSession session = request . getSession ( false ) ; actor = ( String ) session . getAttribute ( "userSessionAttrName" ) ; } String ipAddress = request . getRemoteAddr ( ) ; String url = request . getRequestURL ( ) . toString ( ) ; EventBuilder builder = new EventBuilder ( ) ; builder . addAction ( url ) . addOrigin ( ipAddress ) ; if ( actor == null ) { builder . addActor ( ipAddress ) ; } else { builder . addActor ( actor + "[" + ipAddress + "]" ) ; } Map < String , String [ ] > params = req . getParameterMap ( ) ; for ( final Map . Entry < String , String [ ] > entry : params . entrySet ( ) ) { builder . addField ( entry . getKey ( ) , entry . getValue ( ) ) ; } AuditManager . getInstance ( ) . audit ( builder . build ( ) ) ; chain . doFilter ( req , res ) ; }
/*
(non-Javadoc)

@see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse, javax.servlet.FilterChain)