File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Issues in redirect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Issues in redirect" Watch "Issues in redirect" New topic
Author

Issues in redirect

abhilash nalla
Greenhorn

Joined: Nov 05, 2008
Posts: 5
Hi,

I'am having issues redirecting users in a Java application. This is the scenario:

1. Old URL was www.app1.com hosted on JBoss Server. Application is built using JSP.
2. Now, we moved the app to a different server and had to change URL to www.app2.com.
3. When users use the old URL to access the application, instead of log-in page, we show a page with a simple message asking them to click on new URL.(This link is a simple href tag). We also ask them to save this new URL in their favourites which is how they access the application.
4. Now, when they click on the URL posted on the old server page, it redirects to the log-in page on new Server. They save this link in their favourites. The application works fine for that session. But when they access the application next time using the favourites, it opens login page on new Server, but doesnot let them access when they enter user-id and pwd.

This is the reason, when they clicked on the URL link on the old server for the first time, application opened up but the URL was something like this:

www.app2.com/?jsession........(some query string) and they saved this link. So, instead of saving www.app2.com, it also saved the query string.(some session id from old server).

Can anyoone suggest how to get rid of this issue.

P.S: First I used simple href html tag, then I used JSP redirect tag(in this case, it directly redirects without showing them the page on Old Server). But in both the cases, when new server page opens, it has this query string at the end. How can I get rid of this query string.

I know that I can get rid of it on the new server when they submit the page but I donot want to touch the code on new server.

Thanks,
Abhi
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
abhilash nalla wrote:
4. Now, when they click on the URL posted on the old server page, it redirects to the log-in page on new Server. They save this link in their favourites. The application works fine for that session. But when they access the application next time using the favourites, it opens login page on new Server, but doesnot let them access when they enter user-id and pwd.

Is there any particular reason that you have to use JSP to redirect user from this URL? Should step 3 point directly to the URL of new app?

“Everything should be as simple as it is, but not simpler.” Albert Einstein
abhilash nalla
Greenhorn

Joined: Nov 05, 2008
Posts: 5
Previously, when they used to hit old URL, it shows login.jsp file. So, I modified this login.jsp file to show them the message and the new URL link. As I mentioned, I tried using i) simple href HTML tag ii) JSP redirect tag. But both are causing issues. When they click this hyperlink, they will be redirected to the new login.jsp file hosted on different server.

Step 3 pointing to new URL was user requirement. We could have just showed the message and asked them to copy and paste URL in browser. But we wanted to give some flexibility to user where they could get to the new server just by clicking on hyperlink. Since hyperlink was causing the issue that I mentioned, we tried using JSP redirect where it would directly take them to new server but even this caused issues.

Thanks for response,
Abhi
Pawan Kr Gupta
Greenhorn

Joined: Nov 21, 2010
Posts: 26
Dear abhi,

As you said while saving the URL in the favourite the following string gets saved

www.app2.com/?jsession.

so please ask user to remove ?jsessionid from the URL while saving this URL in my favourite because this maintains the session at server level.
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
If you use an JSP page to generate the link then use the page directive to set the session to false. It should work.

i.e.


Note: I didn't add the rel="nofollow" in the a tag ???

Or just use a HTLP page instead. Say: old login.jsp redirects to "application_moved.html" where you'll have a link to the new application.
abhilash nalla
Greenhorn

Joined: Nov 05, 2008
Posts: 5
It sounds weird but this is how it got fixed.

Earlier in href tag I used <a href="http://XYZ.org/app1">Click here for new version of</a> : This gave me issues that I mentioned

Now I used <a href="http://XYZ.org/app1/login.htm">Click here for new version of</a> : This fixed the problem. No more query string at the end when it got redirected

Thanks everyone for the help

Abhi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issues in redirect