[jira] [Commented] (WICKET-831) add a setting to make url decoding errors 404 in production mode
[ https://issues.apache.org/jira/browse/WICKET-831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13058493#comment-13058493 ] Martin Grigorov commented on WICKET-831: There is org.apache.wicket.request.http.flow.AbortWithHttpErrorCodeException but I'm not sure I understand the problem completely. When it should be used ? add a setting to make url decoding errors 404 in production mode Key: WICKET-831 URL: https://issues.apache.org/jira/browse/WICKET-831 Project: Wicket Issue Type: New Feature Components: wicket-core Reporter: Jonathan Locke Priority: Minor in a real production environment, you will get crawlers and users poking at urls and when that happens to produce an invalid request it's probably better to 404 the request than throw the current IllegalStateException we throw. we might want to step back and think in general about invalid requests in production versus development mode. i also think i suggested fairly recently that we should add an exception that 404s a request. these two things could work together. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-1085) Input Text Mask
[ https://issues.apache.org/jira/browse/WICKET-1085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13058494#comment-13058494 ] Martin Grigorov commented on WICKET-1085: - There is such component in WicketStuff - https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/mootools-meiomask-parent. it is available in Maven repos. Input Text Mask --- Key: WICKET-1085 URL: https://issues.apache.org/jira/browse/WICKET-1085 Project: Wicket Issue Type: New Feature Components: wicket-extensions Affects Versions: 1.3.0-rc1 Reporter: Will Hoover Assignee: Frank Bille Jensen Priority: Trivial Attachments: inputTextMask.js Allow developers to designate a keystroke input pattern for the input text component. The pattern would be used on the client to control valid keystrokes for the current cursor position within the input text field in relation to the specified pattern. For example, a pattern could be designated as (999)- causing only number values in each position where a 9 appears and using the (, ), and - as masking characters. When the cursor position reached one of these mask characters the cursor position would advance to the next 9 position. The resulting mask would appear as (___)___- within the input text value. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (WICKET-1303) Slash separated URL's cannot have URL parameters with value containing forward slash '/'
[ https://issues.apache.org/jira/browse/WICKET-1303?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Grigorov resolved WICKET-1303. - Resolution: Fixed Fix Version/s: 1.5-RC1 Assignee: Martin Grigorov Already fixed in 1.5. Sample code: new Link(l) { public void onClick() { PageParameters parameters = new PageParameters(); parameters.set(0, a/a1); parameters.set(1, b); setResponsePage(Page2.class, parameters); } } produces: http://localhost:8080/page2/a%2Fa1/b?1 where in MyApp#init() I have: mountPage(page2, Page2.class); Slash separated URL's cannot have URL parameters with value containing forward slash '/' Key: WICKET-1303 URL: https://issues.apache.org/jira/browse/WICKET-1303 Project: Wicket Issue Type: Wish Components: wicket-core Affects Versions: 1.3.0-final Environment: Tomcat 6.0.14, Firefox 2.0.0.11, Windows XP SP2 Reporter: Mika Salminen Assignee: Martin Grigorov Priority: Minor Fix For: 1.5-RC1 There seems to be an issue with URL parameters encoded into path in form /page/param1/val1 with handling parameter values with forward slash ('/'). The slash is correctly URL-encoded to entity '%2F' so that for example parameter key/value pair 'foo' = 'b/a/r' is encoded into url like: '/page/foo/b%2Fa%2Fr'. The problem is that Tomcat returns error or empty page with this url. I tested and researched a little bit and found out that this is Tomcat related issue. In versions = 6.0.10 Tomcat does not allow entities '%2F' and '%5C in path by default so it responds with error (or empty page) when it encounters one of them in URL's path part. More information can be found on http://tomcat.apache.org/security-6.html, under header Fixed in Apache Tomcat 6.0.10. I tried according to the document to turn system property org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH to true, to allow encoded slashes in path, and got the request with '%2F' in path through. I think that PageParameters in wicket should be easy to use, so that user does not have to worry about the contents of the parameter, so something should be done to this issue. I managed to get around this issue by double encoding the parameter values with URLEncoder. I encoded the PageParameter map parameter values with URLEncoder and replaced all occurences of '%' in resulting text with '=' before passing it forward. So only entity that is left to be encoded by the framework (AbstractRequestTargetUrlCodingStrategy) is '=' which becomes %3D so foo = b/a/r becomes encoded in URL like: /page/foo/b%3D2Fa%3D2Fr. Decoding of URL is done by opposite operation sequence: framework decodes the parameter for me to form b=2Fa=2Fr and after that I replace '=' with '%' and the replaced string is further decoded with URLDecoder. Not very beautiful solution but seems to work as a quick fix and leaves non-special characters unaffected. As a little downside two extra characters are needed to encode every special character. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-2659) Improve exception handling with dynamically instantiated ErrorExceptionPage
[ https://issues.apache.org/jira/browse/WICKET-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13058562#comment-13058562 ] Martin Grigorov commented on WICKET-2659: - I'm -1 for this approach. All this is possible with org.apache.wicket.request.cycle.IRequestCycleListener.onException(RequestCycle, Exception). Here the user can return RenderPageRequestHandler(new PageProvider(new MyErrorPage(exception))). Wicket currently shows an error page with the exception stack in DEV mode, and hides the stacktrace in PRODUCTION mode which is the sane default. Any other desired behavior can be accomplished with the approach above. It is very flexible. Improve exception handling with dynamically instantiated ErrorExceptionPage --- Key: WICKET-2659 URL: https://issues.apache.org/jira/browse/WICKET-2659 Project: Wicket Issue Type: Improvement Components: wicket-core Affects Versions: 1.4.5, 1.4.6, 1.5-M1 Reporter: Ilja Pavkovic Attachments: WICKET-2659.patch Original Estimate: 4h Remaining Estimate: 4h based on the discussion at http://old.nabble.com/error-page-td26968559.html I introduced the concept of a dynamically instantiated errorpage. If one uses a customized error page with getApplicationSettings().setInternalErrorPage(MyErrorPage.class); getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE); neither the exception nor the responsePage can be accessed. Analogous the handling of Pages with PageParameters the request cycle tries to find and use a constructor like public MyErrorPage(final Throwable throwable, final Page page) { .. } If this constructor is not found, wicket uses public MyErrorPage() { ...} as fallback. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (WICKET-3855) Problem scavenging sessions with Jetty and Wicket 1.5
[ https://issues.apache.org/jira/browse/WICKET-3855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Grigorov reassigned WICKET-3855: --- Assignee: Martin Grigorov Problem scavenging sessions with Jetty and Wicket 1.5 - Key: WICKET-3855 URL: https://issues.apache.org/jira/browse/WICKET-3855 Project: Wicket Issue Type: Bug Components: wicket-core Affects Versions: 1.5-RC5.1 Reporter: Adriano dos Santos Fernandes Assignee: Martin Grigorov When Jetty starts and see some invalid persisted session, it tries to unbound it. But Wicket then start to throw errors. I suppose there is a need to use ThreadContext.set(this) in some place like Application.sessionUnbound. Problem scavenging sessions org.apache.wicket.WicketRuntimeException: There is no application attached to current thread Timer-0 at org.apache.wicket.Application.get(Application.java:229) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.DefaultPageManagerProvider.getStoreSettings(DefaultPageManagerProvider.java:78) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.DefaultPageManagerProvider.newDataStore(DefaultPageManagerProvider.java:67) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.DefaultPageManagerProvider.get(DefaultPageManagerProvider.java:52) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.DefaultPageManagerProvider.get(DefaultPageManagerProvider.java:36) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.Application.internalGetPageManager(Application.java:1328) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.Application.sessionUnbound(Application.java:473) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.protocol.http.WebApplication.sessionUnbound(WebApplication.java:445) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.session.HttpSessionStore$SessionBindingListener.valueUnbound(HttpSessionStore.java:415) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.mortbay.jetty.servlet.AbstractSessionManager$Session.unbindValue(AbstractSessionManager.java:1129) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.AbstractSessionManager$Session.doInvalidate(AbstractSessionManager.java:969) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.AbstractSessionManager$Session.timeout(AbstractSessionManager.java:928) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.HashSessionManager.scavenge(HashSessionManager.java:269) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.HashSessionManager.access$000(HashSessionManager.java:44) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.HashSessionManager$2.run(HashSessionManager.java:213) [jetty-6.1.11.jar:6.1.11] at java.util.TimerThread.mainLoop(Timer.java:512) [na:1.6.0_26] at java.util.TimerThread.run(Timer.java:462) [na:1.6.0_26] -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
svn commit: r1141960 - /wicket/trunk/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java
Author: mgrigorov Date: Fri Jul 1 15:14:20 2011 New Revision: 1141960 URL: http://svn.apache.org/viewvc?rev=1141960view=rev Log: WICKET-3855 Problem scavenging sessions with Jetty and Wicket 1.5 Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java?rev=1141960r1=1141959r2=1141960view=diff == --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java Fri Jul 1 15:14:20 2011 @@ -82,6 +82,6 @@ public class DefaultPageManagerProvider IStoreSettings getStoreSettings() { - return Application.get().getStoreSettings(); + return application.getStoreSettings(); } } \ No newline at end of file
[jira] [Resolved] (WICKET-3855) Problem scavenging sessions with Jetty and Wicket 1.5
[ https://issues.apache.org/jira/browse/WICKET-3855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Grigorov resolved WICKET-3855. - Resolution: Fixed Fix Version/s: 1.5-RC6 Thanks! Problem scavenging sessions with Jetty and Wicket 1.5 - Key: WICKET-3855 URL: https://issues.apache.org/jira/browse/WICKET-3855 Project: Wicket Issue Type: Bug Components: wicket-core Affects Versions: 1.5-RC5.1 Reporter: Adriano dos Santos Fernandes Assignee: Martin Grigorov Fix For: 1.5-RC6 When Jetty starts and see some invalid persisted session, it tries to unbound it. But Wicket then start to throw errors. I suppose there is a need to use ThreadContext.set(this) in some place like Application.sessionUnbound. Problem scavenging sessions org.apache.wicket.WicketRuntimeException: There is no application attached to current thread Timer-0 at org.apache.wicket.Application.get(Application.java:229) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.DefaultPageManagerProvider.getStoreSettings(DefaultPageManagerProvider.java:78) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.DefaultPageManagerProvider.newDataStore(DefaultPageManagerProvider.java:67) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.DefaultPageManagerProvider.get(DefaultPageManagerProvider.java:52) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.DefaultPageManagerProvider.get(DefaultPageManagerProvider.java:36) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.Application.internalGetPageManager(Application.java:1328) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.Application.sessionUnbound(Application.java:473) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.protocol.http.WebApplication.sessionUnbound(WebApplication.java:445) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.apache.wicket.session.HttpSessionStore$SessionBindingListener.valueUnbound(HttpSessionStore.java:415) [wicket-core-1.5-RC5.1.jar:1.5-RC5.1] at org.mortbay.jetty.servlet.AbstractSessionManager$Session.unbindValue(AbstractSessionManager.java:1129) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.AbstractSessionManager$Session.doInvalidate(AbstractSessionManager.java:969) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.AbstractSessionManager$Session.timeout(AbstractSessionManager.java:928) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.HashSessionManager.scavenge(HashSessionManager.java:269) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.HashSessionManager.access$000(HashSessionManager.java:44) [jetty-6.1.11.jar:6.1.11] at org.mortbay.jetty.servlet.HashSessionManager$2.run(HashSessionManager.java:213) [jetty-6.1.11.jar:6.1.11] at java.util.TimerThread.mainLoop(Timer.java:512) [na:1.6.0_26] at java.util.TimerThread.run(Timer.java:462) [na:1.6.0_26] -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Created] (WICKET-3856) Relax wicket:enclosure warning suggesting the usage of EnclosureContainer
Relax wicket:enclosure warning suggesting the usage of EnclosureContainer - Key: WICKET-3856 URL: https://issues.apache.org/jira/browse/WICKET-3856 Project: Wicket Issue Type: Improvement Components: wicket-core Reporter: Adriano dos Santos Fernandes Sometime in 1.4, wicket:enclosure got some diagnostics warnings about FormComponents and EnclosureContainer was added. wicket:enclosure has two usages: --- 1) Hide some content based on its own child components, i.e.: wicket:enclosure child=x div input wicket:id=x / /div /wicket:enclosure 2) Hide content based on non-child components, i.e.: wicket:enclosure child=x /wicket:enclosure input wicket:id=x / --- It's safe to relax the warning for the case (1), when the only FormComponent child is equal to the wicket:enclosure child attribute. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WICKET-831) add a setting to make url decoding errors 404 in production mode
[ https://issues.apache.org/jira/browse/WICKET-831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13058641#comment-13058641 ] Igor Vaynberg commented on WICKET-831: -- any time there is a problem decoding a url we should throw 404. for example in 1.4 if a page is mounted on /foo and the user hits /foo/bar there is an error decoding the url because wicket expects 3 path parameters, the mount, parameter name (bar) and parameter value which is not in the url. since wicket cant parse the url it will throw an illegalstateexception which results in the wicket error page. instead, it should abort with a 404 so the browser knows this is an illegal url. add a setting to make url decoding errors 404 in production mode Key: WICKET-831 URL: https://issues.apache.org/jira/browse/WICKET-831 Project: Wicket Issue Type: New Feature Components: wicket-core Reporter: Jonathan Locke Priority: Minor in a real production environment, you will get crawlers and users poking at urls and when that happens to produce an invalid request it's probably better to 404 the request than throw the current IllegalStateException we throw. we might want to step back and think in general about invalid requests in production versus development mode. i also think i suggested fairly recently that we should add an exception that 404s a request. these two things could work together. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (WICKET-2659) Improve exception handling with dynamically instantiated ErrorExceptionPage
[ https://issues.apache.org/jira/browse/WICKET-2659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Igor Vaynberg resolved WICKET-2659. --- Resolution: Won't Fix Assignee: Igor Vaynberg indeed, in 1.5 this is simple with a request cycle listener Improve exception handling with dynamically instantiated ErrorExceptionPage --- Key: WICKET-2659 URL: https://issues.apache.org/jira/browse/WICKET-2659 Project: Wicket Issue Type: Improvement Components: wicket-core Affects Versions: 1.4.5, 1.4.6, 1.5-M1 Reporter: Ilja Pavkovic Assignee: Igor Vaynberg Attachments: WICKET-2659.patch Original Estimate: 4h Remaining Estimate: 4h based on the discussion at http://old.nabble.com/error-page-td26968559.html I introduced the concept of a dynamically instantiated errorpage. If one uses a customized error page with getApplicationSettings().setInternalErrorPage(MyErrorPage.class); getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE); neither the exception nor the responsePage can be accessed. Analogous the handling of Pages with PageParameters the request cycle tries to find and use a constructor like public MyErrorPage(final Throwable throwable, final Page page) { .. } If this constructor is not found, wicket uses public MyErrorPage() { ...} as fallback. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (WICKET-3856) Relax wicket:enclosure warning suggesting the usage of EnclosureContainer
[ https://issues.apache.org/jira/browse/WICKET-3856?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Igor Vaynberg reassigned WICKET-3856: - Assignee: Igor Vaynberg Relax wicket:enclosure warning suggesting the usage of EnclosureContainer - Key: WICKET-3856 URL: https://issues.apache.org/jira/browse/WICKET-3856 Project: Wicket Issue Type: Improvement Components: wicket-core Reporter: Adriano dos Santos Fernandes Assignee: Igor Vaynberg Sometime in 1.4, wicket:enclosure got some diagnostics warnings about FormComponents and EnclosureContainer was added. wicket:enclosure has two usages: --- 1) Hide some content based on its own child components, i.e.: wicket:enclosure child=x div input wicket:id=x / /div /wicket:enclosure 2) Hide content based on non-child components, i.e.: wicket:enclosure child=x /wicket:enclosure input wicket:id=x / --- It's safe to relax the warning for the case (1), when the only FormComponent child is equal to the wicket:enclosure child attribute. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
svn commit: r1142096 - in /wicket/trunk: wicket-request/src/main/java/org/apache/wicket/request/ wicket-util/src/main/java/org/apache/wicket/util/date/ wicket-util/src/main/java/org/apache/wicket/util
Author: pete Date: Fri Jul 1 21:23:17 2011 New Revision: 1142096 URL: http://svn.apache.org/viewvc?rev=1142096view=rev Log: moved functionality for rfc 1123 timestamp strings into Time class (one single method in one utility class is not that pretty) Removed: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/date/RFC1123DateFormatter.java Modified: wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java Modified: wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java?rev=1142096r1=1142095r2=1142096view=diff == --- wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java (original) +++ wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java Fri Jul 1 21:23:17 2011 @@ -26,7 +26,6 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import org.apache.wicket.util.date.RFC1123DateFormatter; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.time.Time; @@ -161,7 +160,7 @@ public class HttpHeaderCollection { if (value instanceof Time) { - return RFC1123DateFormatter.formatDate((Time)value); + return ((Time)value).toRfc1123DateString(); } else { Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java?rev=1142096r1=1142095r2=1142096view=diff == --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java Fri Jul 1 21:23:17 2011 @@ -20,7 +20,9 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; +import java.util.GregorianCalendar; import java.util.Locale; +import java.util.TimeZone; /** * An immutable codeTime/code class that represents a specific point in time. The underlying @@ -47,6 +49,17 @@ public final class Time extends Abstract private static final SimpleDateFormat dateTimeFormat = new SimpleDateFormat(.MM.dd-h.mma, Locale.ENGLISH); + /** required for rfc1123 date format */ + private static final String[] DAYS = + {Sat, Sun, Mon, Tue, Wed, Thu, Fri, Sat}; + + /** required for rfc1123 date format */ + private static final String[] MONTHS = + {Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, Jan}; + + /** time zone for greenwich mean time */ + public static final TimeZone GMT = TimeZone.getTimeZone(GMT); + /** * Retrieves a codeTime/code instance based on the current time. * @@ -552,4 +565,63 @@ public final class Time extends Abstract { return toString(null, format); } + + /** +* return timestamp string in RFC1123 format +* p/ +* Contrary to {@link java.text.SimpleDateFormat} this is thread-safe. +* p/ +* taken from the source code of jetty 7.3.0, credits + thanks to Greg Wilkins! +*/ + public String toRfc1123DateString() + { + final Calendar cal = GregorianCalendar.getInstance(GMT); + final StringBuilder buf = new StringBuilder(32); + + cal.setTimeInMillis(getMilliseconds()); + + int day_of_week = cal.get(Calendar.DAY_OF_WEEK); + int day_of_month = cal.get(Calendar.DAY_OF_MONTH); + int month = cal.get(Calendar.MONTH); + int year = cal.get(Calendar.YEAR); + int century = year / 100; + year = year % 100; + + int hours = cal.get(Calendar.HOUR_OF_DAY); + int minutes = cal.get(Calendar.MINUTE); + int seconds = cal.get(Calendar.SECOND); + + buf.append(DAYS[day_of_week]); + buf.append(','); + buf.append(' '); + appendTwoDigits(buf, day_of_month); + + buf.append(' '); + buf.append(MONTHS[month]); + buf.append(' '); + appendTwoDigits(buf, century); + appendTwoDigits(buf, year); + + buf.append(' '); + appendTwoDigits(buf, hours); + buf.append(':'); + appendTwoDigits(buf, minutes); +
svn commit: r1142100 - in /wicket/trunk: wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java wicket-util/src/main/java/org/apache/wicket/util/time/Time.java
Author: pete Date: Fri Jul 1 21:27:10 2011 New Revision: 1142100 URL: http://svn.apache.org/viewvc?rev=1142100view=rev Log: better naming Modified: wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java Modified: wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java?rev=1142100r1=1142099r2=1142100view=diff == --- wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java (original) +++ wicket/trunk/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java Fri Jul 1 21:27:10 2011 @@ -160,7 +160,7 @@ public class HttpHeaderCollection { if (value instanceof Time) { - return ((Time)value).toRfc1123DateString(); + return ((Time)value).toRfc1123TimestampString(); } else { Modified: wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java?rev=1142100r1=1142099r2=1142100view=diff == --- wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java (original) +++ wicket/trunk/wicket-util/src/main/java/org/apache/wicket/util/time/Time.java Fri Jul 1 21:27:10 2011 @@ -573,7 +573,7 @@ public final class Time extends Abstract * p/ * taken from the source code of jetty 7.3.0, credits + thanks to Greg Wilkins! */ - public String toRfc1123DateString() + public String toRfc1123TimestampString() { final Calendar cal = GregorianCalendar.getInstance(GMT); final StringBuilder buf = new StringBuilder(32); @@ -614,7 +614,7 @@ public final class Time extends Abstract } /** -* helper method for {@link #toRfc1123DateString()} +* helper method for {@link #toRfc1123TimestampString()} * * @param str * @param number
svn commit: r1142107 - in /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket: markup/html/form/FormComponent.java validation/IModelAwareValidatable.java
Author: ivaynberg Date: Fri Jul 1 22:20:47 2011 New Revision: 1142107 URL: http://svn.apache.org/viewvc?rev=1142107view=rev Log: Issue: WICKET-3857 Added: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java (with props) Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java?rev=1142107r1=1142106r2=1142107view=diff == --- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java (original) +++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java Fri Jul 1 22:20:47 2011 @@ -44,6 +44,7 @@ import org.apache.wicket.util.string.Str import org.apache.wicket.util.string.Strings; import org.apache.wicket.util.string.interpolator.MapVariableInterpolator; import org.apache.wicket.validation.IErrorMessageSource; +import org.apache.wicket.validation.IModelAwareValidatable; import org.apache.wicket.validation.INullAcceptingValidator; import org.apache.wicket.validation.IValidatable; import org.apache.wicket.validation.IValidationError; @@ -325,7 +326,7 @@ public abstract class FormComponentT e * * @author ivaynberg */ - private class ValidatableAdapter implements IValidatableT + private class ValidatableAdapter implements IModelAwareValidatableT { /** * @see org.apache.wicket.validation.IValidatable#error(org.apache.wicket.validation.IValidationError) @@ -350,6 +351,11 @@ public abstract class FormComponentT e { return FormComponent.this.isValid(); } + + public IModelT getModel() + { + return FormComponent.this.getModel(); + } } /** Added: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java?rev=1142107view=auto == --- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java (added) +++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java Fri Jul 1 22:20:47 2011 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.validation; + +import org.apache.wicket.model.IModel; + +/** + * Validatable extension that allows access to component's model. This extension is implemented by + * default but exists as a separate interface for backwards compatibility. + * + * NOTE: in Wicket 1.5 {@link #getModel()} is implemented directly in {@link IValidatable} + * + * @author igor + * @param T + */ +public interface IModelAwareValidatableT extends IValidatableT +{ + /** +* Gets the model of the component being validated +* +* @return model of component +*/ + IModelT getModel(); +} Propchange: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/validation/IModelAwareValidatable.java -- svn:mime-type = text/plain
[jira] [Created] (WICKET-3857) Allow validators access to component's model, see IModelAwareValidatable#getModel()
Allow validators access to component's model, see IModelAwareValidatable#getModel() --- Key: WICKET-3857 URL: https://issues.apache.org/jira/browse/WICKET-3857 Project: Wicket Issue Type: New Feature Reporter: Igor Vaynberg Fix For: 1.4.18, 1.5-RC6 sometimes it is useful for validators to get access to component's model. for example a) validators can use the model to get value as it was before editing started - ie a password validator that forces the user to change their password b) validators can access some metadata about the model - ie a model that implements IPropertyReflectionAwareModel -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
svn commit: r1142108 - in /wicket/trunk/wicket-core/src: main/java/org/apache/wicket/markup/html/form/ main/java/org/apache/wicket/validation/ test/java/org/apache/wicket/validation/
Author: ivaynberg Date: Fri Jul 1 22:24:58 2011 New Revision: 1142108 URL: http://svn.apache.org/viewvc?rev=1142108view=rev Log: Issue: WICKET-3857 Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/validation/Validatable.java (with props) Removed: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/validation/Validatable.java Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java wicket/trunk/wicket-core/src/main/java/org/apache/wicket/validation/IValidatable.java Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java?rev=1142108r1=1142107r2=1142108view=diff == --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java Fri Jul 1 22:24:58 2011 @@ -301,6 +301,11 @@ public abstract class FormComponentT e { return FormComponent.this.isValid(); } + + public IModelT getModel() + { + return FormComponent.this.getModel(); + } } /** Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/validation/IValidatable.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/validation/IValidatable.java?rev=1142108r1=1142107r2=1142108view=diff == --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/validation/IValidatable.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/validation/IValidatable.java Fri Jul 1 22:24:58 2011 @@ -16,6 +16,8 @@ */ package org.apache.wicket.validation; +import org.apache.wicket.model.IModel; + /** * Interface representing any object that can be validated. @@ -51,4 +53,11 @@ public interface IValidatableT * @return codetrue/code if the object is in a valid state, codefalse/code if otherwise */ boolean isValid(); + + /** +* Returns the model of the component being validated +* +* @return component's model +*/ + IModelT getModel(); } Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/validation/Validatable.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/validation/Validatable.java?rev=1142108view=auto == --- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/validation/Validatable.java (added) +++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/validation/Validatable.java Fri Jul 1 22:24:58 2011 @@ -0,0 +1,157 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.validation; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.wicket.model.IModel; + +/** + * This implementation of {@link IValidatable} is meant to be used outside of Wicket. It allows + * other parts of the application to utilize {@link IValidator}s for validation. + * p + * Example: codepre + * class WebService + * { + * public void addUser(String firstName, String lastName) + * { + * Validatable standin = new Validatable(); + * standin.setValue(firstName); + * new FirstNameValidator().validate(standin); + * standing.setValue(lastName); + * new LastNameValidator().validate(standin); + * if (!standin.isValid()) + * { + * // roll your own ValidationException + * throw new ValidationException(standin.getErrors()); + * } + * else + * { + * // add user here + * } + * } + * } +
[jira] [Updated] (WICKET-3857) Allow validators access to component's model
[ https://issues.apache.org/jira/browse/WICKET-3857?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Igor Vaynberg updated WICKET-3857: -- Description: sometimes it is useful for validators to get access to component's model. for example a) validators can use the model to get value as it was before editing started - ie a password validator that forces the user to change their password b) validators can access some metadata about the model - ie a model that implements IPropertyReflectionAwareModel in 1.4 this is done by adding a IModelAwareValidatable#getModel() mixin and casting IValidatable down to it. in 1.5 #getModel() has been introduced direction to IValidatable was: sometimes it is useful for validators to get access to component's model. for example a) validators can use the model to get value as it was before editing started - ie a password validator that forces the user to change their password b) validators can access some metadata about the model - ie a model that implements IPropertyReflectionAwareModel in 1.4 this is done b adding a IModelAwareValidatable#getModel() mixin and casting IValidatable down to it. in 1.5 #getModel() has been introduced direction to IValidatable Allow validators access to component's model Key: WICKET-3857 URL: https://issues.apache.org/jira/browse/WICKET-3857 Project: Wicket Issue Type: New Feature Reporter: Igor Vaynberg Fix For: 1.4.18, 1.5-RC6 sometimes it is useful for validators to get access to component's model. for example a) validators can use the model to get value as it was before editing started - ie a password validator that forces the user to change their password b) validators can access some metadata about the model - ie a model that implements IPropertyReflectionAwareModel in 1.4 this is done by adding a IModelAwareValidatable#getModel() mixin and casting IValidatable down to it. in 1.5 #getModel() has been introduced direction to IValidatable -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (WICKET-3857) Allow validators access to component's model
[ https://issues.apache.org/jira/browse/WICKET-3857?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Igor Vaynberg resolved WICKET-3857. --- Resolution: Fixed Assignee: Igor Vaynberg Allow validators access to component's model Key: WICKET-3857 URL: https://issues.apache.org/jira/browse/WICKET-3857 Project: Wicket Issue Type: New Feature Reporter: Igor Vaynberg Assignee: Igor Vaynberg Fix For: 1.4.18, 1.5-RC6 sometimes it is useful for validators to get access to component's model. for example a) validators can use the model to get value as it was before editing started - ie a password validator that forces the user to change their password b) validators can access some metadata about the model - ie a model that implements IPropertyReflectionAwareModel in 1.4 this is done by adding a IModelAwareValidatable#getModel() mixin and casting IValidatable down to it. in 1.5 #getModel() has been introduced direction to IValidatable -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira
svn commit: r1142147 - /wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/Validatable.java
Author: ivaynberg Date: Sat Jul 2 02:41:47 2011 New Revision: 1142147 URL: http://svn.apache.org/viewvc?rev=1142147view=rev Log: checked in missing test harness class Added: wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/Validatable.java (with props) Added: wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/Validatable.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/Validatable.java?rev=1142147view=auto == --- wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/Validatable.java (added) +++ wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/Validatable.java Sat Jul 2 02:41:47 2011 @@ -0,0 +1,160 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the License); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.extensions.validation; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.wicket.model.IModel; +import org.apache.wicket.validation.IValidatable; +import org.apache.wicket.validation.IValidationError; +import org.apache.wicket.validation.IValidator; + +/** + * This implementation of {@link IValidatable} is meant to be used outside of Wicket. It allows + * other parts of the application to utilize {@link IValidator}s for validation. + * p + * Example: codepre + * class WebService + * { + * public void addUser(String firstName, String lastName) + * { + * Validatable standin = new Validatable(); + * standin.setValue(firstName); + * new FirstNameValidator().validate(standin); + * standing.setValue(lastName); + * new LastNameValidator().validate(standin); + * if (!standin.isValid()) + * { + * // roll your own ValidationException + * throw new ValidationException(standin.getErrors()); + * } + * else + * { + * // add user here + * } + * } + * } + * /pre/code + * + * @author Igor Vaynberg (ivaynberg) + * @param T + *type of validatable + * @since 1.2.6 + */ +public class ValidatableT implements IValidatableT +{ + /** the value object */ + private T value; + + /** the list of errors */ + private ArrayListIValidationError errors; + + private IModelT model; + + /** +* Constructor. +*/ + public Validatable() + { + } + + /** +* Constructor. +* +* @param value +*The value that will be tested +*/ + public Validatable(T value) + { + this.value = value; + } + + /** +* Sets model +* +* @param model +*/ + public void setModel(IModelT model) + { + this.model = model; + } + + /** +* Sets the value object that will be returned by {@link #getValue()}. +* +* @param value +*the value object +*/ + public void setValue(T value) + { + this.value = value; + } + + /** +* @see IValidatable#getValue() +*/ + public T getValue() + { + return value; + } + + /** +* @see IValidatable#error(IValidationError) +*/ + public void error(IValidationError error) + { + if (errors == null) + { + errors = new ArrayListIValidationError(); + } + errors.add(error); + } + + /** +* Retrieves an unmodifiable list of any errors reported against this codeIValidatable/code +* instance. +* +* @return an unmodifiable list of errors +*/ + public ListIValidationError getErrors() + { + if (errors == null) + { + return Collections.emptyList(); + } + else
svn commit: r1142149 - /wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/validator/RfcCompliantEmailValidatorTest.java
Author: ivaynberg Date: Sat Jul 2 03:11:03 2011 New Revision: 1142149 URL: http://svn.apache.org/viewvc?rev=1142149view=rev Log: fix import Modified: wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/validator/RfcCompliantEmailValidatorTest.java Modified: wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/validator/RfcCompliantEmailValidatorTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/validator/RfcCompliantEmailValidatorTest.java?rev=1142149r1=1142148r2=1142149view=diff == --- wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/validator/RfcCompliantEmailValidatorTest.java (original) +++ wicket/trunk/wicket-extensions/src/test/java/org/apache/wicket/extensions/validation/validator/RfcCompliantEmailValidatorTest.java Sat Jul 2 03:11:03 2011 @@ -18,8 +18,8 @@ package org.apache.wicket.extensions.val import junit.framework.TestCase; +import org.apache.wicket.extensions.validation.Validatable; import org.apache.wicket.validation.IValidator; -import org.apache.wicket.validation.Validatable; /** * Test that it really validates RFC valid email addresses.
[jira] [Created] (WICKET-3858) AsynchronousDataStore needs to stop - make thread a daemon
AsynchronousDataStore needs to stop - make thread a daemon --- Key: WICKET-3858 URL: https://issues.apache.org/jira/browse/WICKET-3858 Project: Wicket Issue Type: Bug Components: wicket-core Affects Versions: 1.5-RC5.1 Environment: ant based test environment Reporter: Richard Emberson Priority: Minor I don't know how most run the unit tests, but in my ant-base testing environment, the AsynchronousDataStore thread does not stop and so the testing JVM does not exit. Consider changing: new Thread(savingRunnable, Wicket-PageSavingThread).start(); to Thread t = new Thread(savingRunnable, Wicket-PageSavingThread); t.setDaemon(true); t.start(); -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira