-
Bug
-
Resolution: Fixed
-
Major
-
8.0.3
-
None
-
Security Level: Jimmy
-
None
-
ZK 8.0.3 S4, ZK 8.0.3 S5, ZK 8.0.3 S6
-
None
Using @MatchMedia in a webapp running on jetty, on the 2nd and following access to the page, the following error is thrown:
steps to reproduce
- run the attached example with Tomcat 6 or 7
- reload the zul 2 times to send ZKMatchMedia=%24%24ZKMATCHMEDIA%24%24all%20and%20(min-width%20%3A%20641px) in a cookie
current result
WARN:oejs.CookieCutter:java.lang.IllegalArgumentException: Cookie name ""all and (min-width : 641px)"]" is a reserved token
followed by
Unexpected token END OF FILE at position 5. at org.zkoss.json.parser.JSONParser.parse(JSONParser.java:258) at org.zkoss.json.parser.JSONParser.parse(JSONParser.java:93) at org.zkoss.json.JSONValue.parse(JSONValue.java:40) at org.zkoss.json.JSONValue.parse(JSONValue.java:52) at org.zkoss.bind.impl.BinderImpl.init(BinderImpl.java:361) at org.zkoss.bind.AnnotateBinder.init(AnnotateBinder.java:58) at org.zkoss.bind.BindComposer.doBeforeComposeChildren(BindComposer.java:164) at org.zkoss.zk.ui.impl.UiEngineImpl.doBeforeComposeChildren(UiEngineImpl.java:997) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:937) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:841) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:460) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:594) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:542) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:271) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:98) at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:557) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:594) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:351) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534) at java.lang.Thread.run(Thread.java:745)
Reproduced with the zk8 UIPattern smalltalk demo project
debug info
- https://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/http/Cookie.html#setValue(java.lang.String)
With Version 0 cookies, values should not contain white space, brackets, parentheses, equals signs, commas, double quotes, slashes, question marks, at signs, colons, and semicolons. Empty values may not behave the same way on all browsers. - at the server side, the cookie's value is %24%24ZKMATCHMEDIA%24%24all%20and%20 and client sends %24%24ZKMATCHMEDIA%24%24all%20and%20(min-width%20%3A%20641px)
- it also happends on 8.0.4.FL.20161201-Eval
- encodeURIComponent() escapes all characters except the following: alphabetic, decimal digits, - _ . ! ~ * ' ( ) . And MDN also mentions a fix called encodeRFC5987ValueChars().