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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:49:14+00:00 2026-05-30T22:49:14+00:00

I setup COMET functionality in my web-app (with the help of such Servlet 3.0

  • 0

I setup COMET functionality in my web-app (with the help of such Servlet 3.0 features as AsyncContext and startAsync) to allow for things such as real-time notifications. After adding a filter in front of the sole servlet, I realized that this functionality no longer works because responses are committed automatically after a forward.

Requests that setup COMET functionality require that the responses NOT be committed after the request is handled. This means that I can neither use a forward or redirect to pass processing to my servlet. Thus, i’m stuck using doFilter(), which to my knowledge, does not automatically commit responses after execution.

I was thinking I could wrap requests in a custom HTTPServletRequestWrapper which overrides all the methods dealing with URLs, like so:

public class ActionServletRequestWrapper extends HttpServletRequestWrapper
{
    public ActionServletRequestWrapper(HttpServletRequest request)
    {
        super(request);
    }

    @Override
    public String getRequestURI()
    {

        String originalRequestURI = super.getRequestURI();
        int lastSlashIndex = originalRequestURI.lastIndexOf("/");
        return originalRequestURI.substring(0, lastSlashIndex) + "/ActionServlet";
    }

    @Override
    public StringBuffer getRequestURL()
    {
        String originalRequestURL = super.getRequestURI();
        int lastSlashIndex = originalRequestURL.lastIndexOf("/");
        return new StringBuffer(originalRequestURL.substring(0, lastSlashIndex) + "/ActionServlet");
    }

    @Override
    public String getServletPath()
    {
        return "/ActionServlet";
    }
}

…but passing this in to doFilter() does not seem to pass execution on to ActionServlet (though through breakpoints I found that the overridden getServletPath() is called at some point). Are there any additional methods I need to overload, or are requests unable to be re-directed in this way?

  • 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-30T22:49:16+00:00Added an answer on May 30, 2026 at 10:49 pm

    Considering the fact that no one has answered the question yet, and all my attempts to filter a request in this way have failed, I’m going to go ahead and assume the answer to this question is:

    No, you cannot filter a request to a different destination by wrapping it and overloading all of the URL-related methods. The code which determines the destinations of requests apparently does not rely on those methods.

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

Sidebar

Related Questions

Setup I have a VBScript for driving the stress testing of a web service.
Setup : I have a Struts web application where I use displaytag elements to
Current Project Setup I've been working on a web-based chat, similar to Facebook chat.
I just setup a basic rails wiki app. Where user comes in and creates
Setup I have a graph library where I am trying to decompose things as
Given the below setup and code snippets, what reasons can you come up with
Setup Have you ever had the experience of going into a piece of code
Setup I have a website that draws RSS feeds and displays them on the
Setup is following: Drupal project, one svn repo with trunk/qa/production-ready branches, vhosts for every
Setup is SQL2005 SP2 with Reporting Services installed local on Win2003 64bit. When users

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.