Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DispatcherStreamLocator erroneously computes servletContextPath #164

Open
andredasilvapinto opened this issue Nov 21, 2013 · 2 comments
Open
Assignees

Comments

@andredasilvapinto
Copy link

https://github.com/alexo/wro4j/blob/1.7.x/wro4j-core/src/main/java/ro/isdc/wro/model/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/model/resource/locator/support/DispatcherStreamLocator.java#L92 is the best way to identify errors with the dispatcher location. A valid resource can simply be empty.

@alexo
Copy link
Owner

alexo commented Nov 22, 2013

Thanks for reporting this.

Regarding empty resources, don't you agree that inncluding an empty resource is an exceptional use case?

@andredasilvapinto
Copy link
Author

It's not very common, I agree. But it may happen (it actually did in our project). I think conceptually "not found" and "empty" should be treated differently, but it is not that bad I guess.

@ghost ghost assigned alexo Nov 22, 2013
@alexo alexo modified the milestones: 1.7.5, 1.7.4 Mar 21, 2014
@alexo alexo modified the milestones: 1.7.6, 1.7.5 Apr 8, 2014
@alexo alexo modified the milestones: 1.7.7, 1.7.6 Jun 30, 2014
@alexo alexo removed this from the 1.7.7 milestone Sep 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants