wood burning stoves 2.0*
The moose likes Servlets and the fly likes How to restrict access to request from specific IP’s in Java web application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to restrict access to request from specific IP’s in Java web application? " Watch "How to restrict access to request from specific IP’s in Java web application? " New topic
Author

How to restrict access to request from specific IP’s in Java web application?

cherry hal
Greenhorn

Joined: May 06, 2012
Posts: 10
How to restrict access to request from specific IP’s in Java web application?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Note that the javax.servlet.ServletRequest interface has a getRemoteAddr method.

Bill

cherry hal
Greenhorn

Joined: May 06, 2012
Posts: 10
Hi William Brogden,
Thank you and can you explain with programmatically i mean sample code?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

You have enough info to write some code for yourself. Please do so and then post back with any troubles you may be having.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

One suggestion - use a filter to check the IP address. That way you don't have to build in the same checks in all of your servlets.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
cherry hal wrote:Hi William Brogden,
Thank you and can you explain with programmatically i mean sample code?


If you are aspiring to be a servlet/jsp developer, you will learn more by coding than by asking for worked out code.
 
 
subject: How to restrict access to request from specific IP’s in Java web application?
 
Similar Threads
Security features in Jboss
Handling Session count and Application overloaded
How to allow only some computers to access the web application in internet?
Control access to a web application using IP address
Restricting web server directory access (.htaccess file) Help Needed.