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

Bug on org.atmosphere.util.IOUtils class at String guestServletPath(AtmosphereFramework, String) #1512

Closed
rdigiorgio opened this issue Mar 16, 2014 · 2 comments
Labels

Comments

@rdigiorgio
Copy link

Hello,

On a Tomcat8 environment, ie. using JSR356Endpoint class, "servletPath" is broken on initialization.

The "servletPath" property is initialized using IOUtils.guestServletPath(...) method, which contains a bug.

Problematic code :

servletPath = "/" + e.getValue().getMappings().iterator().next().replace("/", "").replace("*", "");

Obtained and expected results:
"/foo" -> "/foo" : OK
"foo" -> "/foo" : OK
"/foo/" -> "/foo" : OK
"/foo/bar" -> "/foobar" : NOT OK - Expected "/foo/bar"
"/foo/bar/
" -> "/foobar" : NOT OK - Expected "/foo/bar"

This bug causes the following exception:

WARN : org.atmosphere.websocket.DefaultWebSocketProcessor - Failed invoking AtmosphereFramework.doCometSupport()
org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps request for /refertest-web/secure/realtime/connections
at org.atmosphere.cpr.AsynchronousProcessor.map(AsynchronousProcessor.java:329)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:133)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:95)
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:66)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1782)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:421)
at org.atmosphere.websocket.DefaultWebSocketProcessor.open(DefaultWebSocketProcessor.java:175)
at org.atmosphere.container.JSR356Endpoint.onOpen(JSR356Endpoint.java:171)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:129)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:678)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1575)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1533)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

It could be fixed by using a RegExp matching the servlet URL.
I will make a pull request if this issue is validated.

@jfarcand
Copy link
Member

@rdigiorgio Pull request welcomed!

@rdigiorgio
Copy link
Author

Pull request created:
Method correction: String guestServletPath(AtmosphereFramework, String) #1514

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants