package com.njzscloud.common.mvc.support;

import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

@Slf4j
public class ReusableRequestFilter implements Filter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
        /* HttpServletRequest httpServletRequest = (HttpServletRequest) request;
        if ("Upgrade".equalsIgnoreCase(httpServletRequest.getHeader("connection"))
                || "Upgrade".equalsIgnoreCase(httpServletRequest.getHeader("Connection"))
        ) {
            chain.doFilter(request, response);
        } else {
            chain.doFilter(new ReusableHttpServletRequest((HttpServletRequest) request), response);
        } */
        chain.doFilter(new ReusableHttpServletRequest((HttpServletRequest) request), response);
    }
}
