Hi,

  I've been fighting with how to get a Filter to modify a given 
request...
  
  I have a request for
    
    http://whatever.com/path/to/something/~~/base64encodedQueryString
  
that I'm tring to modify in a Filter so that the subsequent servlet
thinks it is handling 

    http://whatever.com/path/to/something/?a=b&c=d&e=f&g=h

as if that was _exactly_ what the user agent requested.  Using 
RequestDispatcher.forward(...) I can get everything to work fine
except that in the servlet's request.getRequestURL() continues to
return the original request url.  I've tried wrapping wrappers
wrapped by wrappers to get my own getRequestURL() called but have
not figured the way out of the maze.  Unfortunately, I cannot
use response.sendRedirect() because of limitations of the user-agent
for which this hack is necessary :-\

Another interesting part of the problem is that I do not have
access to the source of the servlet that handles the 
"/path/to/something/" uri.


What I am doing right now is (basically) this:

  public void doFilter(...){
    MutableServletRequestWrapper mreq = new MutableServletRequestWrapper(request);
      // MutableServletRequestWrapper basically provides its own 
      // methods for getRequestURI(), getRequestURL(), getParam*(), &c.

    RequestDispatcher rd = mreq.getRequestDispatcher(
      mreq.getRequestURI() + "?" + mreq.getQueryString()
    );
    rd.forward(mreq, resp);
    return;
  }

I also tried, with less success, to use chain.doFilter(mreq,resp);
instead of the forward(...).

Any suggestions as to how to do this in the servlet container (as
opposed to doing some mod_rewrite trick to rewrite the "~~/" to
"?eqs=" ;-))  Are Filters not meant for this kind of thing?


thanks much.
  Brent

-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to