Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > ApplicationDispatcher.requestURI starting with two slashes

Reply
Thread Tools

ApplicationDispatcher.requestURI starting with two slashes

 
 
Peter Horlock
Guest
Posts: n/a
 
      10-18-2010
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
"serverort/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
 
Reply With Quote
 
 
 
 
Peter Horlock
Guest
Posts: n/a
 
      11-16-2010
Problem solved. It was a problem with the Eclipse Tomcat Plugin!
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      11-16-2010
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
3 ESSENTIAL TOOLS FOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLSFOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLS FOR STARTING ANDMAINTAINING... Oanh Bui C++ 0 04-27-2009 12:51 PM
3 ESSENTIAL TOOLS FOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLSFOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLS FOR STARTING ANDMAINTAINING... Oanh Bui C Programming 0 04-27-2009 12:51 PM
3 ESSENTIAL TOOLS FOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLSFOR STARTING AND MAINTAINING...3 ESSENTIAL TOOLS FOR STARTING ANDMAINTAINING... Oanh Bui Python 0 04-27-2009 12:46 PM
RegEx: odd number of slashes? and too many slashes? Dan Wilkin Perl Misc 1 07-17-2006 03:47 AM
String replacement( 2 slashes-> 4 slashes ) qazmlp Java 5 04-07-2004 10:26 PM



Advertisments