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 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

Related Questions

We would like to use some of our existing Java AWT graphics code on
i m trying to run the bluetooth chat sample from the developers site but
I have an existing java command-line program, that takes a bazillion of arguments and
I am trying to augment existing Java project with some Groovy goodness, starting with
Basically i want to access site http://www.domain.com what i want to do is that
Using md5() function in PHP directly gives me the String. What I want to
I'm looking for a way to automatically generate source code for new methods within
I am not a professional programmer (my area is medical research), but I am
<?xml version='1.0'?> <info> <contract> <symbol>IBM</symbol> <sectype>STK</sectype> <exchange>SMART</exchange> <currency>USD</currency> </contract> <order> <action>SELL</action> <quantity>100</quantity> <ordertype>LMT</ordertype> <imtprice>imtprice</imtprice>
I was task to allocate only 1GB of space to store my videos in

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.