File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes redirection is going to infinite loop if url is not having the www domain Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "redirection is going to infinite loop if url is not having the www domain" Watch "redirection is going to infinite loop if url is not having the www domain" New topic
Author

redirection is going to infinite loop if url is not having the www domain

vasu mannem
Ranch Hand

Joined: Dec 11, 2003
Posts: 38
Hi All,
Facing strange problem in our production environment that is redirecting the url is not working if the domain is not having www in the url.

here is the example:

we have one index.html file having the switch function for redirecting the curHost to specific action class and what action class will do is getting the domain(current host) and ip address of user and then read the properties file for getting the target url based curhost.ipaddress.

here the problem is ,if we enter http://chevroletarabia.com it is not working and if we enter like http://www.chevroletarabia.com then it is working fine.

what could be the problem can any one help me on this.

sample of index.html,propertiesfile:

IP REDIRECTION Action:
code snippet of perform method:

properties file:

can you please any ne help on this

Thanks & Regards
Vasu

[Edit by Dave to add code tags]
[ December 23, 2005: Message edited by: David O'Meara ]

VasuM.
SCJP, SCBCD,ITIL
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

have you tried opening the URL without the www in a browser? If the redirection is happening on the server (eg being sent a 301 or 302 response code) you will need to take that into account in your code.
vasu mannem
Ranch Hand

Joined: Dec 11, 2003
Posts: 38
Hi
it is working for http://www.chevroletarabia.com and for http://chevroletarabia.com it is not working and going to infinite loop.
 
Don't get me started about those stupid light bulbs.
 
subject: redirection is going to infinite loop if url is not having the www domain