-
Notifications
You must be signed in to change notification settings - Fork 90
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
Fix wording in context root mapping in section 12.2 #300
Comments
Context: https://bz.apache.org/bugzilla/show_bug.cgi?id=64109 I agree. Context Path should always be the context path of given application / war / |
For documentation purpose, here's my summary for test of this special For three container implementations, I've created two contexts - one for Jetty ServletContextHandler rootHandler = new ServletContextHandler(chc, "", ServletContextHandler.NO_SESSIONS);
rootHandler.setAllowNullPathInfo(true);
ServletContextHandler otherHandler = new ServletContextHandler(chc, "/c1", ServletContextHandler.NO_SESSIONS);
// with "false", "/c1" request will be redirected (HTTP 302) to "/c1/"
otherHandler.setAllowNullPathInfo(true); Tomcat Context rootContext = new StandardContext();
rootContext.setPath("");
rootContext.setMapperContextRootRedirectEnabled(false);
Context otherContext = new StandardContext();
otherContext.setPath("/c1");
// with "true", "/c1" request will be redirected (HTTP 302) to "/c1/"
otherContext.setMapperContextRootRedirectEnabled(false); Undertow DeploymentInfo rootContext = Servlets.deployment().setContextPath("/");
DeploymentInfo otherContext = Servlets.deployment().setContextPath("/c1"); for all the above context I've added a servlet mapped to 4 URI patterns:
I didn't use The single servlet just prints 3 things:
And I send these requests destined for root context:
and these destined for
Here are summaries (CP=context path, SP=servlet path, PI=path info):
Summarizing special
I hope this summary will be a good inspiration for improving the specification ;). |
@grgrzybek Great Work!!!
I think we also want to improve the spec to match jetty for |
And the TCK!!! |
I'd like to see a column for the "reference implementation" as well, before deciding Hopefully, GlassFIsh and Tomcat behave the same due to their common ancestry. |
I'm not involved in a JCP process, so I should not suggest anything ;). Also, knowing that:
treat "access root of the context" as something special (security concerns?), maybe the spec should be more clear about it? What does it mean (12.2 Specification of Mappings) "[...] a special URL pattern that exactly maps to the application's context root"? IMO the "context root" is more virtual concept, mapping is always from URI to servlets (or filters), even a "resource" ("default") servlet. Even "12.1 Use of URL Paths" ends the checklist with default servlet. No way to know what "access context root" means. What would be the problem specifying that access to "/c1" should always be redirected to "/c1/" and then normal servlet lookup will take place? |
I tried checking Glassfish, but entire eclipse-ee4j/glassfish history related to Tomcat is one entry - can't tell which version of Tomcat it is. |
I think something should be said about handling of such requests. However, while I think that redirection is probably the best behaviour, the fact that both jetty and tomcat have felt the need to make it configurable indicates that there are probably some users out there that see differently. However I'm not sure they are in numbers large enough to warrant official support in the spec to configure non redirect behaviour. So I'd be fine with either a statement that But note that this is really just a special case of the redirection from |
Yes, the history there is ugly. My hope was that someone could actually test it |
Hi,
On Wed, Feb 5, 2020 at 8:30 AM Grzegorz Grzybek ***@***.***> wrote:
I tried checking Glassfish, but entire eclipse-ee4j/glassfish history
<https://github.com/eclipse-ee4j/glassfish/commits/master/appserver/web/web-core/src/main/java/org/apache>
related to Tomcat is one entry - can't tell which version of Tomcat it is.
History of javaee/glassfish
<https://github.com/javaee/glassfish/commits/master/appserver/web/web-core/src/main/java/org/apache>
also looks more like cherry picking from official apache/tomcat repo than
something more like alignment with upstream Tomcat version.
It's technically not "Tomcat", but Catalina and Jasper mostly. Coyote from
Tomcat has been replaced by Grizzly.
That said, indeed, it's a proper mess. At some point the classes making up
Catalina were obviously copied into GlassFish, and then later on only very
sporadically fixes were imported. If you look at say FormAuthenticator.java
and compare the Tomcat and GlassFish versions, you see they mostly match,
but there are small changes everywhere. Some things like the Servlet
Container Profile of JSR 196 has been implemented independently by both,
etc.
Kind regards,
Arjan Tijms
|
RIght. Then I don't think I should add 4th column to the above. the mapper (virtual host mapping, context mapping, servlet mapping) is done at Catalina level (and not Coyote/Grizzly) afaik. So it SHOULD behave as Tomcat. But you never know ;) And it'd really be good to know what Catalina version is used in GlassFish... |
maybe would be good to add such test in the TCK? I cannot find any atm (or I missed it?) |
… path The context path does not change to "" just because the current request matches a context root mapping.
… path The context path does not change to "" just because the current request matches a context root mapping.
The context path does not change to "" just because the current request matches a context root mapping.
Fixed via #497 |
The current wording is:
The requirement that this makes the context path the empty string makes no sense. I propose we strike that text to give:
The text was updated successfully, but these errors were encountered: