Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想以独立于容器的方式使用 HTTP Basic 身份验证来保护我的 servlet。我不知道它是 Tomcat 还是 Glassfish 还是 Jetty。必须在任何容器中工作。到目前为止我发现的所有链接都在谈论一些特定的容器。
您可以在实际的 servlet 中使用过滤器,或者更好的是,使用 spring security 之类的东西,请在此处阅读:http ://www.mkyong.com/tutorials/spring-security-tutorials/ 。希望这可以帮助。