Search code examples
.htaccessjspjettypassword-protectionjetty-8

Password protecting url / folder with Jetty


I'd like to password protect a limited portion of a JSP based website running on Jetty 8.1.

So for the url www.mywebsite.com/protected I want the browser to pop up a user/password entry window, whereas www.mywebsite.com is accessible to everyone.

I know that with Apache this is done with the .htaccess file. Since Jetty runs without Apache I'd like to know what's the best way to implement this?


Solution

  • The jsp is just a servlet so you want to configure a security realm protecting that url space in your web.xml file.

    Jetty 7, 8

    Jetty 9