Thanks for another patch Jean-Baptiste. Would you mind creating a bug report for this, so that we can track it, have a nicer changes report, etc?
Cheers, Eelco On 9/9/06, Jean-Baptiste Quenot <[EMAIL PROTECTED]> wrote: > Hello Wicket Developers, > > I discovered a serious problem in Wicket 1.2 while my Wicket app > went in production. > > Previously I was using "" (root context) in the servlet container > configuration, and servlet mapping "/*" in web.xml. It works > great. You may be surprised, but yes, it works. I don't have > static resources to serve, so I didn't need to do the "/app/*" > servlet mapping that is recommended in the documentation. > > But for production we had the bad idea to change the context path > to "/myapp" (non-root context), still with servlet mapping "/*". > And in this configuration, Wicket ceased to work properly. > > Note: I'm not talking about servlet mapping "/", which is a > different story, I know using that will not work with Wicket. I'm > only talking about servlet mapping "/*". > > The symptom is that submitting forms using the "POST" method > leaded to strange errors that revealed that all form values were > lost. Looking at the page source, <form>'s action attribute gave > me a hint, it was written: > > <form action="/myapp?wicket:interface=:2:registerForm::IFormSubmitListener" > wicket:id="registerForm" method="post" id="registerForm"> > ^^^ > Instead of: > > <form action="/myapp/?wicket:interface=:2:registerForm::IFormSubmitListener" > wicket:id="registerForm" method="post" id="registerForm"> > ^^^ > > In this case, the servlet engine will redirect from /myapp to > /myapp/ to force using a canonical URL, and that's why I was > loosing the form values after POST. > > The good news is that a one-line patch to WebRequestCodingStrategy > is sufficient to fix the wrong Wicket behaviour (see attached). > As you know the URL prefix is computed only at the first Wicket > request, and when I request http://myserver/myapp/" the servlet > container returns "" (empty string) as getServletPath(). So the > empty string shall not be a no-go for appending a "/" at the end > of the URL. > > I tested the patch only with Jetty 5, but if you feel it is > necessary, I can take the time to test on other servlet containers > too. > > Thanks for reading up to the end! > -- > Jean-Baptiste Quenot > aka John Banana Qwerty > http://caraldi.com/jbq/ > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Wicket-develop mailing list > Wicket-develop@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-develop mailing list Wicket-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-develop