File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes internal  or external request. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "internal  or external request." Watch "internal  or external request." New topic

internal or external request.

hasan khan
Ranch Hand

Joined: Aug 04, 2003
Posts: 222

my website can be access at by external users and
we the internal user can also access the web site by using some internal ip :

how do i distinguish wheater the request has come from internal or external.
[ June 14, 2006: Message edited by: hasaN khaN ]

Darren Edwards
Ranch Hand

Joined: Aug 17, 2005
Posts: 69
Use the Host header from HTTP (assuming you are using HTTP1.1, but most people are!)

hasan khan
Ranch Hand

Joined: Aug 04, 2003
Posts: 222

i know about host header, but i want to distinguish between domain name or IP is coming in the host header.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Read the header.
If it contains your domain name, you know the requests was from your domain name.
If it contains the IP number, then you know it came from the IP number.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: internal or external request.
It's not a secret anymore!