Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 602227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:47:59+00:00 2026-05-13T16:47:59+00:00

Hi I am upgrading a site, moving from Notes to Java JSP’s and need

  • 0

Hi I am upgrading a site, moving from Notes to Java JSP’s and need to support a redirect from the old url’s to the new ones. So /site/oldpage.nsf?home needs to redirect to /site/newpage.jsp.

In Tomcat I’ve set up an error-page to redirect:

404
/avi_redirect.jsp

in the avi_redirect.jsp I have :

pageContext.forward(  "/newpage.jsp" );

But as I need to do this for many pages I need to know the old page name ie /site/oldpage.nsf?home.
Any idea how I can get this? The response & headers don’t have it. The query string has the params but not the url.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:47:59+00:00Added an answer on May 13, 2026 at 4:47 pm

    Rather use a Filter for this, not a JSP (otherwise you may risk IllegalStateExceptions). Also rather use a redirect instead of a forward (otherwise the old URL will stay in the address bar). Also rather use a 301 redirect instead of a (default) 302 (otherwise the old URL will still be indexed by searchbots).

    So, you need to create a Filter which listens on an url-pattern of the old extension *.nsf and implement it basically like follows:

    private static final Map<String, String> urlMapping = new HashMap<String, String>();
    
    static {
        urlMapping.put("/site/oldpage.nsf?home", "/site/newpage.jsp");
        // Put more here.
    }
    
    public doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException) {
        HttpServletRequest httpReq = (HttpServletRequest) request;
        String oldUrl = httpReq.getRequestURL().append("?").append(httpReq.getQueryString()).toString();
        String newUrl = urlMapping.get(oldUrl);
        response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
        response.setHeader("Location", newUrl);
    }
    

    You see that I already have reconstructed the URL to include the querystring (the part after ?).

    Ideally would be if the new JSP files are structured and named exactly the same way as originally, but only with a different extension. This way you don’t need a mapping, but just a string replace on the URL would have been sufficient:

    String newUrl = oldUrl.replace(".nsf", ".jsp");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am upgrading my site from some old spaghetti coding to some nice, clean
Here is my scenario: I am currently upgrading a web site I maintain from
Plenty of pages load since upgrading my site from MVC 1.0 but if I
We're upgrading a large site, opendemocracy.net, from Drupal 4.7 to Drupal 6. Our existing
I am currently investigating the viability of upgrading my site from PHP 5.1.6 to
I was given the task of upgrading a plone site from 3.1.7 to 4.0.3.
I'm upgrading from 3.1 to 3.2. Other than looking at 3.1's site-packages directory to
We'll be upgrading a client's MOSS public internet site soon from a Cumulative Update
When i upgrading magento site from older version to latest version i got some
I am in the process of upgrading a PHP-based site from Smarty2 to Smarty3.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.