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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:57:28+00:00 2026-05-13T16:57:28+00:00

I have a filter that takes an incoming request, and then wraps it with

  • 0

I have a filter that takes an incoming request, and then wraps it with an HttpServletRequestWrapper, which in turn has a setParameter() method on it. However, this will no longer work now in any filtered servlets:

<jsp:include page="testing-include.jsp">
    <jsp:param name="testing" value="testing" />
</jsp:include>

The include page will not take the request parameter. If I remove the filter, and the original unmodified request is sent (unwrapped) to the servlet, then it works again. Here is my wrapper:

public class HttpServletModifiedRequestWrapper extends HttpServletRequestWrapper {

    Map parameters;

    @SuppressWarnings("unchecked")
    public HttpServletModifiedRequestWrapper(HttpServletRequest httpServletRequest) {
        super(httpServletRequest);
        parameters = new HashMap(httpServletRequest.getParameterMap());
    }

    public String getParameter(String name) {
        String returnValue = null;
        String[] paramArray = getParameterValues(name);
        if (paramArray != null && paramArray.length > 0){
            returnValue = paramArray[0];
        }
        return returnValue;
    }

    @SuppressWarnings("unchecked")
    public Map getParameterMap() {
        return Collections.unmodifiableMap(parameters);
    }

    @SuppressWarnings("unchecked")
    public Enumeration getParameterNames() {
        return Collections.enumeration(parameters.keySet());
    }

    public String[] getParameterValues(String name) {
        String[] result = null;
        String[] temp = (String[]) parameters.get(name);
        if (temp != null){
            result = new String[temp.length];
            System.arraycopy(temp, 0, result, 0, temp.length);
        }
        return result;
    }

    public void setParameter(String name, String value){
        String[] oneParam = {value};
        setParameter(name, oneParam);
    }

    @SuppressWarnings("unchecked")
    public void setParameter(String name, String[] values){
        parameters.put(name, values);
    }
}

I’m really having trouble determining what could be happening without looking at Tomcat’s implementation source for the jsp:include and jsp:param standard actions, but there must be some conflict there. Any help would be 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. Editorial Team
    Editorial Team
    2026-05-13T16:57:28+00:00Added an answer on May 13, 2026 at 4:57 pm

    I guess the problem is that your wrapper doesn’t provide access to the new parameters, which were added to the original parameter map after you copied it.

    Probably, you should do something like this (and in the other methods, too):

    public String[] getParameterValues(String name) {  
        String[] result = null;  
        String[] temp = (String[]) parameters.get(name);  
        if (temp != null){  
            result = new String[temp.length];  
            System.arraycopy(temp, 0, result, 0, temp.length);  
        } else {
            return super.getParameterValues(name);
        } 
        return result;  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Filter Method in my User Class, that takes in a list
I have a Filter Servlet that filters request from a Servlet. I do not
I have a control that has a Filter property that expects a function that
I'm trying to write a custom filter method that takes an arbitrary number of
Say I have a method called GetCatsByColor which takes a color as a string,
I have a filter attribute that I'd like to be applied to every action
I have an ISAPI filter that I am using to do URL rewriting for
Say you have a few DropDownLists that filter data: Car Make: [Ford,Chevrolet,etc] Car Year:
I have an application that can filter a datagridview based on date using a
We have a form that allows a user to filter a list with by

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.