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

  • Home
  • SEARCH
  • 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 63649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:39:57+00:00 2026-05-10T18:39:57+00:00

An existing Java site is designed to run under / on tomcat and there

  • 0

An existing Java site is designed to run under ‘/’ on tomcat and there are many specific references to fixed absolute paths like ‘/dir/dir/page’.

Want to migrate this to Java EE packaging, where the site will need to run under a context-root e.g. ‘/dir/dir/page’ becomes ‘/my-context-root/dir/dir/page’

Now, the context-root can be easily with ServletRequest.getContextPath(), but that still means a lot of code changes to migrate a large code base. Most of these references are in literal HTML.

I’ve experimented with using servlet filters to do rewrites on the oubound HTML, and that seems to work fine. But it does introduce some overhead, and I wouldn’t see it as a permanent solution. (see EnforceContextRootFilter-1.0-src.zip for the servlet filter approach).

Are there any better approaches to solving this problem? Anything obvious I’m missing? All comments appreciated!

  • 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. 2026-05-10T18:39:57+00:00Added an answer on May 10, 2026 at 6:39 pm

    Check out a related question

    Also consider URLRewriteFilter

    Another thing (I keep editing this darn post). If you’re using JSP (versus static HTML or something else) you could also create a Tag File to replace the common html tags with links (notably a, img, form). So <a href=’/root/path’>link</a> can become <t:a href=’/root/path’>link</t:a>. Then the tag can do the translation for you.

    This change can be easily done ‘en masse’, using something like sed.

    sed -e 's/<a/<t:a/g' -e 's/<\/a>/<\/t:a>/g' old/x.jsp > new/x.jsp 

    Form actions may be a bit trickier than sed, but you get the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 87k
  • Answers 87k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Returning a Fault is the correct way to do it… May 11, 2026 at 5:31 pm
  • Editorial Team
    Editorial Team added an answer Found the below diagnosis here. Originally answered by Steven Cheng.… May 11, 2026 at 5:31 pm
  • Editorial Team
    Editorial Team added an answer The distinction between 'lexical scope' (where a name has meaning… May 11, 2026 at 5:31 pm

Related Questions

I have inherited a broad, ill-designed web portfolio at my job. Most pages are
I need to create a photo gallery for a website running IIS 4.0 or
We are beginning to go down the path of mobile browser support for an
I am working on an implementation for RSS feeds for a collaboration platform. Say

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.