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 9051155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:50:18+00:00 2026-06-16T12:50:18+00:00

I need the following serverside redirect or forward on a Tomcat server: the url

  • 0

I need the following serverside redirect or forward on a Tomcat server: the url http://portal.customer_name needs to be renamed/redirected to http://portal.customer_name/customer_name. So in short, an url without context path to be redirected to the same url with context path.
I managed to do this with a filter, using request.getRequestDispatcher().forward(request, response); but the same doesn’t seem te work with a valve.

I got the following so far:

public void invoke(Request request, Response response) throws IOException, ServletException {
    String context = getForwardpath(request);
    request.getRequestDispatcher(context).forward(request, response);
    this.getNext().invoke(request, response);
}

private String getForwardpath(Request rq){
    String context = rq.getServletContext().getContextPath();
    /.../
    return context;
}

I deployed some servlets which seem to receive the original url but not the redirect. Is it possible to make a serverside redirect like this at all. Please note that I need a valve, not a filter.

  • 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-06-16T12:50:20+00:00Added an answer on June 16, 2026 at 12:50 pm

    Did you happen to search for this before posting? Google comes up with a blog post that discusses this topic wrt Tomcat and includes an implementation of such a Valve, as well as a JBoss implementation of one. So I’d say, “Yes, it’s definitely possible.” If one of these doesn’t suit your needs, you could certainly at least use their source code to guide you in the right direction and then come back with a more specific question if you run into trouble.

    Update: There’s no such thing as a “server-side redirect” the way you’re using the term. Redirecting means sending a 3xx series response code back to the user agent to tell it something about the resource it requested. That being said, I haven’t done any Valve development myself, but from the description of Valve.invoke(), I’m guessing if you just put the Valve high enough up in the Tomcat configuration, you could just modify the request URI on the way in and let it be handled normally.

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

Sidebar

Related Questions

I need the following xml to be made in code: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:gravity=right
Please help me to improve the following script: http://jsfiddle.net/n9BkM/8/ I need the following fucntionality:
I have the following ASPX page: <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server> <title></title> <script src=js/jquery-1.2.6.min.js
Synopsis Given the following (abridged) code that lives server-side on a servlet (Tomcat is
I need following function (from C++ dll) available in C++/CLI extern C _declspec(dllexport) void
I need following namespaces to use native wpf property grid however, VS 2010 doesn't
I need the following C function in Python: int func(Uint8 *bytRecvBuffer, int *iRecvLen); I
I need the following authentication script finished. I am weak at php/pdo so I
I need the following logic. If array contains value , return it else return
I really need the following in magento. When a customer shows the config product

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.