jodd-lagarto/src/main/java/jodd/lagarto/filter/LagartoServletFilter.java
@Override
	public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
		HttpServletRequest request = (HttpServletRequest) servletRequest;
		HttpServletResponse response = (HttpServletResponse) servletResponse;
		String actionPath = DispatcherUtil.getServletPath(request);

		if (processActionPath(request, response, actionPath)) {
			return;
		}

		if (!acceptActionPath(request, actionPath)) {
			filterChain.doFilter(servletRequest, servletResponse);
			return;
		}

		BufferResponseWrapper wrapper = new BufferResponseWrapper(response);
		filterChain.doFilter(servletRequest, wrapper);

		// reset servlet response content length AFTER the chain, since
		// servlet container may set it and we are changing the content.
		servletResponse.setContentLength(-1);

		char[] content = wrapper.getBufferContentAsChars();

		if ((content != null) && (content.length != 0)) {
			if (log.isDebugEnabled()) {
				log.debug("Lagarto is about to parse: " + actionPath);
			}
			try {
				content = parse(content, request);
			} catch (Exception ex) {
				log.error("Error parsing", ex);
				throw new ServletException(ex);
			}

			wrapper.writeContentToResponse(content);
		}
	}
@Override
	public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException {
		HttpServletRequest request = (HttpServletRequest) servletRequest;
		HttpServletResponse response = (HttpServletResponse) servletResponse;
		String actionPath = DispatcherUtil.getServletPath(request);

		if (processActionPath(request, response, actionPath)) {
			return;
		}

		if (!acceptActionPath(request, actionPath)) {
			filterChain.doFilter(servletRequest, servletResponse);
			return;
		}

		BufferResponseWrapper wrapper = new BufferResponseWrapper(response);
		filterChain.doFilter(servletRequest, wrapper);

		// reset servlet response content length AFTER the chain, since
		// servlet container may set it and we are changing the content.
		servletResponse.setContentLength(-1);

		char[] content = wrapper.getBufferContentAsChars();

		if ((content != null) && (content.length != 0)) {
			if (log.isDebugEnabled()) {
				log.debug("Lagarto is about to parse: " + actionPath);
			}
			try {
				content = parse(content, request);
			} catch (Exception ex) {
				log.error("Error parsing", ex);
				throw new ServletException(ex);
			}

			wrapper.writeContentToResponse(content);
		}
	}
@ Override public void doFilter ( final ServletRequest servletRequest , final ServletResponse servletResponse , final FilterChain filterChain ) throws IOException , ServletException { HttpServletRequest request = ( HttpServletRequest ) servletRequest ; HttpServletResponse response = ( HttpServletResponse ) servletResponse ; String actionPath = DispatcherUtil . getServletPath ( request ) ; if ( processActionPath ( request , response , actionPath ) ) { return ; } if ( ! acceptActionPath ( request , actionPath ) ) { filterChain . doFilter ( servletRequest , servletResponse ) ; return ; } BufferResponseWrapper wrapper = new BufferResponseWrapper ( response ) ; filterChain . doFilter ( servletRequest , wrapper ) ; // reset servlet response content length AFTER the chain, since // servlet container may set it and we are changing the content. servletResponse . setContentLength ( - 1 ) ; char [ ] content = wrapper . getBufferContentAsChars ( ) ; if ( ( content != null ) && ( content . length != 0 ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Lagarto is about to parse: " + actionPath ) ; } try { content = parse ( content , request ) ; } catch ( Exception ex ) { log . error ( "Error parsing" , ex ) ; throw new ServletException ( ex ) ; } wrapper . writeContentToResponse ( content ) ; } }
Wraps the response and parse it using Lagarto parser.
It first calls {@link #processActionPath(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, String)}
to optionally consumes path, then {@link #acceptActionPath(javax.servlet.http.HttpServletRequest, String)} to
check if path is accepted for processing.
Wraps the response and parse it using Lagarto parser . It first calls {