Solved

Create A Centralized Redirect Using JSP

Posted on 2004-04-07
9
249 Views
Last Modified: 2010-04-01
Problem:
We have recently redesigned/reorganized our website (approximately 60,000 pages, http://www.wicourts.gov).  We have a large user base (basically the entire state of Wisconsin), who have bookmarked various pages on the old website.  As a courtesy to our customers, we want to have a centralized redirection system, that way we don't have to create a zillion different redirection pages.  In addition, we want the user to know that the page no longer exists and that they are being redirected to a new page (thus giving them the opportunity to update their bookmarks).

Possible Solution:
One solution that I have come up with is having one JSP page that accepts 2 parameters (the original page and the new page).  Since we are using Apache, we can setup redirects for a particular page that redirects the user to the JSP page (obviously passing the appropriate parameters), waits 5-10 seconds, and then sends them to the appropriate page.  The parameters will be used to display information back to the user and assist in redirecting to the new page (I hope that makes sense).

The Challenge:
Although the solution above might work, I wanted to pose the question to this community to get some various feedback.  I could very well just do a simple redirect using Apache and be done with it, but that does not prompt the user to update their bookmarks.  I could have also created the zillion pages and do the redirect that way as well... but that would be very labor intensive.  Has anyone else had to do something similar?  If so, how did you accomplish the task?

The best response get the max points...
0
Comment
Question by:kirbinator
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10780213
the approach you are proposing sounds reasonable. How are u storing the redirect mappings?
0
 

Author Comment

by:kirbinator
ID: 10780482
I was just going to add the redirects in the query string within the httpd.conf file.  Something like this

Redirect "/somedir/index.html" "/redirect.jsp?referring=/somedir/index.html&new=/newdir/index.html"

Do you know (or think) of a better way?

0
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 10780516
if you stored them in a db for example then all the redirecting jsp would need would be the old url.
u could then perhaps just redirect all missing pages which could lookup whether a redirect existed, and perform it if so.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Assisted Solution

by:searlas
searlas earned 125 total points
ID: 10781466
If this is a reorganization (as you say), you should seriously consider RedirectPermanent and or 'RedirectMatch permanent', this allows some browsers to automatically update their Favorites/bookmarks without user intervention.
0
 
LVL 5

Assisted Solution

by:KarcOrigin
KarcOrigin earned 125 total points
ID: 10781539
Hi,

This is just an idea. Can you afford using XML mappings? Actually you need a controller JSP/Servlet which just read the XML file fetch the action (which is your old URLs in your case) mapped with the redirection page URL. By combining this approch you would never need to complie or change anything on JSP in future also. Just change the XML file which stores the mapping of actions and their corresponding redirection URL.

You can even avoid to restart your server once you change anything in the XML file. I hope this may give you some idea and the beauty of using XML as a redirection center of gravity. It is also better if you map your future "new URLs" with the "new actions" (It is just a suggestion)

Thx
0
 
LVL 19

Assisted Solution

by:Kuldeepchaturvedi
Kuldeepchaturvedi earned 125 total points
ID: 10782927
Have you thought of using a filter servlet???
you will have to update your web.xml to have a filter setting on the web application.....

so automatically every request to your web site will go to this filter..

now this filter can choose any method to find the new page (either database,XML, or anything else that you might come up with to store the redirection mappings)..

All this filter will do is to read this mapping and redirect appropriately....

I know I am giving quite sketchy details here, but we can start and build as we go..

Regards
0
 
LVL 1

Expert Comment

by:KartikShah
ID: 10919316
One option, if you are using is, that you can keep a redirect map either in memory or the DB.

Remove all the old files from the system, and in the web.xml, for a 404 error forward the request to the redirect JSP that will check whether .. the requested url is an old url or not.

If it is an old URL, you can redirect it to the correspoding new page using the redirect map, or else you can display the 404 error. :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
handling Struts tag, JSTL tag and scriptlet in Ajax. 7 171
password protect pdf 11 74
best way to search/remove a file from an EAR file 3 102
servlet example 17 5
Scenario: Your operations manager has discovered an anomaly in your security system. The business will start to suffer within 15 minutes if it is a major IT incident. What should she do? We have 6 recommendations for managing major incidents (https:…
Note: This is the second blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   Every month t…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now