java.lang.IllegalArgumentException: UT000068: Servlet path match failed

java.lang.IllegalArgumentException: UT000068: Servlet path match failed_第1张图片

20:52:16.164 [XNIO-1 I/O-2] ERROR io.undertow.request - UT005071: Undertow request failed HttpServerExchange{ CONNECT www.google.com:443}
java.lang.IllegalArgumentException: UT000068: Servlet path match failed

java.lang.IllegalArgumentException: UT000068: Servlet path match failed_第2张图片

20:52:16.164 [XNIO-1 I/O-2] ERROR io.undertow.request - UT005071: Undertow request failed HttpServerExchange{ CONNECT www.google.com:443}
java.lang.IllegalArgumentException: UT000068: Servlet path match failed
        at io.undertow.servlet.handlers.ServletPathMatchesData.getServletHandlerByPath(ServletPathMatchesData.java:83)
        at io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:133)
        at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:148)
        at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:69)
        at org.springframework.boot.web.embedded.undertow.DeploymentManagerHttpHandlerFactory$DeploymentManagerHandler.handleRequest(DeploymentManagerHttpHandlerFactory.java:74)
        at io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:66)
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
        at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:256)
        at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
        at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162)
        at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100)
        at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
        at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
        at org.xnio.nio.QueuedNioTcpServer2.acceptTask(QueuedNioTcpServer2.java:178)
        at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)
        at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)

package Filter;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

/**
 * 网络请求黑名单过滤【举个栗子】
 * 
 * 
 *
 * @author ZengWenFeng
 * @date 2023.11.27
 * @mobile 13805029595
 * @email [email protected]
 */
public class WebFilter implements Filter
{
	private static List listBlack = new ArrayList();
	Logger logger = Logger.getLogger("WebFilter");

	public WebFilter()
	{

	}

	public void destroy()
	{

	}

	public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException
	{
		HttpServletRequest request = (HttpServletRequest) arg0;
		String uri = request.getRequestURI();
		String host = request.getRemoteHost();
		int port = request.getRemotePort();
		
		System.out.println(uri);
		System.out.println(host);
		System.out.println(port);
		
		String temp = host + port;
		
		if (check(temp))
		{
			logger.warning(temp);
		}
		else
		{
			arg2.doFilter(arg0, arg1);
		}
	}

	private boolean check(String host)
	{
		if (listBlack.size() > 0)
		{
			String curr;
			for (int i = 0; i < listBlack.size(); i++)
			{
				curr = listBlack.get(i);
				
				if (curr == null)
				{
					continue;
				}
				
				if (host != null && host.equals(curr))
				{
					return true;
				}
			}
		}
		
		return false;
	}

	public void init(FilterConfig arg0) throws ServletException
	{
		listBlack.add("www.google.com:443");
	}

}

你可能感兴趣的:(java,java)