[jira] [Updated] (WICKET-4626) WicketFilter unify the filterPath
[ https://issues.apache.org/jira/browse/WICKET-4626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Darryl L. Miles updated WICKET-4626: Attachment: 0001-WICKET-4626-WicketFilter-unify-the-filterPath.patch PATCH ATTACHED > WicketFilter unify the filterPath > - > > Key: WICKET-4626 > URL: https://issues.apache.org/jira/browse/WICKET-4626 > Project: Wicket > Issue Type: Bug > Components: wicket >Affects Versions: 1.5.7 >Reporter: Darryl L. Miles > Attachments: 0001-WICKET-4626-WicketFilter-unify-the-filterPath.patch > > > WICKET-4626 WicketFilter unify the filterPath > Use of getter/setter internally to limit read/writes to filterPath > field location. > Removed lazy initialization code from main code path. > Provide a new method #canonicaliseFilterPath(String) to convert > "/wicket/" into "wicket/" as expected internally and maybe used by > unit tests to further validate correct values for filterPath. > Added unit test for this new method and use method in setter. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-4626) WicketFilter unify the filterPath
[ https://issues.apache.org/jira/browse/WICKET-4626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Darryl L. Miles updated WICKET-4626: Description: WICKET-4626 WicketFilter unify the filterPath Use of getter/setter internally to limit read/writes to filterPath field location. Removed lazy initialization code from main code path. Provide a new method #canonicaliseFilterPath(String) to convert "/wicket/" into "wicket/" as expected internally and maybe used by unit tests to further validate correct values for filterPath. Added unit test for this new method and use method in setter. was:UPDATE this with patch description when created. > WicketFilter unify the filterPath > - > > Key: WICKET-4626 > URL: https://issues.apache.org/jira/browse/WICKET-4626 > Project: Wicket > Issue Type: Bug > Components: wicket >Affects Versions: 1.5.7 >Reporter: Darryl L. Miles > > WICKET-4626 WicketFilter unify the filterPath > Use of getter/setter internally to limit read/writes to filterPath > field location. > Removed lazy initialization code from main code path. > Provide a new method #canonicaliseFilterPath(String) to convert > "/wicket/" into "wicket/" as expected internally and maybe used by > unit tests to further validate correct values for filterPath. > Added unit test for this new method and use method in setter. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Created] (WICKET-4626) WicketFilter unify the filterPath
Darryl L. Miles created WICKET-4626: --- Summary: WicketFilter unify the filterPath Key: WICKET-4626 URL: https://issues.apache.org/jira/browse/WICKET-4626 Project: Wicket Issue Type: Bug Components: wicket Affects Versions: 1.5.7 Reporter: Darryl L. Miles UPDATE this with patch description when created. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-4625) ServletWebRequest#getContextRelativeUrl() sometimes chops off leading characters
[ https://issues.apache.org/jira/browse/WICKET-4625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Darryl L. Miles updated WICKET-4625: Affects Version/s: 1.5.7 > ServletWebRequest#getContextRelativeUrl() sometimes chops off leading > characters > > > Key: WICKET-4625 > URL: https://issues.apache.org/jira/browse/WICKET-4625 > Project: Wicket > Issue Type: Bug >Affects Versions: 1.5.7 >Reporter: Darryl L. Miles > Attachments: > 0001-WICKET-4625-ServletWebRequest-getContextRelativeUrl-.patch > > > This patch reduces the number of nonsense return value this method might > produce. I have clarified the in JavaDoc the expected inputs to the method. > It is still possible to still get a nonsense return values in some use cases, > all scenarios are documented and tested in a new test case. > This method presumes that the input "uri" on the 1st argument always has the > ContextPath and then the FilterPrefix on the front of the URL. > Some unit tests were actually checking the nonsense return values were being > returned these have been updated. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-4625) ServletWebRequest#getContextRelativeUrl() sometimes chops off leading characters
[ https://issues.apache.org/jira/browse/WICKET-4625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399528#comment-13399528 ] Darryl L. Miles commented on WICKET-4625: - Note I think that in the scenario where: contextPath="/context" filterPrefix="/wicket/" uri="/context/wicket-foobar" Then it would errornously return "foobar" is this a problem for this method ? This would be fixed by doing a "string compare and return number or identical characters matched method", instead of the new use of String#startswith(String) method. However I believe that in a real world application it is WicketFilter's job to ensure the trailing slash is there and not pass control into Wicket for my example "/context/wicket-foobar" above. I just through I'd > ServletWebRequest#getContextRelativeUrl() sometimes chops off leading > characters > > > Key: WICKET-4625 > URL: https://issues.apache.org/jira/browse/WICKET-4625 > Project: Wicket > Issue Type: Bug >Affects Versions: 1.5.7 >Reporter: Darryl L. Miles > Attachments: > 0001-WICKET-4625-ServletWebRequest-getContextRelativeUrl-.patch > > > This patch reduces the number of nonsense return value this method might > produce. I have clarified the in JavaDoc the expected inputs to the method. > It is still possible to still get a nonsense return values in some use cases, > all scenarios are documented and tested in a new test case. > This method presumes that the input "uri" on the 1st argument always has the > ContextPath and then the FilterPrefix on the front of the URL. > Some unit tests were actually checking the nonsense return values were being > returned these have been updated. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-4625) ServletWebRequest#getContextRelativeUrl() sometimes chops off leading characters
[ https://issues.apache.org/jira/browse/WICKET-4625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Darryl L. Miles updated WICKET-4625: Attachment: 0001-WICKET-4625-ServletWebRequest-getContextRelativeUrl-.patch This is for 1.5.x and 1.6.x (tested on 6.0-SNAPSHOT) See comment above and inside git patch file. > ServletWebRequest#getContextRelativeUrl() sometimes chops off leading > characters > > > Key: WICKET-4625 > URL: https://issues.apache.org/jira/browse/WICKET-4625 > Project: Wicket > Issue Type: Bug >Reporter: Darryl L. Miles > Attachments: > 0001-WICKET-4625-ServletWebRequest-getContextRelativeUrl-.patch > > > This patch reduces the number of nonsense return value this method might > produce. I have clarified the in JavaDoc the expected inputs to the method. > It is still possible to still get a nonsense return values in some use cases, > all scenarios are documented and tested in a new test case. > This method presumes that the input "uri" on the 1st argument always has the > ContextPath and then the FilterPrefix on the front of the URL. > Some unit tests were actually checking the nonsense return values were being > returned these have been updated. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-4625) ServletWebRequest#getContextRelativeUrl() sometimes chops off leading characters
[ https://issues.apache.org/jira/browse/WICKET-4625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399520#comment-13399520 ] Darryl L. Miles commented on WICKET-4625: - WICKET-4625 ServletWebRequest#getContextRelativeUrl() removes extra leading character Defensive patch that work in all scenarios addresses sanitization of the filterPrefix argument to ensure it has both a leading and trailing slash. The goal of the patch is to remove the extra "+1" being added to 'start' computation and causes the return value to remove the first character of the relative URI. It was found that the filterPrefix argument may or may not have a leading slash, also the filterPrefix argument may or may not have a trailing slash. It would also return complete nonsense when the given 'uri' did not match the contextPath and/or filterPrefix. The method needs to work when contextPath="/context" and contextPath="" never contextPath="/context/" (not valid input data) never contextPath="/" (an empty string is correct, a single slash is not valid) The method needs to work when filterPrefix="" (when there is no prefix) filterPrefix="/prefix/" (which is the form seen from debuging real applications) filterPrefix="prefix/" (which is the form seen suring unit testing, this is also the format of data currently stored in WicketFilter#filterPath) never filterPrefix="/" (an empty string is correct, a single slash is not valid) never filterPrefix="prefix" (not valid input data) So often the +1 would be correct (more by luck than engineering), and then sometimes it would be incorrect. The need for ensuring filterPath has a leading slash is that when Unit testing the method MockHttpServletRequest#getFilterPath() removes the leading slash and causes that prefix to end up at the filterPrefix argument to the #getContextRelativeUrl() method. Under my limited real world application testing I have never seen the leading slash removed from the filterPrefix when debugging the method #getContextRelativeUrl() and I suspect this is a test case only scenario being catered for here due the way the Mock object is written. This patch passes all wicket.git project unit tests for me. > ServletWebRequest#getContextRelativeUrl() sometimes chops off leading > characters > > > Key: WICKET-4625 > URL: https://issues.apache.org/jira/browse/WICKET-4625 > Project: Wicket > Issue Type: Bug >Reporter: Darryl L. Miles > > This patch reduces the number of nonsense return value this method might > produce. I have clarified the in JavaDoc the expected inputs to the method. > It is still possible to still get a nonsense return values in some use cases, > all scenarios are documented and tested in a new test case. > This method presumes that the input "uri" on the 1st argument always has the > ContextPath and then the FilterPrefix on the front of the URL. > Some unit tests were actually checking the nonsense return values were being > returned these have been updated. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-4623) UploadProgressBar does not show up if the form submitted by AjaxButton or AjaxLink
[ https://issues.apache.org/jira/browse/WICKET-4623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399443#comment-13399443 ] Sven Meier commented on WICKET-4623: I've added a progressBar to example's FileUploadPage (don't forget getApplicationSettings().setUploadProgressUpdatesEnabled(true)) and can confirm the issue. Problem is that the request for the upload status (UploadStatusResource) is coming in earlier than the actual upload via ajax. Thus no UploadInfo is found in the session and the progressBar assumes the upload to have finished. A the moment I don't have an idea how to fix this. > UploadProgressBar does not show up if the form submitted by AjaxButton or > AjaxLink > -- > > Key: WICKET-4623 > URL: https://issues.apache.org/jira/browse/WICKET-4623 > Project: Wicket > Issue Type: Bug > Components: wicket-extensions >Affects Versions: 1.5.7 > Environment: Win 7 64bit, jetty, netbeans 7.1, jdk1.6.0_30 >Reporter: Sandor Feher > Labels: Ajax, UploadProgressBar, > > If I submit the form normal submit button then the progressbar shows up. If I > do it with any ajax component (AjaxLink, AjaxButton ...) then it does not > show. > I set up setOutputMarkupPlaceholderTag(true) for progressbar itself and it's > parent component (the form) but it has not helped. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Created] (WICKET-4625) ServletWebRequest#getContextRelativeUrl() sometimes chops off leading characters
Darryl L. Miles created WICKET-4625: --- Summary: ServletWebRequest#getContextRelativeUrl() sometimes chops off leading characters Key: WICKET-4625 URL: https://issues.apache.org/jira/browse/WICKET-4625 Project: Wicket Issue Type: Bug Reporter: Darryl L. Miles This patch reduces the number of nonsense return value this method might produce. I have clarified the in JavaDoc the expected inputs to the method. It is still possible to still get a nonsense return values in some use cases, all scenarios are documented and tested in a new test case. This method presumes that the input "uri" on the 1st argument always has the ContextPath and then the FilterPrefix on the front of the URL. Some unit tests were actually checking the nonsense return values were being returned these have been updated. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[CONF] Apache Wicket > Wicket without web.xml (embedded Jetty)
Wicket without web.xml (embedded Jetty) Page edited by Pouyan Fotouhi Tehrani Changes (2) ... h3. Configure Jetty to start WebApplication h34. Using WicketServlet {code} server = new Server(); ... You may wonder where {{WicketServlet}} came from, since it is not explicitly in web.xml. It is important to note that even if in web.xml there is only a filter defined, jetty needs a servlet to serve the requests. {{WicketServlet}} is an implementation of servlet, which contains {{WicketFilter}} to filter requests. If you want to have more control over {{WicketFilter}} see next part. h34. Using WicketFilter {code} ServletContextHandler sch = new ServletContextHandler(ServletContextHandler.SESSIONS); ... Full Content Table of contents Motivation Configuring Jetty Configure Jetty to start WebApplication Using WicketServlet Using WicketFilter Extra Servlet for static resources Motivation There are situation, when you don't want to export your application as a WAR file and have the conventional WAR structure. Or for any other reason you want to avoid using web.xml file. In the following we configure an embedded version of Jetty without using web.xml. The following code should work with Wicket 1.5 and Jetty 8. Configuring Jetty Following is an example of web.xml: "1.0" encoding="ISO-8859-1"?> "http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> myproject wicket.myproject org.apache.wicket.protocol.http.WicketFilter applicationClassName com.mycompany.WicketApplication wicket.myproject /* What we need to do is simply configure embedded Jetty to exhibit the same behaviour in case of missing web.xml Configure Jetty to start WebApplication Using WicketServlet server = new Server(); /* Setup server (port, etc.) */ ServletContextHandler sch = new ServletContextHandler(ServletContextHandler.SESSIONS); ServletHolder sh = new ServletHolder(WicketServlet.class); sh.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM, WicketApplication.class.getName()); sh.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*"); /* Define a variable DEV_MODE and set to false * if wicket should be used in deployment mode */ if(!DEV_MODE) { sh.setInitParameter("wicket.configuration", "deployment"); } sch.addServlet(sh, "/*"); server.setHandler(sch) The Code above configures Jetty in a manner similar to given web.xml file. Note that we use a ServletHolder which encapsulates both context and class of a servlet. The ServletHolder is then added to ServletContextHandler which as finally added as the only handler to our Jetty Server. You may wonder where WicketServlet came from, since it is not explicitly in web.xml. It is important to note that even if in web.xml there is only a filter defined, jetty needs a servlet to serve the requests. WicketServlet is an implementation of servlet, which contains WicketFilter to filter requests. If you want to have more control over WicketFilter see next part. Using WicketFilter ServletContextHandler sch = new ServletContextHandler(ServletContextHandler.SESSIONS); FilterHolder fh2 = new FilterHolder(WicketFilter.class); fh2.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM, WicketApplication.class.getName()); fh2.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*"); sch.addFilter(fh2, "/*", EnumSet.of(DispatcherType.REQUEST,DispatcherType.ERROR)); sch.addServlet(DefaultServlet.class, "/*"); As you can see, since we need a servlet to serve the request we just added a DefaultServlet. Extra Servlet for static resources WicketFilter automatically passes the requests, which it cannot (or does not want to) process down the chain. In that case you can simply define another Servlet and add it to ServletContextHandler. This can be used, for example, if you want to access static data accessible under /static/ folder of your application: // Static resources String staticPath = this.getClass().getClassLoader().getResource("static/").toExternalForm(); ServletHolder resourceServlet = new ServletHolder(DefaultServlet.class); resourceServlet.setInitParameter("dirAllowed", "true"); resourceServlet.setInitParameter("resourceBase", staticPath); resourceServlet.setInitParameter("pathInfoOnly", "true"); Using the following code if you haven't already configured Wicket to handle a request such as localhost:8080/static/js/jquery.js, it will be passed down the handler chain to resourceServlet and it will retrieve the desired file
[CONF] Apache Wicket > Wicket without web.xml (embedded Jetty)
Wicket without web.xml (embedded Jetty) Page edited by Pouyan Fotouhi Tehrani Changes (3) ... What we need to do is simply configure embedded Jetty to exhibit the same behaviour in case of missing web.xml h3. Adding Wicket Filter to Jetty h3. Configure Jetty to start WebApplication h3. Using WicketServlet {code} server = new Server(); ... The Code above configures Jetty in a manner similar to given web.xml file. Note that we use a [ServletHolder|http://download.eclipse.org/jetty/stable-8/apidocs/org/eclipse/jetty/servlet/ServletHolder.html] which encapsulates both context and class of a servlet. The {{ServletHolder}} is then added to [ServletContextHandler|http://download.eclipse.org/jetty/stable-8/apidocs/org/eclipse/jetty/servlet/ServletContextHandler.html] which as finally added as the only handler to our Jetty Server. You may wonder where {{WicketServlet}} came from, since it is not explicitly in web.xml. It is important to note that even if in web.xml there is only a filter defined, jetty needs a servlet to serve the requests. {{WicketServlet}} is an implementation of servlet, which contains {{WicketFilter}} to filter requests. If you want to have more control over {{WicketFilter}} see next part. h3. Using WicketFilter {code} ServletContextHandler sch = new ServletContextHandler(ServletContextHandler.SESSIONS); FilterHolder fh2 = new FilterHolder(WicketFilter.class); fh2.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM, WicketApplication.class.getName()); fh2.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*"); sch.addFilter(fh2, "/*", EnumSet.of(DispatcherType.REQUEST,DispatcherType.ERROR)); sch.addServlet(DefaultServlet.class, "/*"); {code} As you can see, since we need a servlet to serve the request we just added a {{DefaultServlet}}. h3. Extra Servlet for static resources [WicketFilter|http://wicket.apache.org/apidocs/1.5/org/apache/wicket/protocol/http/WicketFilter.html] automatically passes the requests, which it cannot (or does not want to) process down the chain. In that case you can simply define another Servlet and add it to {{ServletContextHandler}}. This can be used, for example, if you want to access static data accessible under {{/static/}} folder of your application: ... Full Content Table of contents Motivation Configuring Jetty Configure Jetty to start WebApplication Using WicketServlet Using WicketFilter Extra Servlet for static resources Motivation There are situation, when you don't want to export your application as a WAR file and have the conventional WAR structure. Or for any other reason you want to avoid using web.xml file. In the following we configure an embedded version of Jetty without using web.xml. The following code should work with Wicket 1.5 and Jetty 8. Configuring Jetty Following is an example of web.xml: "1.0" encoding="ISO-8859-1"?> "http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> myproject wicket.myproject org.apache.wicket.protocol.http.WicketFilter applicationClassName com.mycompany.WicketApplication wicket.myproject /* What we need to do is simply configure embedded Jetty to exhibit the same behaviour in case of missing web.xml Configure Jetty to start WebApplication Using WicketServlet server = new Server(); /* Setup server (port, etc.) */ ServletContextHandler sch = new ServletContextHandler(ServletContextHandler.SESSIONS); ServletHolder sh = new ServletHolder(WicketServlet.class); sh.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM, WicketApplication.class.getName()); sh.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*"); /* Define a variable DEV_MODE and set to false * if wicket should be used in deployment mode */ if(!DEV_MODE) { sh.setInitParameter("wicket.configuration", "deployment"); } sch.addServlet(sh, "/*"); server.setHandler(sch) The Code above configures Jetty in a manner similar to given web.xml file. Note that we use a ServletHolder which encapsulates both context and class of a servlet. The ServletHolder is then added to ServletContextHandler which as finally added as the only handler to our Jetty Server. You may wonder where WicketServlet came from, since it is not explicitly in web.xml. It is important to note that even if in web.xml there is only a filter defined, jetty needs a servlet to serve the requests. WicketServlet is an implementation of servlet, which contains WicketFilter to filter requests. If you want
[jira] [Commented] (WICKET-4618) ResourceStreamLocator does a hard-coded resource lookup in "META-INF/resources"
[ https://issues.apache.org/jira/browse/WICKET-4618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399305#comment-13399305 ] Carl-Eric Menzel commented on WICKET-4618: -- Not yet fixed in 6.0, but that will be taken care of by WICKET-4617. > ResourceStreamLocator does a hard-coded resource lookup in > "META-INF/resources" > --- > > Key: WICKET-4618 > URL: https://issues.apache.org/jira/browse/WICKET-4618 > Project: Wicket > Issue Type: Bug >Affects Versions: 6.0.0-beta2, 1.5.7 >Reporter: Carl-Eric Menzel >Assignee: Carl-Eric Menzel > Fix For: 1.5.8 > > > ResourceStreamLocator currently does a hard-coded resource lookup in > "META-INF/resources". In deployment, that is not a big problem, since its > results are cached. In testing however, this single line is nearly doubling > our wallclock time. > I agree that the lookup is necessary for Servlet 3.0 support, but it should > not be just inelegantly hardcoded like that. Our application doesn't use it, > yet our tests are hit hard. I profiled one of the worse testcases (roughly > 50-60 seconds in 1.4, now 110-120(!)) - we spent over 70% of the time in > ResourceStreamLocator#getResourceStream. I tried commenting out just that one > call looking for "META-INF/resources" and the test dropped back down to 60 > seconds. > So I'd really like this to be configurable, so I can just get rid of it in > test configurations. > WICKET-4617 will take care of it all in 6.0, because it will introduce a > ResourceFinder/ResourcePath for it, which will make it easily configurable. > For 1.5 I propose giving ResourceStreamLocator itself a list of paths to try > (by default "" and "META-INF/resources") instead of hard-coding. > Objections? -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (WICKET-4618) ResourceStreamLocator does a hard-coded resource lookup in "META-INF/resources"
[ https://issues.apache.org/jira/browse/WICKET-4618?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Carl-Eric Menzel resolved WICKET-4618. -- Resolution: Fixed Fix Version/s: 1.5.8 Fixed in 1.5.x. New method ResourceStreamLocator#getClasspathLocationPrefixes(). > ResourceStreamLocator does a hard-coded resource lookup in > "META-INF/resources" > --- > > Key: WICKET-4618 > URL: https://issues.apache.org/jira/browse/WICKET-4618 > Project: Wicket > Issue Type: Bug >Affects Versions: 6.0.0-beta2, 1.5.7 >Reporter: Carl-Eric Menzel >Assignee: Carl-Eric Menzel > Fix For: 1.5.8 > > > ResourceStreamLocator currently does a hard-coded resource lookup in > "META-INF/resources". In deployment, that is not a big problem, since its > results are cached. In testing however, this single line is nearly doubling > our wallclock time. > I agree that the lookup is necessary for Servlet 3.0 support, but it should > not be just inelegantly hardcoded like that. Our application doesn't use it, > yet our tests are hit hard. I profiled one of the worse testcases (roughly > 50-60 seconds in 1.4, now 110-120(!)) - we spent over 70% of the time in > ResourceStreamLocator#getResourceStream. I tried commenting out just that one > call looking for "META-INF/resources" and the test dropped back down to 60 > seconds. > So I'd really like this to be configurable, so I can just get rid of it in > test configurations. > WICKET-4617 will take care of it all in 6.0, because it will introduce a > ResourceFinder/ResourcePath for it, which will make it easily configurable. > For 1.5 I propose giving ResourceStreamLocator itself a list of paths to try > (by default "" and "META-INF/resources") instead of hard-coding. > Objections? -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
[ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Carl-Eric Menzel updated WICKET-4575: - Fix Version/s: 1.5.8 > AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5 > --- > > Key: WICKET-4575 > URL: https://issues.apache.org/jira/browse/WICKET-4575 > Project: Wicket > Issue Type: Bug > Components: wicket >Affects Versions: 1.5.0, 6.0.0-beta2 >Reporter: James McIntosh >Assignee: Carl-Eric Menzel > Fix For: 6.0.0-RC1, 1.5.8 > > > I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a > big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget). > In 1.4 the code would submit the From.onSubmit() first and then fire the > AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to > process the AjaxFormSubmitBehavior first. > I have lots of examples of requiring the AjaxButton to perform "on after > submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form > submit. These ajax events change the component heirachy so that the form is > no longer present, thus never gets submitted e.g. Next button. I have no > particular cases where I would want the AjaxButton onSubmit called before the > form submit, I'm wondering if there are many at all. > I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic > for other components which use it so I will make a suggestion to modify the > AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate > the original behaviour: > new AjaxFormSubmitBehavior(form, "onclick") { > boolean formSubmited; > protected void onEvent(AjaxRequestTarget target) { > formSubmited = false; > super.onEvent(target); > if (formSubmited) { > LegacyAjaxButton.this.onSubmit(target, > LegacyAjaxButton.this.getForm()); > } > } > > protected void onSubmit(AjaxRequestTarget target) { > formSubmited = true; > LegacyAjaxButton.this.onBeforeSubmit(target, > LegacyAjaxButton.this.getForm()); > } > > ... > > } > and add an onBeforeSubmit method to the AjaxButton. > protected void onBeforeSubmit(AjaxRequestTarget target, Form form) { > > } > The other possible solution would be to change the IFormSubmitter to have > both an onAfterSubmit() and call it in Form.delegateSubmit(). > Just as a side note, I've noticed some other chatter on mailing lists around > this (see below) so thought I would raise it. > AjaxWizard issue: > http://www.mail-archive.com/users@wicket.apache.org/msg71273.html > AjaxButton issue: > http://comments.gmane.org/gmane.comp.java.wicket.user/96947 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (WICKET-4575) AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5
[ https://issues.apache.org/jira/browse/WICKET-4575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Carl-Eric Menzel resolved WICKET-4575. -- Resolution: Fixed Commited the patches to both 1.5 and 6.0. > AjaxButton / AjaxFormSubmitBehavior behaviour in wicket 1.5 > --- > > Key: WICKET-4575 > URL: https://issues.apache.org/jira/browse/WICKET-4575 > Project: Wicket > Issue Type: Bug > Components: wicket >Affects Versions: 1.5.0, 6.0.0-beta2 >Reporter: James McIntosh >Assignee: Carl-Eric Menzel > Fix For: 6.0.0-RC1, 1.5.8 > > > I've just been going through an upgrade form wicket 1.4 to 1.5 and noticed a > big change in the AjaxFormSubmitBehavior.onEvent(AjaxRequestTarget). > In 1.4 the code would submit the From.onSubmit() first and then fire the > AjaxFormSubmitBehavior.onSubmit() event, now this behaviour is reversed to > process the AjaxFormSubmitBehavior first. > I have lots of examples of requiring the AjaxButton to perform "on after > submit" ajax events, e.g. Ajax Wizard navigation, closing modals after form > submit. These ajax events change the component heirachy so that the form is > no longer present, thus never gets submitted e.g. Next button. I have no > particular cases where I would want the AjaxButton onSubmit called before the > form submit, I'm wondering if there are many at all. > I'm not sure of the implications of changing the AjaxFormSubmitBehavior logic > for other components which use it so I will make a suggestion to modify the > AjaxFormSubmitBehaviour's onEvent and onSubmit in the AjaxButton to emulate > the original behaviour: > new AjaxFormSubmitBehavior(form, "onclick") { > boolean formSubmited; > protected void onEvent(AjaxRequestTarget target) { > formSubmited = false; > super.onEvent(target); > if (formSubmited) { > LegacyAjaxButton.this.onSubmit(target, > LegacyAjaxButton.this.getForm()); > } > } > > protected void onSubmit(AjaxRequestTarget target) { > formSubmited = true; > LegacyAjaxButton.this.onBeforeSubmit(target, > LegacyAjaxButton.this.getForm()); > } > > ... > > } > and add an onBeforeSubmit method to the AjaxButton. > protected void onBeforeSubmit(AjaxRequestTarget target, Form form) { > > } > The other possible solution would be to change the IFormSubmitter to have > both an onAfterSubmit() and call it in Form.delegateSubmit(). > Just as a side note, I've noticed some other chatter on mailing lists around > this (see below) so thought I would raise it. > AjaxWizard issue: > http://www.mail-archive.com/users@wicket.apache.org/msg71273.html > AjaxButton issue: > http://comments.gmane.org/gmane.comp.java.wicket.user/96947 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[CONF] Apache Wicket > Migration to Wicket 6.0
Migration to Wicket 6.0 Page edited by Carl-Eric Menzel Changes (1) ... Provided that the field has a 'Number' label. h4. onSubmit in Buttons and SubmitLinks has been replaced with onSubmitBefore/AfterForm The call order of onSubmit in Buttons vs Forms was inconsistent in 1.4, and fixed at "Button always comes first" in 1.5. Sometimes it is desirable to have the Button's onSubmit running after the Form's, however. In 6.0, {{IFormSubmitter.onSubmit}} is gone and has been replaced by {{.onSubmitBeforeForm}} and {{.onSubmitAfterForm}}. Your submitting component can implement either one of them or even both. Both will be called after the validation and form model update, just like onSubmit before. The only difference is that you can now pick whether something should happen before or after {{Form.onSubmit}}. h3. Ajax ... Full Content Migrating to Wicket 6.0 Environment Repeaters Form Processing Validation Feedback Storage Refactoring Feedback messages now use ${label} instead of ${input} onSubmit in Buttons and SubmitLinks has been replaced with onSubmitBefore/AfterForm Ajax Use JQuery as a backing library for Wicket Ajax functionality AjaxRequestTarget is an interface IHeaderResponse, including decorators and filters Order of Header contributions and wicket:head package.properties renamed to wicket-package.properties List of renamed classes and methods Refactorings o.a.w.IComponentSource and o.a.w.ComponentSourceEntry are removed o.a.w.Component#onMarkupAttached() has been dropped in favour of o.a.w.Component#onInitialize(). IInitializers are initialized before Application#init() PackageResourceReference can load a minified version of a package resource Minor changes Environment Wicket 6.0 requires at least Java 6 Repeaters `IDataProvider` was converted to using `long` instead of `int` to better line up with JPA and other persistence frameworks. This has caused a rather large cascade of `int` to `long` changes all over the repeater packages (WICKET-1175). All classes in wicket-extensions which are related to repeaters with sorting behavior have improved generics related to the sorting property (WICKET-4535). In most cases you just have to add ', String' to the previous parameterized type. For example: IColumn becomes IColumn. But now it is possible to use other type for the sort property than java.lang.String too. Form Processing Validation `StringValidator` will add the `maxlength` attribute if added to a component attached to an input tag `AbstractValidator` has been removed `ValidationError` now makes creating standard error keys (classname and classname.subtype) easier. Before one had to do: new ValidationError().addMessageKey(validator.getClass().getSimpleName()) to construct the default key, now you can simply say new ValidationError(validator) and it will do the above for you. Also, for more specific keys one had to do new ValidationError().addMessageKey(validator.getClass().getSimpleName()+".variant"), now you can do new ValidationError(validator, "variant"). Most validators provide a `decorate(ValidationError, Validatable)` method for overriding how they report errors. For example, to add an extra resource key for the error message to StringValidator one can do class MyStringValidator extends StringValidator { ValidationError decorate(ValidationError error, IValidatable validatable) { error.addKey("mystringerror"); return error; } } org.apache.wicket.validation.RawValidationError is introduced. It can be used to bring a raw Serializable object which is registered as FeedbackMessage with org.apache.wicket.Component#error(Serializable). IFormValidator can have its own resource bundle as other IValidator implementations. WICKET-3879 Feedback Storage Refactoring Feedback messages reported against components are now stored in component's metadata rather then in session. This will allow them to survive across requests, see WICKET-2705. Previously the cleanup of messages was controlled by RequestCycle#cleanupFeedbackMessages(), now it is controlled by an IFeedbackMessageFilter set via IApplicationSettings#setFeedbackMessageCleanupFilter(). When session and components are detached they will run this filter on any stored messages, all messages accepted by the filter are removed. The default filter will accept any rendered message, so by default feedback messages are removed once rendered. Form components will clear any stored messages when validate() is called. This will remove any unredered, but now stale, messages. Since messages are now stored in session and in component tree retrieving the
[2/2] git commit: WICKET-4575 before/after submit
WICKET-4575 before/after submit Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e0286bad Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e0286bad Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e0286bad Branch: refs/heads/wicket-1.5.x Commit: e0286bada4ba7142e039f3176210e86bd9c78544 Parents: d274f68 Author: Carl-Eric Menzel Authored: Fri Jun 22 14:31:03 2012 +0200 Committer: Carl-Eric Menzel Committed: Fri Jun 22 14:31:03 2012 +0200 -- .../wicket/ajax/form/AjaxFormSubmitBehavior.java | 44 - .../wicket/ajax/markup/html/form/AjaxButton.java | 51 ++- .../ajax/markup/html/form/AjaxFallbackButton.java | 72 ++- .../ajax/markup/html/form/AjaxSubmitLink.java | 60 +++- .../markup/html/form/AbstractSubmitLink.java |7 +- .../org/apache/wicket/markup/html/form/Button.java | 34 ++- .../org/apache/wicket/markup/html/form/Form.java | 15 +++- .../html/form/IBeforeAndAfterFormSubmitter.java| 38 .../wicket/markup/html/form/IFormSubmitter.java|9 ++- .../apache/wicket/markup/html/form/SubmitLink.java | 21 - .../html/form/FormSubmitOrderTest$TestPage.html|7 ++ .../markup/html/form/FormSubmitOrderTest.java | 67 ++ .../markup/html/form/submitlink/HomePage.java | 44 - .../markup/html/form/submitlink/TestHomePage.java | 13 +++ 14 files changed, 452 insertions(+), 30 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/e0286bad/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java index 6532843..27d988e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java @@ -21,7 +21,7 @@ import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.IFormSubmitter; +import org.apache.wicket.markup.html.form.IBeforeAndAfterFormSubmitter; import org.apache.wicket.markup.html.form.IFormSubmittingComponent; import org.apache.wicket.util.string.AppendingStringBuffer; @@ -155,7 +155,7 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior @Override protected void onEvent(final AjaxRequestTarget target) { - getForm().getRootForm().onFormSubmitted(new IFormSubmitter() + getForm().getRootForm().onFormSubmitted(new IBeforeAndAfterFormSubmitter() { public Form getForm() { @@ -176,23 +176,57 @@ public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior { AjaxFormSubmitBehavior.this.onError(target); } + + public void onSubmitBeforeForm() + { + AjaxFormSubmitBehavior.this.onSubmitBeforeForm(target); + } + + public void onSubmitAfterForm() + { + AjaxFormSubmitBehavior.this.onSubmitAfterForm(target); + } }); } /** +* Override this method to provide special submit handling in a multi-button form. This method +* will be called after the form's onSubmit method. +*/ + protected void onSubmitAfterForm(AjaxRequestTarget target) + { + } + + /** +* Override this method to provide special submit handling in a multi-button form. This method +* will be called before the form's onSubmit method. +*/ + protected void onSubmitBeforeForm(AjaxRequestTarget target) + { + } + + /** * Listener method that is invoked after the form has been submitted and processed without * errors * * @param target +* @deprecated Will be removed in 6.0. Use {@link #onSubmitBeforeForm(AjaxRequestTarget)} and/or +* link #onSubmitAfterForm(AjaxRequestTarget)} instead. */ - protected abstract void onSubmit(AjaxRequestTarget target); + @Deprecated + protected void onSubmit(AjaxRequestTarget target) + { + } /** -* Listener method invoked when the for
git commit: WICKET-4618 Make resource lookup prefixes configurable for 1.5
Updated Branches: refs/heads/wicket-1.5.x 6f7236897 -> d274f682b WICKET-4618 Make resource lookup prefixes configurable for 1.5 Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d274f682 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d274f682 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d274f682 Branch: refs/heads/wicket-1.5.x Commit: d274f682b1d8b58460fd950fd982f6f8449ef6b9 Parents: 6f72368 Author: Carl-Eric Menzel Authored: Fri Jun 22 14:10:01 2012 +0200 Committer: Carl-Eric Menzel Committed: Fri Jun 22 14:10:58 2012 +0200 -- .../resource/locator/ResourceStreamLocator.java| 39 ++-- .../apache/wicket/util/resource/locator/foo.txt|1 + .../locator/ResourceStreamLocatorTest.java | 75 +++ .../apache/wicket/util/resource/locator/foo.txt|1 + 4 files changed, 107 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/d274f682/wicket-core/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java b/wicket-core/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java index 44d2c48..2e54ff4 100644 --- a/wicket-core/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java +++ b/wicket-core/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java @@ -17,6 +17,8 @@ package org.apache.wicket.util.resource.locator; import java.net.URL; +import java.util.LinkedList; +import java.util.List; import java.util.Locale; import org.apache.wicket.Application; @@ -64,6 +66,12 @@ public class ResourceStreamLocator implements IResourceStreamLocator /** If null, the application registered finder will be used */ private IResourceFinder finder; + private final List classpathLocationPrefixes = new LinkedList(); + { + classpathLocationPrefixes.add(""); + classpathLocationPrefixes.add("META-INF/resources"); + } + /** * Constructor */ @@ -201,18 +209,16 @@ public class ResourceStreamLocator implements IResourceStreamLocator classLoader); } - // Try loading path using classloader - URL url = classLoader.getResource(path); - if (url == null) + for (String prefix : classpathLocationPrefixes) { - // maybe it is in the Servlet 3.0 like directory - url = classLoader.getResource("META-INF/resources/" + path); + String fullPath = prefix.length() > 0 ? prefix + "/" + path : path; + URL url = classLoader.getResource(fullPath); + if (url != null) + { + return new UrlResourceStream(url); + } } - if (url != null) - { - return new UrlResourceStream(url); - } return null; } @@ -270,4 +276,19 @@ public class ResourceStreamLocator implements IResourceStreamLocator return new ResourceNameIterator(realPath, style, variation, locale, realExtension, strict); } + + /** +* The list of prefixes that are added to a path when trying to find resources in the classpath. +* By default, these are: +* +* "" - no prefix +* "META-INF/resources" - for Servlet 3.0 compatibility. +* +* +* @return +*/ + public List getClasspathLocationPrefixes() + { + return classpathLocationPrefixes; + } } http://git-wip-us.apache.org/repos/asf/wicket/blob/d274f682/wicket-core/src/test/java/ResourceStreamLocatorTest/some/path/org/apache/wicket/util/resource/locator/foo.txt -- diff --git a/wicket-core/src/test/java/ResourceStreamLocatorTest/some/path/org/apache/wicket/util/resource/locator/foo.txt b/wicket-core/src/test/java/ResourceStreamLocatorTest/some/path/org/apache/wicket/util/resource/locator/foo.txt new file mode 100644 index 000..d3009c3 --- /dev/null +++ b/wicket-core/src/test/java/ResourceStreamLocatorTest/some/path/org/apache/wicket/util/resource/locator/foo.txt @@ -0,0 +1 @@ +with prefix http://git-wip-us.apache.org/repos/asf/wicket/blob/d274f682/wicket-core/src/test/java/org/apache/wicket/util/resource/locator/ResourceStreamLocatorTest.java --
[jira] [Updated] (WICKET-4624) requestcyclelistener which registers and retrieves pagerequesthandler in a request
[ https://issues.apache.org/jira/browse/WICKET-4624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] vineet semwal updated WICKET-4624: -- Attachment: handler.jar quickstart > requestcyclelistener which registers and retrieves pagerequesthandler in a > request > -- > > Key: WICKET-4624 > URL: https://issues.apache.org/jira/browse/WICKET-4624 > Project: Wicket > Issue Type: Improvement >Reporter: vineet semwal >Priority: Minor > Labels: requestcyclelistener, wicket > Attachments: handler.jar > > > there are situations in which i would like to know the pagerequesthandlers in > a request.one of the situation can be irequestcyclelistener#onexception(*) > ,i am attaching the listener in a quickstart for the same. > thanks -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Created] (WICKET-4624) requestcyclelistener which registers and retrieves pagerequesthandler in a request
vineet semwal created WICKET-4624: - Summary: requestcyclelistener which registers and retrieves pagerequesthandler in a request Key: WICKET-4624 URL: https://issues.apache.org/jira/browse/WICKET-4624 Project: Wicket Issue Type: Improvement Reporter: vineet semwal Priority: Minor Attachments: handler.jar there are situations in which i would like to know the pagerequesthandlers in a request.one of the situation can be irequestcyclelistener#onexception(*) ,i am attaching the listener in a quickstart for the same. thanks -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Created] (WICKET-4623) UploadProgressBar does not show up if the form submitted by AjaxButton or AjaxLink
Sandor Feher created WICKET-4623: Summary: UploadProgressBar does not show up if the form submitted by AjaxButton or AjaxLink Key: WICKET-4623 URL: https://issues.apache.org/jira/browse/WICKET-4623 Project: Wicket Issue Type: Bug Components: wicket-extensions Affects Versions: 1.5.7 Environment: Win 7 64bit, jetty, netbeans 7.1, jdk1.6.0_30 Reporter: Sandor Feher If I submit the form normal submit button then the progressbar shows up. If I do it with any ajax component (AjaxLink, AjaxButton ...) then it does not show. I set up setOutputMarkupPlaceholderTag(true) for progressbar itself and it's parent component (the form) but it has not helped. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[CONF] Apache Wicket > Wicket without web.xml (embedded Jetty)
Wicket without web.xml (embedded Jetty) Page edited by Pouyan Fotouhi Tehrani Changes (1) ... ServletContextHandler sch = new ServletContextHandler(ServletContextHandler.SESSIONS); ServletHolder sh = new ServletHolder(WicketServlet.class); sh.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM, WinterfaceApplication.class.getName()); WicketApplication.class.getName()); sh.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*"); /* Define a variable DEV_MODE and set to false ... Full Content Table of contents Motivation Configuring Jetty Adding Wicket Filter to Jetty Extra Servlet for static resources Motivation There are situation, when you don't want to export your application as a WAR file and have the conventional WAR structure. Or for any other reason you want to avoid using web.xml file. In the following we configure an embedded version of Jetty without using web.xml. The following code should work with Wicket 1.5 and Jetty 8. Configuring Jetty Following is an example of web.xml: "1.0" encoding="ISO-8859-1"?> "http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> myproject wicket.myproject org.apache.wicket.protocol.http.WicketFilter applicationClassName com.mycompany.WicketApplication wicket.myproject /* What we need to do is simply configure embedded Jetty to exhibit the same behaviour in case of missing web.xml Adding Wicket Filter to Jetty server = new Server(); /* Setup server (port, etc.) */ ServletContextHandler sch = new ServletContextHandler(ServletContextHandler.SESSIONS); ServletHolder sh = new ServletHolder(WicketServlet.class); sh.setInitParameter(ContextParamWebApplicationFactory.APP_CLASS_PARAM, WicketApplication.class.getName()); sh.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*"); /* Define a variable DEV_MODE and set to false * if wicket should be used in deployment mode */ if(!DEV_MODE) { sh.setInitParameter("wicket.configuration", "deployment"); } sch.addServlet(sh, "/*"); server.setHandler(sch) The Code above configures Jetty in a manner similar to given web.xml file. Note that we use a ServletHolder which encapsulates both context and class of a servlet. The ServletHolder is then added to ServletContextHandler which as finally added as the only handler to our Jetty Server. Extra Servlet for static resources WicketFilter automatically passes the requests, which it cannot (or does not want to) process down the chain. In that case you can simply define another Servlet and add it to ServletContextHandler. This can be used, for example, if you want to access static data accessible under /static/ folder of your application: // Static resources String staticPath = this.getClass().getClassLoader().getResource("static/").toExternalForm(); ServletHolder resourceServlet = new ServletHolder(DefaultServlet.class); resourceServlet.setInitParameter("dirAllowed", "true"); resourceServlet.setInitParameter("resourceBase", staticPath); resourceServlet.setInitParameter("pathInfoOnly", "true"); Using the following code if you haven't already configured Wicket to handle a request such as localhost:8080/static/js/jquery.js, it will be passed down the handler chain to resourceServlet and it will retrieve the desired file from staticPath. For more init parameters see DefaultServlet Change Notification Preferences View Online | View Changes | Add Comment
[jira] [Resolved] (WICKET-4622) Optimize PageExpiredException to not load its stacktrace
[ https://issues.apache.org/jira/browse/WICKET-4622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Grigorov resolved WICKET-4622. - Resolution: Fixed > Optimize PageExpiredException to not load its stacktrace > > > Key: WICKET-4622 > URL: https://issues.apache.org/jira/browse/WICKET-4622 > Project: Wicket > Issue Type: Improvement > Components: wicket >Affects Versions: 6.0.0-beta2 >Reporter: Martin Grigorov >Assignee: Martin Grigorov > Fix For: 6.0.0-RC1 > > > The stacktrace of PageExpiredException is useless. > It is being thrown at only one place - PageProvider, so it is always the > same. But it is really useless for the end user. > Overriding its #fillInStackTrace() to return null will be a minor performance > improvement. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
git commit: WICKET-4622 Optimize PageExpiredException to not load its stacktrace
Updated Branches: refs/heads/master 842043034 -> 07a0003cf WICKET-4622 Optimize PageExpiredException to not load its stacktrace Remove the 'synchronized' for ReplaceHandlerException because it is not really needed, we just return null. Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/07a0003c Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/07a0003c Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/07a0003c Branch: refs/heads/master Commit: 07a0003cf98053c39eabd66fc1790d68e8069521 Parents: 8420430 Author: Martin Tzvetanov Grigorov Authored: Fri Jun 22 11:54:17 2012 +0300 Committer: Martin Tzvetanov Grigorov Committed: Fri Jun 22 11:54:17 2012 +0300 -- .../wicket/protocol/http/PageExpiredException.java | 17 ++- .../apache/wicket/request/RequestHandlerStack.java |2 +- 2 files changed, 17 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/07a0003c/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java index 186bb3f..14fcc58 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/PageExpiredException.java @@ -33,7 +33,10 @@ import org.apache.wicket.settings.IStoreSettings; * the http session has expired and thus all pages related to this session are erased too * the page instance has been erased because the store size exceeded * - * + * + * This exception is used to tell Wicket to respond with the configured PageExpiredPage, so its + * stacktrace it is not really needed. + * * @see HttpSession#setMaxInactiveInterval(int) * @see IStoreSettings#setMaxSizePerSession(org.apache.wicket.util.lang.Bytes) * @see NotSerializableException @@ -61,4 +64,16 @@ public class PageExpiredException extends WicketRuntimeException { super(message, cause); } + + /** +* Suppress loading of the stacktrace because it is not needed. +* +* @see java.lang.Throwable#fillInStackTrace() +*/ + @Override + public Throwable fillInStackTrace() + { + // don't do anything here + return null; + } } http://git-wip-us.apache.org/repos/asf/wicket/blob/07a0003c/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java -- diff --git a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java index 8a427a5..4267888 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/RequestHandlerStack.java @@ -223,7 +223,7 @@ public abstract class RequestHandlerStack * @see java.lang.Throwable#fillInStackTrace() */ @Override - public synchronized Throwable fillInStackTrace() + public Throwable fillInStackTrace() { // don't do anything here return null;
[jira] [Created] (WICKET-4622) Optimize PageExpiredException to not load its stacktrace
Martin Grigorov created WICKET-4622: --- Summary: Optimize PageExpiredException to not load its stacktrace Key: WICKET-4622 URL: https://issues.apache.org/jira/browse/WICKET-4622 Project: Wicket Issue Type: Improvement Components: wicket Affects Versions: 6.0.0-beta2 Reporter: Martin Grigorov Assignee: Martin Grigorov Fix For: 6.0.0-RC1 The stacktrace of PageExpiredException is useless. It is being thrown at only one place - PageProvider, so it is always the same. But it is really useless for the end user. Overriding its #fillInStackTrace() to return null will be a minor performance improvement. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
git commit: WICKET-4621 Add constructor that accepts IModel for AbstractColumn's header
Updated Branches: refs/heads/master 73daaec32 -> 842043034 WICKET-4621 Add constructor that accepts IModel for AbstractColumn's header Add such constructor for all specializations of AbstractColumn Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/84204303 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/84204303 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/84204303 Branch: refs/heads/master Commit: 8420430347aa320a3b54b0074055d314e72d36f0 Parents: 73daaec Author: Martin Tzvetanov Grigorov Authored: Fri Jun 22 11:43:30 2012 +0300 Committer: Martin Tzvetanov Grigorov Committed: Fri Jun 22 11:43:30 2012 +0300 -- .../ajax/builtin/tree/PropertyEditableColumn.java | 14 ++ .../html/tree/table/AbstractPropertyColumn.java| 20 ++- .../html/tree/table/PropertyRenderableColumn.java | 18 + .../markup/html/tree/table/PropertyTreeColumn.java | 19 ++ 4 files changed, 70 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/84204303/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/tree/PropertyEditableColumn.java -- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/tree/PropertyEditableColumn.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/tree/PropertyEditableColumn.java index 23db08f..28cf09d 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/tree/PropertyEditableColumn.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/tree/PropertyEditableColumn.java @@ -24,6 +24,8 @@ import org.apache.wicket.extensions.markup.html.tree.table.ColumnLocation; import org.apache.wicket.extensions.markup.html.tree.table.IColumn; import org.apache.wicket.extensions.markup.html.tree.table.IRenderable; import org.apache.wicket.extensions.markup.html.tree.table.PropertyRenderableColumn; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; @@ -48,6 +50,18 @@ public class PropertyEditableColumn extends PropertyRenderableColumn */ public PropertyEditableColumn(ColumnLocation location, String header, String propertyExpression) { + this(location, Model.of(header), propertyExpression); + } + + /** +* Column constructor. +* +* @param location +* @param header +* @param propertyExpression +*/ + public PropertyEditableColumn(ColumnLocation location, IModel header, String propertyExpression) + { super(location, header, propertyExpression); } http://git-wip-us.apache.org/repos/asf/wicket/blob/84204303/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractPropertyColumn.java -- diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractPropertyColumn.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractPropertyColumn.java index cdc3fcf..c3a5ac1 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractPropertyColumn.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractPropertyColumn.java @@ -22,8 +22,10 @@ import javax.swing.tree.TreeNode; import org.apache.wicket.Application; import org.apache.wicket.Session; -import org.apache.wicket.util.convert.IConverter; import org.apache.wicket.core.util.lang.PropertyResolver; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.util.convert.IConverter; /** @@ -56,6 +58,22 @@ public abstract class AbstractPropertyColumn extends AbstractColumn public AbstractPropertyColumn(final ColumnLocation location, final String header, final String propertyExpression) { + this(location, Model.of(header), propertyExpression); + } + + /** +* Creates the tree column. +* +* @param location +*Specifies how the column should be aligned and what his size should be +* @param header +*Header caption +* @param propertyExpression +*Expression for property access +*/ + public AbstractPropertyColumn(final ColumnLocation location, final IModel header, + final String propertyExpression) + { super(
[jira] [Resolved] (WICKET-4621) Add constructor that accepts IModel for AbstractColumn's header
[ https://issues.apache.org/jira/browse/WICKET-4621?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Grigorov resolved WICKET-4621. - Resolution: Fixed Fix Version/s: 6.0.0-RC1 > Add constructor that accepts IModel for AbstractColumn's header > --- > > Key: WICKET-4621 > URL: https://issues.apache.org/jira/browse/WICKET-4621 > Project: Wicket > Issue Type: Improvement > Components: wicket-extensions >Affects Versions: 6.0.0-beta2 >Reporter: Martin Grigorov >Assignee: Martin Grigorov > Fix For: 6.0.0-RC1 > > > org.apache.wicket.extensions.markup.html.tree.table.AbstractColumn is > deprecated because of the new Tree implementation but it would be nice if > there is a constructor that accepts IModel for the header. This will > avoid using Component.getString() in a component's constructor -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[1/3] git commit: Fix minor warnings in the IDE
Updated Branches: refs/heads/master 950a8b77e -> 73daaec32 Fix minor warnings in the IDE Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/73daaec3 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/73daaec3 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/73daaec3 Branch: refs/heads/master Commit: 73daaec320d4a48ad55a04a441d500f37b25d142 Parents: f0a782c Author: Martin Tzvetanov Grigorov Authored: Fri Jun 22 11:31:52 2012 +0300 Committer: Martin Tzvetanov Grigorov Committed: Fri Jun 22 11:31:52 2012 +0300 -- .../apache/wicket/session/DefaultPageFactory.java | 10 -- 1 files changed, 4 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/73daaec3/wicket-core/src/main/java/org/apache/wicket/session/DefaultPageFactory.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/session/DefaultPageFactory.java b/wicket-core/src/main/java/org/apache/wicket/session/DefaultPageFactory.java index 15d371c..0d4c7b8 100644 --- a/wicket-core/src/main/java/org/apache/wicket/session/DefaultPageFactory.java +++ b/wicket-core/src/main/java/org/apache/wicket/session/DefaultPageFactory.java @@ -19,7 +19,6 @@ package org.apache.wicket.session; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.apache.wicket.IPageFactory; @@ -38,7 +37,6 @@ import org.slf4j.LoggerFactory; /** * A factory that constructs Pages. * - * @see org.apache.wicket.settings.ISessionSettings#setPageFactory(org.apache.wicket.IPageFactory) * @see IPageFactory * * @author Juergen Donnerstag @@ -55,7 +53,7 @@ public final class DefaultPageFactory implements IPageFactory /** * {@link #isBookmarkable(Class)} is expensive, we cache the result here */ - private final ConcurrentMap pageToBookmarkableCache = new ConcurrentHashMap(); + private final ConcurrentMap pageToBookmarkableCache = Generics.newConcurrentHashMap(); @Override public final Page newPage(final Class pageClass) @@ -64,7 +62,7 @@ public final class DefaultPageFactory implements IPageFactory { // throw an exception in case default constructor is missing // => improved error message - Constructor constructor = pageClass.getConstructor((Class[])null); + Constructor constructor = pageClass.getConstructor((Class[])null); return processPage(newPage(constructor, null), null); } @@ -115,7 +113,7 @@ public final class DefaultPageFactory implements IPageFactory * @return The page constructor, or null if no one-arg constructor can be found taking the given * argument type. */ - private final Constructor constructor(final Class pageClass, + private Constructor constructor(final Class pageClass, final Class argumentType) { // Get constructor for page class from cache @@ -166,7 +164,7 @@ public final class DefaultPageFactory implements IPageFactory * Thrown if the Page cannot be instantiated using the given constructor and * argument. */ - private final Page newPage(final Constructor constructor, final Object argument) + private Page newPage(final Constructor constructor, final Object argument) { try {
[2/3] git commit: WICKET-4621 Add constructor that accepts IModel for AbstractColumn's header
WICKET-4621 Add constructor that accepts IModel for AbstractColumn's header Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/f0a782c5 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/f0a782c5 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/f0a782c5 Branch: refs/heads/master Commit: f0a782c53fc3250f36ee51c9f22fbc5af67a8ab9 Parents: 1695328 Author: Martin Tzvetanov Grigorov Authored: Fri Jun 22 11:31:04 2012 +0300 Committer: Martin Tzvetanov Grigorov Committed: Fri Jun 22 11:31:04 2012 +0300 -- .../markup/html/tree/table/AbstractColumn.java | 18 ++- 1 files changed, 17 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/f0a782c5/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractColumn.java -- diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractColumn.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractColumn.java index 8362d12..d09cf6b 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractColumn.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tree/table/AbstractColumn.java @@ -21,6 +21,8 @@ import javax.swing.tree.TreeNode; import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; /** @@ -33,7 +35,7 @@ public abstract class AbstractColumn implements IColumn { private static final long serialVersionUID = 1L; - private final String header; + private final IModel header; private final ColumnLocation location; @@ -50,6 +52,20 @@ public abstract class AbstractColumn implements IColumn */ public AbstractColumn(final ColumnLocation location, final String header) { + this(location, Model.of(header)); + } + + /** +* Creates the tree column. +* +* @param location +*Specifies how the column should be aligned and what his size should be +* +* @param header +*Header caption +*/ + public AbstractColumn(final ColumnLocation location, final IModel header) + { this.location = location; this.header = header; }
[3/3] git commit: Make a variable constant.
Make a variable constant. Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/16953285 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/16953285 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/16953285 Branch: refs/heads/master Commit: 1695328525e940d4ca4518d1df3275bf0c0d609e Parents: 950a8b7 Author: Martin Tzvetanov Grigorov Authored: Fri Jun 22 00:33:33 2012 +0300 Committer: Martin Tzvetanov Grigorov Committed: Fri Jun 22 00:33:33 2012 +0300 -- .../RestartResponseAtInterceptPageException.java |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/16953285/wicket-core/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java b/wicket-core/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java index df34dcc..cdfa766 100644 --- a/wicket-core/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java +++ b/wicket-core/src/main/java/org/apache/wicket/RestartResponseAtInterceptPageException.java @@ -154,7 +154,7 @@ public class RestartResponseAtInterceptPageException extends ResetResponseExcept } } - private static MetaDataKey key = new MetaDataKey() + private static final MetaDataKey key = new MetaDataKey() { private static final long serialVersionUID = 1L; };
[jira] [Created] (WICKET-4621) Add constructor that accepts IModel for AbstractColumn's header
Martin Grigorov created WICKET-4621: --- Summary: Add constructor that accepts IModel for AbstractColumn's header Key: WICKET-4621 URL: https://issues.apache.org/jira/browse/WICKET-4621 Project: Wicket Issue Type: Improvement Components: wicket-extensions Affects Versions: 6.0.0-beta2 Reporter: Martin Grigorov Assignee: Martin Grigorov org.apache.wicket.extensions.markup.html.tree.table.AbstractColumn is deprecated because of the new Tree implementation but it would be nice if there is a constructor that accepts IModel for the header. This will avoid using Component.getString() in a component's constructor -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira