카테고리 없음

[자바] Jetty 서블릿 컨텍스트를 찾을 수 없습니다.

행복을전해요 2021. 1. 24. 00:12

나는 이것이 Jetty의 버그라고 생각합니다. 피드백을 환영합니다. webapp 처리기 전에 서블릿 처리기를 추가하면 문제가 해결됩니다.

HandlerCollection handlerCollection = new HandlerCollection();
// Add the API part
ServletContextHandler apiContext = new ServletContextHandler(ServletContextHandler.SESSIONS);
apiContext.setContextPath("/d");
apiContext.addServlet(new ServletHolder(new DownloaderServlet()), "/*");
handlerCollection.addHandler(apiContext);
// Add the GUI part
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setDescriptor(webappDirLocation + "/WEB-INF/web.xml");
webapp.setResourceBase(webappDirLocation);
handlerCollection.addHandler(webapp);
// Add both handlers to the server
server.setHandler(handlerCollection);

예제 는이 문제를 디버깅하는 데 도움이되었습니다.



출처
https://stackoverflow.com/questions/22019785