google-code-export / wro4j

Automatically exported from code.google.com/p/wro4j
1 stars 1 forks source link

DispatcherStreamLocator erroneously computes servletContextPath #816

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This issue was opened on github: https://github.com/alexo/wro4j/issues/164

https://github.com/alexo/wro4j/blob/1.7.x/wro4j-core/src/main/java/ro/isdc/wro/m
odel/resource/locator/support/DispatcherStreamLocator.java#L106

is not a valid way to compute the servletContextPath.

Consider:
Request url: http://foo.bar:80/resources/some.css
Servlet path: ""
Location: /some_other.css

The resulting request will be made to 
http://foo.bar:80/resources/some.css/some_other.css which is obviously wrong.

Alternatively the servletContextPath can be computed by using something like:

request.getScheme() + "://" + request.getServerName() + ":" + 
request.getServerPort() + request.getContextPath();
I'm also not sure 
https://github.com/alexo/wro4j/blob/1.7.x/wro4j-core/src/main/java/ro/isdc/wro/m
odel/resource/locator/support/DispatcherStreamLocator.java#L92 is the best way 
to identify errors with the dispatcher location. A valid resource can simply be 
empty.

Original issue reported on code.google.com by alex.obj...@gmail.com on 22 Nov 2013 at 5:13