ApplicationDispatcher.requestURI starting with two slashes

Discussion in 'Java' started by Peter Horlock, Oct 18, 2010.

  1. Hi,

    we have written a litter filter that rewrites incoming request, as
    well as by using a response Wrapper object that will rewrite the
    encodeUrl Methods so that outgoing urls will also be rewritten.

    So the code looks something like this:
    String rewriteURL = createRewriteURL(request);
    RequestDispatcher forwardDispatcher =
    request.getRequestDispatcher(rewriteURL);
    forwardDispatcher.forward(request, toRewriteResponse(request, new
    ResponseWrapperClass(request, response)));

    This code works perfectly under some context path, lets say
    "server:port/example/...
    However, when run on the context root "/", it fails.

    I also found a / or "the" bug, in the forwardDispatcher object, when
    debugging, the private requestURI attribute
    starts with two "/" slashes instead of just one. Example:
    "//MyPage.html"

    ---------
    request.getRequestDispatcher(rewriteURL) is handled internally by
    Tomcat code, but by manually adding some of it's source code, I was
    able to debug into the following lines of code that get called when
    request.getRequestDispatcher(rewriteURL) is called:

    public class ApplicationContext
    implements ServletContext {
    [...]
    private ThreadLocal localUriMB = new ThreadLocal();
    [...]

    public RequestDispatcher getRequestDispatcher(String path) {
    [...]
    MessageBytes uriMB = (MessageBytes) localUriMB.get();
    [...]
    CharChunk uriCC = uriMB.getCharChunk();

    [...]
    return new ApplicationDispatcher(wrapper, uriCC.toString(),
    wrapperPath, pathInfo, queryString, null);
    }

    When the Dispatcher is created, the uricCC.toString() contains the two
    slashes ("//").
    ------------
    However, where do they come from? What's going on here / what's going
    wrong here? I am really confused, sorry!

    Thanks in advance,

    Peter
     
    Peter Horlock, Oct 18, 2010
    #1
    1. Advertising

  2. Problem solved. It was a problem with the Eclipse Tomcat Plugin! :-(
     
    Peter Horlock, Nov 16, 2010
    #2
    1. Advertising

  3. Peter Horlock

    Lew Guest

    On 11/16/2010 09:11 AM, Peter Horlock wrote:
    > Problem solved. It was a problem with the Eclipse Tomcat Plugin! :-(


    Thank you, I'm sure that information will be very helpful to the next person
    who faces this issue.

    Kidding aside, would you mind terribly sharing just a little bit of detail so
    the rest of us may benefit?

    --
    Lew
     
    Lew, Nov 16, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nils N

    Using slashes as querystring

    Nils N, Feb 5, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,914
    Nils N
    Feb 8, 2004
  2. qazmlp
    Replies:
    5
    Views:
    695
    Michael Dunn
    Apr 7, 2004
  3. Dan Wilkin
    Replies:
    1
    Views:
    265
    robic0
    Jul 17, 2006
  4. Eric smith

    backreferences to two sets of slashes

    Eric smith, Nov 6, 2011, in forum: Perl Misc
    Replies:
    1
    Views:
    213
    Helmut Richter
    Nov 6, 2011
  5. Eric Smith

    Backreferencing through two sets of slashes

    Eric Smith, Nov 6, 2011, in forum: Perl Misc
    Replies:
    1
    Views:
    213
    C.DeRykus
    Nov 8, 2011
Loading...

Share This Page