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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:54:37+00:00 2026-05-11T19:54:37+00:00

I always wondered why there exists no removeParameters() method in Servlet API. What could

  • 0

I always wondered why there exists no removeParameters() method in Servlet API.
What could be the motive behind this design?
Here is a scenario: I am posed with a challenge in a proprietary MVC framework that I am compelled to use. This framework uses a Controller Servlet that hosts an algorithm in it’s post method:

doPost() {
//create instance of action - just like struts action
action.init
action.preexecution
if(redirection state is not set)
action.process
action.postprocess
action.finish
}

The only way I can skip process of any particular action would be by setting a redirection url. The Controller Servlet is FINAL. Now, when I do a requestdispatcher.forward from say the preexecution method of an action, the controller will go ahead and execute the rest of the methods and not skip the rest. I cannot change this behavior, neither can I set the redirect, coz I need to do a forward. It works fine as long as I am not forwarding request to the same action. When a request is forwarded to the same action, the http parameters are all the same. This would take it into a never ending loop. Hence, I am compelled to add extra parameters indicating that it is a repeat request and should be treated differently.
Not sure if my problem made sense, but thought this is a good forum to post the same.

  • 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-11T19:54:38+00:00Added an answer on May 11, 2026 at 7:54 pm

    EDIT: McDowell reminded me of HttpServletRequestWrapper, so I’m changing the below to make it a little less work… Thanks McD!

    You can decorate the request to “hide” parameters you don’t want and/or add extra parameters.

    Something like (off the top of me head — no compiling so the API might be a tweak off…)

    public class MyParameterHider extends HttpServletRequestWrapper {
        public MyParameterHider(HttpServletRequest request) {
            super(request);
        }
        public String getParameter(String name) {
           if ("parameterToHide".equals(name))
               return null;
           return realRequest.getParameter(name);
        }
        // similar for getParameterNames and getParameterMap - don't include the hidden parm
        // all other methods are strictly pass-through and are automatically
        //   handled by HttpServletRequestWrapper
    }
    

    In your forward, just wrap the request in a ParameterHider when calling doFilter:

    dispatcher.forward(new MyParameterHider(request), response);
    

    Patterns FTW!

    Hope this helps!

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

Sidebar

Related Questions

I've always wondered this - why can't you declare variables after a case label
I've always wondered about this ... and thankfully, now have a good environment of
Ive always wondered this but never had the chance to research it. What sort
Ive always wondered about this. I like to create super navigation menus. The website
I always wondered why people are still running older web browsers until I started
I have always wondered how people update a previous line in a command line.
One thing I've always wondered about is how software patches work. A lot of
I have always wondered WHaT tHE HecK?!? is the difference between JScript and JavaScript.
I've always wondered why the C++ Standard library has instantiated basic_[io]stream and all its
One concept I've always wondered about is the use of cryptographic hash functions and

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.