Re: [T5.2.6] When can a java.net.URL be returned from an event handler?
anyone? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-When-can-a-java-net-URL-be-returned-from-an-event-handler-tp5716618p5717221.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.2.6] When can a java.net.URL be returned from an event handler?
Ok, I'll add some more context here. The event handling code I'm talking about is actually invoked in a component's /dispatchComponentEvent/ function. It is added as 'before' advice on this function through a Tapestry Class Transformation. Basically, the event handling code verifies a boolean and then either - lets the dispatchComponentEvent call proceed as normal (through /invocation.proceed()/), - or handles the dispatchComponentEvent call itself (if !request.isXHR()): it sets a java.net.URL object u as the ComponentEvent's result (through /storeResult(u)/) and it overrides the event's result (through /overrideResult(true)/). This code typically works, but there are cases in which I get the aforementioned exception: "A component event handler method returned the value http://www.url.here/aFolder. Return type java.net.URL can not be handled"'. I added some additional logging which gives the following result when the exception occurs: 1. Event causing the user to be redirected: ComponentEvent[activate from (self)] on XPage Storing the redirectTarget (http://www.url.here/aFolder) as the triggered event's result. 2. Event causing the user to be redirected: ComponentEvent[exception from (self)] on XPage Storing the redirectTarget (http://www.url.here/aFolder) as the triggered event's result. 3. A component event handler method returned the value http://www.url.here/aFolder. Return type java.net.URL can not be handled. The logging shows that it's always the 'exception' event handling that causes the URL failure. What causes the 'exception' event in the first place is unclear to me... Hopefully this description can give more insight in the problem? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-When-can-a-java-net-URL-be-returned-from-an-event-handler-tp5716618p5717120.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.2.6] When can a java.net.URL be returned from an event handler?
Any other ideas? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-When-can-a-java-net-URL-be-returned-from-an-event-handler-tp5716618p5716986.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.2.6] When can a java.net.URL be returned from an event handler?
It should be... No other piece of event handler code returns URLs. -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-When-can-a-java-net-URL-be-returned-from-an-event-handler-tp5716618p5716638.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.2.6] When can a java.net.URL be returned from an event handler?
That's possible; I do however perform the test to make sure the URL is only returned when !request.isXHR() (where request is an instance of org.apache.tapestry5.services.Request). Is there any other check that I should perform? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-When-can-a-java-net-URL-be-returned-from-an-event-handler-tp5716618p5716632.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.2.6] When can a java.net.URL be returned from an event handler?
Hi Lance, Thanks for the quick reply. 2) nope 3) I think not; my code which returns URLs typically works, but only sometimes I get the error that a returned URL cannot be handled. 1) Can you clarify this? I don't really understand this question... -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-When-can-a-java-net-URL-be-returned-from-an-event-handler-tp5716618p5716628.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry Spring Security for 5.4-SNAPSHOT
Hi Daniel, Do you allow others to commit to your fork as well? Otherwise, I'd be interested as I still have an improvement on the latest tapestry-spring-security which is apparently not yet present in the fork. Best Regards, Wouter -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Spring-Security-for-5-4-SNAPSHOT-tp5714817p5714830.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to obtain page instances programmatically by name?
Thanks Bryan, that's actually what I was looking for! -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-obtain-page-instances-programmatically-by-name-tp5714794p5714824.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Is it possible to obtain page instances programmatically by name?
Hi, We all know Tapestry page instances can be obtained by "injecting" them in a variable using its type or its name, e.g., as follows: @InjectPage private HomePage home; or @InjectPage("HomePage") private Object home; However, this method only allows pages to be injected whose names are known at compile-time. I was wondering whether there's a way to obtain a page instance through some sort of getter method, such that the page name doesn't have to be known at compile-time? E.g., as follows: Object home = Global.getPage("HomePage"); Thanks in advance, and best regards, Wouter -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-obtain-page-instances-programmatically-by-name-tp5714794.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: [T5.2.6] AjaxFormLoop containing tr's rather than being a tr
Pieter, Thanks for the reply, I forgot to mention that in first instance, the table renders correctly, but it goes all wrong when using the add row link. Could you try that? In my case, the new "rows" are shown out of the table (above it to be specific). -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-AjaxFormLoop-containing-tr-s-rather-than-being-a-tr-tp5713516p5713520.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[T5.2.6] AjaxFormLoop containing tr's rather than being a tr
Hi, I'm wondering whether it is possible to have an AjaxFormLoop containing multiple tr elements? For instance, this works: H1... <*tr *t:type="AjaxFormLoop" t:source="src" t:value="el" t:encoder="elEncoder" t:show="show"> E1 ... ... ... ... tr*> But I'd like to do this, which doesn't seem to work: H1... <*div *t:type="AjaxFormLoop" t:source="src" t:value="el" t:encoder="elEncoder" t:show="show"> <*tr*> E1 ... ... ... tr*> ... ... div*> The first piece of code generates HTML like: ... ... ... ... ... ... # Add Row The latter generates the following HTML: ... ... ... ... ... ... ... ... ... ... ... ... ... Which seems to have the AjaxFormLoop escaping the table . Anyone having any ideas on this? Thanks! -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-AjaxFormLoop-containing-tr-s-rather-than-being-a-tr-tp5713516.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
Lance, the 'prepare' event might be fired, but apparently it's not dealt with by a page component. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5690332.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
>I disagree. Tapestry would need to persist the validators somehow. Ok, if it isn't persisting the TextField already, I agree with you. But I thought it did that somehow. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5685887.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
PS: If I recall correctly, a component can only be implemented in terms of render event handlers, and the activate event isn't a render event (http://tapestry.apache.org/component-rendering.html). Either way, I tried to add an onActivate() method to be sure, and it didn't get invoked. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5685850.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
I know, it's only called during (before) rendering. Anyway, after inspecting the stack trace, I found out that Tapestry is re-evaluating the /validate/ parameter of a TextField upon form submission. More specifically, when the form is submitted, the TextField is asked to validate itself and to this end it attempts to re-evaluate its validate parameter. Clearly, this is undesired behavior and it would be nice to have this disabled in later versions of Tapestry (assuming that in most use-cases, fields on a page require the exact same validators at validate-time as those that were passed to them at render-time). I did manage to find a solution though: rather than using a render variable, mycomponent takes an extra parameter, namely a persisted property. The property is set while mycomponent is rendered, and because it's persisted, it remains bound when the form is submitted. The result = a component that decides on the validators of a field it contains (at render-time): (Java declaration for the property is: @Persist @Property FieldValidator validators;) Thanks for all your help! -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5685839.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
Full error output: ERROR org.apache.tapestry5.ioc.Registry - Failure reading parameter 'validate' of component MyPage:fieldID: Component MyPage does not contain a stored render variable with name 'validators'. Stored render variables: (none). ERROR org.apache.tapestry5.ioc.Registry - Operations trace: ERROR org.apache.tapestry5.ioc.Registry - [ 1] Triggering event 'action' on MyPage:inputs -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5685445.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
Yup, I avoided that code because I'd like the customcomponent to be flexible, not requiring a specific type of Field in its body, or a specific name for that Field. In the meanwhile, I've been able to get the field reference in the custom component as follows: This works , but: apparently tapestry makes an attempt to resolve used render variable when the form is submitted, too, and this time, it makes this attempt before mycomponent's setupRender() has executed. As a result, I get the following error upon form submission: ERROR org.apache.tapestry5.ioc.Registry - Failure reading parameter 'validate' of component MyPage:fieldID: Component MyPage does not contain a stored render variable with name 'validators'. Stored render variables: (none). Any ideas on this? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5685389.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
Hi, Well, passing a parameter to the field to configure its validator is exactly what I'm trying to do. The fields I need already take a parameter for this purpose (i.e., t:validate), so it doesn't seem useful to extend them to use Environmentals instead. The issue here is that t:validate works well if you pass static text, for instance: "required, regexp", but, if you want to dynamically decide on the validators (i.e., by passing a property instead of a validate string), the property requires the type *FieldValidator*. Now it is possible to instantiate FieldValidators at render-time, but to this end, you need a reference to the *Field* you want to pass the validator to. For instance, if you're just /in a page/, this (thanks to Lance) works: Java Page { @Inject Field textField; @Inject FieldValidatorSource fieldValidatorSource; public FieldValidator getValidators() { StringBuilder validators = new StringBuilder("a,b,c"); if (required) { validators.append(",required"); } return fieldValidatorSource.createValidators(textField, validators.toString()); } } Corresponding Page TML { } Now I don't want to provide the property from within a page, but /from within a custom component/ instead. More specifically, I'd like to do this: Page TML { } The component knows what validators are required, and I can bind the validators render variable at render-time (i.e., exactly when I need it) so that's ok, but, in order to bind it I need to create the FieldValidator, and for the latter I need a reference to the field that's in the component's body. Therefore my question: how can I obtain a reference to this field (given its ID), in the component, preferably in the setupRender phase (as I think the validators variable should be bound at that time)? PS: Things would be way easier if I could only bind a String with validators to the render variable, and let Tapestry create the FieldValidators itself, but that doesn't seem to work, cfr. earlier in the conversation (accessible at http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-td5682920.html). Wouter -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5684972.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
Thiago, I want to apply the same logic that's applied when using a Page property in a tml to output text: I want to use a component's property (render variable in this case) in its body to set the validator for a field in this body. That doesn't seem too wrong to me, does it? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5684066.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
Lance, I'm currently unable to access my workstation, but I invoked the /resources.getComponentModel().getEmbeddedComponentIds();/ in both setupRender() and cleanupRender() earlier today. Both invocations returned an empty list. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5683688.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
Yup I know about the page render variables, but that works. The problem is getting access to the embedded field.. (i.e., the TextField, or any field with a specific name, in the body of the custom component) The custom component itself doesn't have a tml file, it just employs the render phase events to do its job. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5683291.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
Thanks, that'll work indeed. Do you happen to know whether it's also possible to inject such a field from the body of a custom component in that custom component? For instance, let's say we have: Where I'd like to access the tf1 textfield in mycomponent's java class to create the validator and store it in a render variable that is then accessible while rendering, allowing something like this: I tried to add the following in the MyComponent class, which does not seem to work: boolean setupRender() { TextField tf = resources.getEmbeddedComponent("tf1"); // construct validators here resources.getPage().getComponentResources().storeRenderVariable("validators", validators); } (the getEmbeddedComponent fails) -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5683187.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
No go :/. org.apache.tapestry5.ioc.Registry - Exception assembling root component of page MyPage: Could not convert 'prop:validate:validators' into a component parameter binding: Error parsing property expression 'validate:validators': Unable to parse input at character position 9. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5683135.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Is it possible to add Field validators at render-time?
That'd be a great solution, but it doesn't seem to work :-(. Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading parameter 'validate' of component MyPage:name: Unexpected character ':' at position 5 of input string: prop:validators. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920p5683101.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Is it possible to add Field validators at render-time?
Hi, I was wondering whether it is possible to add Validators to a Tapestry field (e.g., TextField) at render-time (based on a runtime property)? More specifically, I'd like to know whether I can avoid doing: and change it by something like with public String getAndRequired { if(isRequired()) return ",required"; else return ""; } in the page's java source (note: this code does not work). I already thought of creating a custom 'required' validator, but there seems to be no way to initialize it. I was thinking of initializing it in the tml using t:validate="a,b,c,myrequired=${prop:required}", but this also doesn't seem to work... Thanks in advance -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-add-Field-validators-at-render-time-tp5682920.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Reading out a Component's formal parameters' values
Thanks for the tip! Having read the documentation on Environmentals, it looks to me like I have to push the required values in the outer component in a method that will lead to the invocation of the validator method where I need them, and pop the values, for instance, when this method returns. If I understand this correctly, this would be easy if only I could store the values in the validator instance, for instance during rendering, for later use in the validator. However it seems like Validator instances are shared in Tapestry, which makes this option unfeasible. This being said, my only option seems to be that when, for instance, I need values A, B and C in my validator's /isRequired()/ and /validate(Field, Void, MessageFormatter, Object)/ methods , I need to find the methods in *mycomp* that will cause the invocation of these validator methods, and push & pop the values in there. Do I understand this correctly and if so, is there an easy way to find these methods (my IDE's call hierarchy doesn't provide me with the answers)? Or, isn't there an easier way to read a component's state from within a validator that it contains? Some additional context: the custom validator is just a "Conditional Required" validator, and the outer component mycomp knows (already during rendering), whether this conditional validator should be active or not. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reading-out-a-Component-s-formal-parameters-values-tp5680502p5682551.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Reading out a Component's formal parameters' values
Actually, the validator will be applied to a component that's one level deeper than my custom component (for instance: ; where customvalidator requires the values of a and b). -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reading-out-a-Component-s-formal-parameters-values-tp5680502p5680641.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Reading out a Component's formal parameters' values
Actually, the validator will be applied to a component that's one level deeper than my custom component (for instance: ; where customvalidator requires the values of a and b). -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reading-out-a-Component-s-formal-parameters-values-tp5680502p5680640.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Reading out a Component's formal parameters' values
Hi, I was wondering whether it's possible to read out a *Component*'s formal parameters' values? Up till now, I was only able to find the /getInformalParameter(String name, Class type)/ function in *ComponentResources*, which only allows to read out informal parameters. Some Context: I'd like to create a custom validator to be used in a custom component I wrote earlier. For this validator to work properly, it would need to access the values of the parameters passed to its containing component. Making the container's formal parameters informal seems like a clumsy solution. Thanks in advance, and best regards, Wouter -- View this message in context: http://tapestry.1045711.n5.nabble.com/Reading-out-a-Component-s-formal-parameters-values-tp5680502.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org