tags:

views:

46

answers:

1

Hi, I have a web application running in jetty. I have to provide a configuration, like when the flag is set true access should be granted to users access the web application through ip instead of localhost. If the flag is not set to true, then the request other than localhost should be denied. How to do this?

Thanks.

+1  A: 

If you want to do this from your application (not changing jetty configuration), you can write a filter servlet for your application, and using ServletRequest#getRemoteAddr() to know where come from the request.

Kartoch
Tomcat? He is using Jetty.
Thorbjørn Ravn Andersen
Arf, my mistake. I've changed my post to show only the second solution.
Kartoch
I dont want to write filter. can it be done by modifying some jetty configuration?
Actually I hv 3 apps running in jetty and i want one of them to be accessed only through localhost.