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

Ask A Question

Stats

  • Questions 500k
  • Answers 500k
  • 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 No, there isn't: the browse button opens the standard open… May 16, 2026 at 2:06 pm
  • Editorial Team
    Editorial Team added an answer You could consider this: /// <summary> /// Wrapper for the… May 16, 2026 at 2:06 pm
  • Editorial Team
    Editorial Team added an answer The problem your solving with the math as you learn… May 16, 2026 at 2:06 pm

Trending Tags

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

Top Members

Related Questions

I always wondered why there's an equals keyword in linq joins rather than using
I always wondered: Are there any hard facts which would indicate that either shorter
i have always wondered how to handle Files in applications. Say we have an
In thinking about blocks, I've always wondered why the thingers.each { |thing| example is
I always wondered why the syntax for importing specific objects from a module is
I have a std::map like this: map<wstring,int> Scores; It stores names of players and
Okay, this may be a dumb question, but I've not been able to find
This may be a stupid question, as most of my programming consists of one-man
I always coded console applications and learned some basic UML/patterns skills, using C++. Now
I always want to get the exact path of an element in an array.

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.