Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

Serving a website based on source internet address

Thread view: 
Skybuck - 29 Aug 2006 18:01 GMT
Hello,

Based on the source internet address a different version of the website

should be presented/served to the user/browser.

For example in pseudo code:

if SourceAddress = '143.3.5.1' then
begin
 ShowBlueWebsite; // Load/Show BlueIndex.htm
end else
if SourceAddress = '124.5.15.7' then
begin
 ShowRedWebsite; // LoadShow RedIndex.htm
end;

Is this possible with java ? is there any source code available to do
this trick ?

Bye,
 Skybuck.
Babu Kalakrishnan - 29 Aug 2006 18:13 GMT
> Hello,
>
[quoted text clipped - 15 lines]
> Is this possible with java ? is there any source code available to do
> this trick ?

Try the request.getRemoteHost() and/or the request.getRemoteAddr()
methods and send an appropriate redirect to the client based on the
values returned.

Make sure you test the application with whatever target servlet
engine(s) that ou plan to deploy your application on, as well as
different browsers / with and without proxies. In my experience, the
outputs returned by some of the methods of HttpServletRequest give you
surprises with certain combinations of UserAgent/Proxy/Servlet engine.

BK
Tom Cole - 29 Aug 2006 19:34 GMT
1. This was cross-posted in comp.lang.javascript where an answer was
posted.

2. When you say "done in java" I assume that you have a website that is
written in JSP/J2EE? From your other post it did not seem so...If so
then you don't even need to do this, you can setup hosts in your
servlet container which will handle this for you.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.