• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Redirecting The Request

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written a servlet that forwards the request to some other page using sendRedirect() and Location header . The servlet is properly written as mentioned in the book. Now i just want to know that suppose :-
I want that any request to www.abc.com should get redirected to www.xyz.com, then how my servlet will get invoked. i.e. users will be using www.abc.com which will open www.abc.com/index.htm and not my servlet, how can i get my servlet invoked from www.abc.com.
Thanks
Veenu
 
Ranch Hand
Posts: 5390
1
Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can set default page of your abc.com to the servlet which will redirect it to xyz.com
you can set 404 error to the same servlet so any request for abc.com/dir01/page1.htm will also be directed to xyz.com.
But why do you want to take so much pain ? You[your service provider] can simply point both URL to single IP address.
 
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic