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

javax.servlet.include.context_path attribute on root context. should be empty string, but is "/" #5057

Closed
joakime opened this issue Jul 16, 2020 · 6 comments · Fixed by #5058
Labels
Bug For general bugs on Jetty side Specification For all industry Specifications (IETF / Servlet / etc)

Comments

@joakime
Copy link
Contributor

joakime commented Jul 16, 2020

By the way - I don't have test yet, but when checking Jetty / Tomcat / Undertow, I saw that Jetty sets wrong value to javax.servlet.include.context_path attribute when using root context. should be empty string, but is "/". I can think about PR later, but maybe already you have idea if it's wrong? (Undertow and Tomcat set it to "").

Originally posted by @grgrzybek in #5026 (comment)

@grgrzybek
Copy link
Contributor

Thanks!

@joakime joakime changed the title Jetty sets wrong value to javax.servlet.include.context_path attribute when using root context. should be empty string, but is "/" (Undertow and Tomcat set it to ""). javax.servlet.include.context_path attribute on root context. should be empty string, but is "/" Jul 16, 2020
gregw added a commit that referenced this issue Jul 16, 2020
Root context path in include should be empty string.
@gregw gregw linked a pull request Jul 16, 2020 that will close this issue
@joakime joakime added Bug For general bugs on Jetty side Specification For all industry Specifications (IETF / Servlet / etc) labels Jul 16, 2020
@joakime
Copy link
Contributor Author

joakime commented Jul 16, 2020

I'm frankly a bit surprised that the servlet tck doesn't have a testcase for this.

@janbartel
Copy link
Contributor

The tck seems to use the context root /servlet_spec_requestdispatcher_web for the tests: https://github.com/eclipse-ee4j/jakartaee-tck/blob/8.0.2/src/com/sun/ts/tests/servlet/spec/requestdispatcher/URLClient.java#L46

@grgrzybek
Copy link
Contributor

Ah - so the TCK test for root context is missing.
I'm glad we can finally (after moving to Eclipse) see the TCKs ;)

gregw added a commit that referenced this issue Jul 20, 2020
merged context path methods as result of review.
ServletContent.getContextPath now returns the encoded contextPath (if anybody is silly enough to have one).
gregw added a commit that referenced this issue Jul 20, 2020
* Fixes #5057 Included root context path

Root context path in include should be empty string.

* Issue #5057

merged context path methods as result of review.
ServletContent.getContextPath now returns the encoded contextPath (if anybody is silly enough to have one).
@joakime
Copy link
Contributor Author

joakime commented Jul 22, 2020

PR #5057 is merged

@joakime joakime closed this as completed Jul 22, 2020
@tarator
Copy link

tarator commented Feb 16, 2021

Should this already be fixrd in Jetty 10.0.0? I'm using the Jetty 10 Java package together with Spring. Calling request.getContextPath() still returns a "/" instead of an empty string as expected. is there a setting I could use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side Specification For all industry Specifications (IETF / Servlet / etc)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants