Also, I'm curious to see how this is going to play with Tapestry's many per-thread services and implicit assumptions, that there is only one thread per request.
Uli On 16.04.2013 15:30, Ulrich Stärk wrote: > This is going to be lovely with JSR-356 not being finalized yet and > vendor-specific implementations... > > Uli > > On 16.04.2013 14:46, Massimo Lusetti wrote: >> Cometd will be backed up by WebSocket right? >> >> >> On Tue, Apr 16, 2013 at 12:47 PM, Howard Lewis Ship <hls...@gmail.com>wrote: >> >>> Thanks! >>> >>> I wanted a nice clean build before I started in on adding cometd support. >>> I have some exciting ideas that leverage options made available through >>> Plastic. >>> >>> >>> On Tue, Apr 16, 2013 at 4:44 AM, Kalle Korhonen >>> <kalle.o.korho...@gmail.com>wrote: >>> >>>> On it.. meant to take a look at the test failures anyway. >>>> >>>> Kalle >>>> >>>> >>>> On Mon, Apr 15, 2013 at 7:51 PM, Howard Lewis Ship <hls...@gmail.com> >>>> wrote: >>>> >>>>> looks like tests related to this change are failing on jenkins >>>>> >>>>> On Sunday, April 14, 2013, wrote: >>>>> >>>>>> Updated Branches: >>>>>> refs/heads/master d3e9f1d95 -> cb95e2236 >>>>>> >>>>>> >>>>>> FIXED - TAP5-2101: BeanEditor should always provide a new >>>>>> BeanValidationContext (JSR-303) >>>>>> - apply Luca Menegus' patch with minor changes >>>>>> >>>>>> >>>>>> Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo >>>>>> Commit: >>>>> http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/cb95e223 >>>>>> Tree: >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/cb95e223 >>>>>> Diff: >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/cb95e223 >>>>>> >>>>>> Branch: refs/heads/master >>>>>> Commit: cb95e2236873b497211427e89f96e54282919e19 >>>>>> Parents: d3e9f1d >>>>>> Author: kaosko <kao...@apache.org <javascript:;>> >>>>>> Authored: Sat Apr 13 22:11:33 2013 -0700 >>>>>> Committer: kaosko <kao...@apache.org <javascript:;>> >>>>>> Committed: Sat Apr 13 22:11:33 2013 -0700 >>>>>> >>>>>> >>> ---------------------------------------------------------------------- >>>>>> .../TapestryBeanValidationIntegrationTests.java | 14 +++++ >>>>>> .../org/example/testapp/entities/ComplexBean.java | 44 >>>>> +++++++++++++++ >>>>>> .../testapp/entities/SomeOtherSimpleBean.java | 21 +++++++ >>>>>> .../example/testapp/entities/SomeSimpleBean.java | 21 +++++++ >>>>>> .../org/example/testapp/pages/ComplexBeanDemo.java | 14 +++++ >>>>>> .../src/test/webapp/ComplexBeanDemo.tml | 19 ++++++ >>>>>> tapestry-beanvalidator/src/test/webapp/Index.tml | 3 + >>>>>> .../tapestry5/corelib/components/BeanEditor.java | 24 ++++---- >>>>>> 8 files changed, 148 insertions(+), 12 deletions(-) >>>>>> >>> ---------------------------------------------------------------------- >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb95e223/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java >>>>>> >>> ---------------------------------------------------------------------- >>>>>> diff --git >>>>>> >>>>> >>>> >>> a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java >>>>>> index 29b50bf..248c24e 100644 >>>>>> --- >>>>>> >>>>> >>>> >>> a/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java >>>>>> +++ >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/apache/tapestry5/beanvalidator/integration/TapestryBeanValidationIntegrationTests.java >>>>>> @@ -216,4 +216,18 @@ public class >>>> TapestryBeanValidationIntegrationTests >>>>>> extends SeleniumTestCase >>>>>> assertTextPresent("Login Name size must be between 7 and >>> 10", >>>>>> "Login Name must match \"[0-9]+\""); >>>>>> } >>>>>> >>>>>> + @Test >>>>>> + public void beaneditor_validation() throws Exception >>>>>> + { >>>>>> + openLinks("ComplexBean Demo"); >>>>>> + >>>>>> + // Test JSR-303 validator >>>>>> + >>>>>> + clickAndWait(SUBMIT); >>>>>> + >>>>>> + assertTextPresent("Simple Not Null Property may not be >>> null", >>>>>> + "Min Value must be greater than or equal to 6", "Not >>>>> Null >>>>>> String may not be null"); >>>>>> + } >>>>>> + >>>>>> + >>>>>> } >>>>>> \ No newline at end of file >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb95e223/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/ComplexBean.java >>>>>> >>> ---------------------------------------------------------------------- >>>>>> diff --git >>>>>> >>>>> >>>> >>> a/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/ComplexBean.java >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/ComplexBean.java >>>>>> new file mode 100644 >>>>>> index 0000000..beaa840 >>>>>> --- /dev/null >>>>>> +++ >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/ComplexBean.java >>>>>> @@ -0,0 +1,44 @@ >>>>>> +package org.example.testapp.entities; >>>>>> + >>>>>> +import javax.validation.constraints.NotNull; >>>>>> + >>>>>> +public class ComplexBean >>>>>> +{ >>>>>> + >>>>>> + private SomeSimpleBean someSimpleBean; >>>>>> + private SomeOtherSimpleBean someOtherSimpleBean; >>>>>> + >>>>>> + @NotNull >>>>>> + private String simpleNotNullProperty; >>>>>> + >>>>>> + public SomeSimpleBean getSomeSimpleBean() >>>>>> + { >>>>>> + return someSimpleBean; >>>>>> + } >>>>>> + >>>>>> + public void setSomeSimpleBean(SomeSimpleBean someSimpleBean) >>>>>> + { >>>>>> + this.someSimpleBean = someSimpleBean; >>>>>> + } >>>>>> + >>>>>> + public SomeOtherSimpleBean getSomeOtherSimpleBean() >>>>>> + { >>>>>> + return someOtherSimpleBean; >>>>>> + } >>>>>> + >>>>>> + public void setSomeOtherSimpleBean(SomeOtherSimpleBean >>>>>> someOtherSimpleBean) >>>>>> + { >>>>>> + this.someOtherSimpleBean = someOtherSimpleBean; >>>>>> + } >>>>>> + >>>>>> + public String getSimpleNotNullProperty() >>>>>> + { >>>>>> + return simpleNotNullProperty; >>>>>> + } >>>>>> + >>>>>> + public void setSimpleNotNullProperty(String >>> simpleNotNullProperty) >>>>>> + { >>>>>> + this.simpleNotNullProperty = simpleNotNullProperty; >>>>>> + } >>>>>> + >>>>>> +} >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb95e223/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/SomeOtherSimpleBean.java >>>>>> >>> ---------------------------------------------------------------------- >>>>>> diff --git >>>>>> >>>>> >>>> >>> a/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/SomeOtherSimpleBean.java >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/SomeOtherSimpleBean.java >>>>>> new file mode 100644 >>>>>> index 0000000..9a262f3 >>>>>> --- /dev/null >>>>>> +++ >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/SomeOtherSimpleBean.java >>>>>> @@ -0,0 +1,21 @@ >>>>>> +package org.example.testapp.entities; >>>>>> + >>>>>> +import javax.validation.constraints.NotNull; >>>>>> + >>>>>> +public class SomeOtherSimpleBean >>>>>> +{ >>>>>> + >>>>>> + @NotNull >>>>>> + private String notNullString; >>>>>> + >>>>>> + public String getNotNullString() >>>>>> + { >>>>>> + return notNullString; >>>>>> + } >>>>>> + >>>>>> + public void setNotNullString(String notNullString) >>>>>> + { >>>>>> + this.notNullString = notNullString; >>>>>> + } >>>>>> + >>>>>> +} >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb95e223/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/SomeSimpleBean.java >>>>>> >>> ---------------------------------------------------------------------- >>>>>> diff --git >>>>>> >>>>> >>>> >>> a/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/SomeSimpleBean.java >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/SomeSimpleBean.java >>>>>> new file mode 100644 >>>>>> index 0000000..1564112 >>>>>> --- /dev/null >>>>>> +++ >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/example/testapp/entities/SomeSimpleBean.java >>>>>> @@ -0,0 +1,21 @@ >>>>>> +package org.example.testapp.entities; >>>>>> + >>>>>> +import javax.validation.constraints.Min; >>>>>> + >>>>>> +public class SomeSimpleBean >>>>>> +{ >>>>>> + >>>>>> + @Min(6) >>>>>> + private int minValue; >>>>>> + >>>>>> + public int getMinValue() >>>>>> + { >>>>>> + return minValue; >>>>>> + } >>>>>> + >>>>>> + public void setMinValue(int minValue) >>>>>> + { >>>>>> + this.minValue = minValue; >>>>>> + } >>>>>> + >>>>>> +} >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb95e223/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/ComplexBeanDemo.java >>>>>> >>> ---------------------------------------------------------------------- >>>>>> diff --git >>>>>> >>>>> >>>> >>> a/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/ComplexBeanDemo.java >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/ComplexBeanDemo.java >>>>>> new file mode 100644 >>>>>> index 0000000..f7b2623 >>>>>> --- /dev/null >>>>>> +++ >>>>>> >>>>> >>>> >>> b/tapestry-beanvalidator/src/test/java/org/example/testapp/pages/ComplexBeanDemo.java >>>>>> @@ -0,0 +1,14 @@ >>>>>> +package org.example.testapp.pages; >>>>>> + >>>>>> +import org.apache.tapestry5.annotations.Persist; >>>>>> +import org.apache.tapestry5.annotations.Property; >>>>>> +import org.example.testapp.entities.ComplexBean; >>>>>> + >>>>>> +public class ComplexBeanDemo >>>>>> +{ >>>>>> + >>>>>> + @Property >>>>>> + @Persist >>>>>> + private ComplexBean complexBean; >>>>>> + >>>>>> +} >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb95e223/tapestry-beanvalidator/src/test/webapp/ComplexBeanDemo.tml >>>>>> >>> ---------------------------------------------------------------------- >>>>>> diff --git >>> a/tapestry-beanvalidator/src/test/webapp/ComplexBeanDemo.tml >>>>>> b/tapestry-beanvalidator/src/test/webapp/ComplexBeanDemo.tml >>>>>> new file mode 100644 >>>>>> index 0000000..fd20eab >>>>>> --- /dev/null >>>>>> +++ b/tapestry-beanvalidator/src/test/webapp/ComplexBeanDemo.tml >>>>>> @@ -0,0 +1,19 @@ >>>>>> +<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd >>> "> >>>>>> + <body> >>>>>> + <t:form clientValidation="none" validate="complexBean"> >>>>>> + <t:errors/> >>>>>> + >>>>>> + <br/> >>>>>> + <t:BeanEditor object="complexBean" /> >>>>>> + >>>>>> + <br/> >>>>>> + <t:BeanEditor object="complexBean.someSimpleBean" /> >>>>>> + >>>>>> + <br/> >>>>>> + <t:BeanEditor >>> object="complexBean.someOtherSimpleBean" >>>> /> >>>>>> + >>>>>> + <br/> >>>>>> + <input type="submit" value="Go"/> >>>>>> + </t:form> >>>>>> + </body> >>>>>> +</html> >>>>>> \ No newline at end of file >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb95e223/tapestry-beanvalidator/src/test/webapp/Index.tml >>>>>> >>> ---------------------------------------------------------------------- >>>>>> diff --git a/tapestry-beanvalidator/src/test/webapp/Index.tml >>>>>> b/tapestry-beanvalidator/src/test/webapp/Index.tml >>>>>> index da8978e..0970c96 100644 >>>>>> --- a/tapestry-beanvalidator/src/test/webapp/Index.tml >>>>>> +++ b/tapestry-beanvalidator/src/test/webapp/Index.tml >>>>>> @@ -24,6 +24,9 @@ >>>>>> <li> >>>>>> <t:pagelink page="OnPrepareDemo">OnPrepare >>>>>> Demo</t:pagelink> >>>>>> </li> >>>>>> + <li> >>>>>> + <t:pagelink page="ComplexBeanDemo">ComplexBean >>>>>> Demo</t:pagelink> >>>>>> + </li> >>>>>> </ul> >>>>>> </body> >>>>>> </html> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cb95e223/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditor.java >>>>>> >>> ---------------------------------------------------------------------- >>>>>> diff --git >>>>>> >>>>> >>>> >>> a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditor.java >>>>>> >>>>> >>>> >>> b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditor.java >>>>>> index 1d7ed6c..94c37b9 100644 >>>>>> --- >>>>>> >>>>> >>>> >>> a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditor.java >>>>>> +++ >>>>>> >>>>> >>>> >>> b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/BeanEditor.java >>>>>> @@ -166,6 +166,8 @@ public class BeanEditor >>>>>> */ >>>>>> private Object cachedObject; >>>>>> >>>>>> + private BeanValidationContext originalBeanValidationContext; >>>>>> + >>>>>> // Needed for testing as well >>>>>> >>>>>> public Object getObject() >>>>>> @@ -213,10 +215,6 @@ public class BeanEditor >>>>>> >>> PlasticUtils.toTypeName(model.getBeanType()), >>>>>> resources.getCompleteId(), ex); >>>>>> throw new TapestryException(message, >>>>>> resources.getLocation(), ex); >>>>>> } >>>>>> - >>>>>> - // If 'object' parameter is bound to a null-value >>>>>> BeanValidationContext is empty. >>>>>> - // This prevents JSR-303 javascript validators to be >>>>> rendered >>>>>> properly . >>>>>> - refreshBeanValidationContext(); >>>>>> } >>>>>> >>>>>> BeanEditContext context = new BeanEditContext() >>>>>> @@ -235,20 +233,22 @@ public class BeanEditor >>>>>> cachedObject = object; >>>>>> >>>>>> environment.push(BeanEditContext.class, context); >>>>>> + // Always provide a new BeanValidationContext >>>>>> + originalBeanValidationContext = >>>>>> environment.push(BeanValidationContext.class, >>>>>> + new BeanValidationContextImpl(object)); >>>>>> + >>>>>> } >>>>>> >>>>>> void cleanupEnvironment() >>>>>> { >>>>>> environment.pop(BeanEditContext.class); >>>>>> - } >>>>>> - >>>>>> - private void refreshBeanValidationContext() >>>>>> - { >>>>>> - if (environment.peek(BeanValidationContext.class) != null) >>>>>> + environment.pop(BeanValidationContext.class); >>>>>> + // Restore the original BeanValidationContext as it might >>>> still >>>>>> be useful to the enclosing >>>>>> + // form >>>>>> + if (originalBeanValidationContext != null) >>>>>> { >>>>>> - environment.pop(BeanValidationContext.class); >>>>>> - >>>>>> - environment.push(BeanValidationContext.class, new >>>>>> BeanValidationContextImpl(object)); >>>>>> + environment.push(BeanValidationContext.class, >>>>>> originalBeanValidationContext); >>>>>> + originalBeanValidationContext = null; >>>>>> } >>>>>> } >>>>>> >>>>>> >>>>>> >>>>> >>>>> -- >>>>> Howard M. Lewis Ship >>>>> >>>>> Creator of Apache Tapestry >>>>> >>>>> The source for Tapestry training, mentoring and support. Contact me to >>>>> learn how I can get you up and productive in Tapestry fast! >>>>> >>>>> (971) 678-5210 >>>>> http://howardlewisship.com >>>>> >>>> >>> >>> >>> >>> -- >>> Howard M. Lewis Ship >>> >>> Creator of Apache Tapestry >>> >>> The source for Tapestry training, mentoring and support. Contact me to >>> learn how I can get you up and productive in Tapestry fast! >>> >>> (971) 678-5210 >>> http://howardlewisship.com >>> >> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org > For additional commands, e-mail: dev-h...@tapestry.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org