Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Yes, the problem is that you are advising every advisable page/component/service in the system. This includes base classes; when you've already advised the base class then the interface won't be added and therefore the method won't exist in the transformation. Try only adding the interface to classes that have fields with the annotation you are looking for. Josh On Tue, Sep 14, 2010 at 12:07 PM, Markus Feindler markus.feind...@gmx.de wrote: I always get IndexOutofBounds (methods.size == 0), though name is equal (I logged that). Is there a bug in the matchMethods Impl? Right... coding in email so I missed the different type signature. Apparently findMethods has been deprecated in favor of ListTransformMethod matchMethods(PredicateTransformMethod predicate) Finds all methods matched by the provided predicate. Which returns the TransformMethod which you want to add advice. Your predicate would be by name and hopefully only find one method! So you want something like: ListTransformMethod methods = transformation.matchMethods(new PredicateTransformMethod() { public boolean accept(TransformMethod object) { return method.getName().equals(extractRequestParameters); } }); if ( methods.size() != 1 ) throw new RuntimeException(Expected 1 extractRequestParameters method, found + methods.size(); methods.get(0).addAdvice(...) Again, I'm doing this from email with no compiler/ide so I could be off. There might be a smarter way to do it, but it seems like if you know the method exists you should just find it instead of getOrCreate'ing it. Josh On Tue, Sep 14, 2010 at 11:05 AM, Markus Feindler markus.feind...@gmx.de wrote: Sounds plausible, but how would a MethodFilter help? It can retrieve the TransformMethodSignature, but how to use that to create an advise? Hmm... just took a look at the code again and I think I see the problem. / This creates the method body if your class doesn't already implement it: transformation.addImplementedInterface(RequestParameterExtractor.class); TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); / This is probably commented out because it always returns. // if (transformation.isDeclaredMethod(extractMethod)) { // return; // } / This is apparently trying to re-create the method. transformation.getOrCreateMethod(extractMethod).addAdvice(new ComponentMethodAdvice(){ You should call transformation.findMethods(filter); instead of getOrCreateMethod. I'm not sure why the getOrCreate is trying to implement the method if it's already there, but I'd guess it has something to do with your new TransformMethodSignature. Josh On Tue, Sep 14, 2010 at 10:20 AM, Markus Feindler markus.feind...@gmx.de wrote: �...@christoph: Same Error @Josh Yes, I also removed the Generic Map from the Interface. Just checked in debug method: the method indeed already exists (breakpoint: line 1443 InternalClassTransformationImpl). But how come? Its never added through my code. Did you take the type parameters off of the interface too (return a raw map)? Have you looked at with a debugger? Stick a breakpoint right before the exception and take a look at the methods in the ctclass. I can't look at it now but I'll try to reproduce the problem tonight. Josh On Tue, Sep 14, 2010 at 9:47 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Just tried, does not work :(. Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenierchristophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindlermarkus.feind...@gmx.de public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenier christophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindler markus.feind...@gmx.de public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Will try that later and inform you. Original-Nachricht Datum: Tue, 14 Sep 2010 08:17:57 +0200 Von: Christophe Cordenier christophe.corden...@gmail.com An: Tapestry users users@tapestry.apache.org Betreff: Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenier christophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindler markus.feind...@gmx.de public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com -- GMX DSL SOMMER-SPECIAL: Surf Phone Flat 16.000 für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Just tried, does not work :(. Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenierchristophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindlermarkus.feind...@gmx.de public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Same error ? 2010/9/14 Markus Feindler markus.feind...@gmx.de Just tried, does not work :(. Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenierchristophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindlermarkus.feind...@gmx.de public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Did you take the type parameters off of the interface too (return a raw map)? Have you looked at with a debugger? Stick a breakpoint right before the exception and take a look at the methods in the ctclass. I can't look at it now but I'll try to reproduce the problem tonight. Josh On Tue, Sep 14, 2010 at 9:47 AM, Markus Feindler markus.feind...@gmx.de wrote: Just tried, does not work :(. Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenierchristophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindlermarkus.feind...@gmx.de public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- -- http://www.bodylabgym.com - a private, by appointment only, one-on-one health and fitness facility. -- http://www.ectransition.com - Quality Electronic Cigarettes at a reasonable price! -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
@Christoph: Same Error @Josh Yes, I also removed the Generic Map from the Interface. Just checked in debug method: the method indeed already exists (breakpoint: line 1443 InternalClassTransformationImpl). But how come? Its never added through my code. Did you take the type parameters off of the interface too (return a raw map)? Have you looked at with a debugger? Stick a breakpoint right before the exception and take a look at the methods in the ctclass. I can't look at it now but I'll try to reproduce the problem tonight. Josh On Tue, Sep 14, 2010 at 9:47 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Just tried, does not work :(. Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenierchristophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindlermarkus.feind...@gmx.de public interface RequestParameterExtractor { MapString, StringextractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Hmm... just took a look at the code again and I think I see the problem. / This creates the method body if your class doesn't already implement it: transformation.addImplementedInterface(RequestParameterExtractor.class); TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); / This is probably commented out because it always returns. // if (transformation.isDeclaredMethod(extractMethod)) { //return; // } / This is apparently trying to re-create the method. transformation.getOrCreateMethod(extractMethod).addAdvice(new ComponentMethodAdvice(){ You should call transformation.findMethods(filter); instead of getOrCreateMethod. I'm not sure why the getOrCreate is trying to implement the method if it's already there, but I'd guess it has something to do with your new TransformMethodSignature. Josh On Tue, Sep 14, 2010 at 10:20 AM, Markus Feindler markus.feind...@gmx.de wrote: �...@christoph: Same Error @Josh Yes, I also removed the Generic Map from the Interface. Just checked in debug method: the method indeed already exists (breakpoint: line 1443 InternalClassTransformationImpl). But how come? Its never added through my code. Did you take the type parameters off of the interface too (return a raw map)? Have you looked at with a debugger? Stick a breakpoint right before the exception and take a look at the methods in the ctclass. I can't look at it now but I'll try to reproduce the problem tonight. Josh On Tue, Sep 14, 2010 at 9:47 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Just tried, does not work :(. Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenierchristophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindlermarkus.feind...@gmx.de public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- -- http://www.bodylabgym.com - a private, by appointment only, one-on-one health and fitness facility. -- http://www.ectransition.com - Quality Electronic Cigarettes at a reasonable price! -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Right... coding in email so I missed the different type signature. Apparently findMethods has been deprecated in favor of ListTransformMethod matchMethods(PredicateTransformMethod predicate) Finds all methods matched by the provided predicate. Which returns the TransformMethod which you want to add advice. Your predicate would be by name and hopefully only find one method! So you want something like: ListTransformMethod methods = transformation.matchMethods(new PredicateTransformMethod() { public boolean accept(TransformMethod object) { return method.getName().equals(extractRequestParameters); } }); if ( methods.size() != 1 ) throw new RuntimeException(Expected 1 extractRequestParameters method, found + methods.size(); methods.get(0).addAdvice(...) Again, I'm doing this from email with no compiler/ide so I could be off. There might be a smarter way to do it, but it seems like if you know the method exists you should just find it instead of getOrCreate'ing it. Josh On Tue, Sep 14, 2010 at 11:05 AM, Markus Feindler markus.feind...@gmx.de wrote: Sounds plausible, but how would a MethodFilter help? It can retrieve the TransformMethodSignature, but how to use that to create an advise? Hmm... just took a look at the code again and I think I see the problem. / This creates the method body if your class doesn't already implement it: transformation.addImplementedInterface(RequestParameterExtractor.class); TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); / This is probably commented out because it always returns. // if (transformation.isDeclaredMethod(extractMethod)) { // return; // } / This is apparently trying to re-create the method. transformation.getOrCreateMethod(extractMethod).addAdvice(new ComponentMethodAdvice(){ You should call transformation.findMethods(filter); instead of getOrCreateMethod. I'm not sure why the getOrCreate is trying to implement the method if it's already there, but I'd guess it has something to do with your new TransformMethodSignature. Josh On Tue, Sep 14, 2010 at 10:20 AM, Markus Feindler markus.feind...@gmx.de wrote: �...@christoph: Same Error @Josh Yes, I also removed the Generic Map from the Interface. Just checked in debug method: the method indeed already exists (breakpoint: line 1443 InternalClassTransformationImpl). But how come? Its never added through my code. Did you take the type parameters off of the interface too (return a raw map)? Have you looked at with a debugger? Stick a breakpoint right before the exception and take a look at the methods in the ctclass. I can't look at it now but I'll try to reproduce the problem tonight. Josh On Tue, Sep 14, 2010 at 9:47 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Just tried, does not work :(. Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenierchristophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindlermarkus.feind...@gmx.de public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands,
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
I always get IndexOutofBounds (methods.size == 0), though name is equal (I logged that). Is there a bug in the matchMethods Impl? Right... coding in email so I missed the different type signature. Apparently findMethods has been deprecated in favor of ListTransformMethod matchMethods(PredicateTransformMethod predicate) Finds all methods matched by the provided predicate. Which returns the TransformMethod which you want to add advice. Your predicate would be by name and hopefully only find one method! So you want something like: ListTransformMethod methods = transformation.matchMethods(new PredicateTransformMethod() { public boolean accept(TransformMethod object) { return method.getName().equals(extractRequestParameters); } }); if ( methods.size() != 1 ) throw new RuntimeException(Expected 1 extractRequestParameters method, found + methods.size(); methods.get(0).addAdvice(...) Again, I'm doing this from email with no compiler/ide so I could be off. There might be a smarter way to do it, but it seems like if you know the method exists you should just find it instead of getOrCreate'ing it. Josh On Tue, Sep 14, 2010 at 11:05 AM, Markus Feindler markus.feind...@gmx.de wrote: Sounds plausible, but how would a MethodFilter help? It can retrieve the TransformMethodSignature, but how to use that to create an advise? Hmm... just took a look at the code again and I think I see the problem. / This creates the method body if your class doesn't already implement it: transformation.addImplementedInterface(RequestParameterExtractor.class); TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); / This is probably commented out because it always returns. // if (transformation.isDeclaredMethod(extractMethod)) { //return; // } / This is apparently trying to re-create the method. transformation.getOrCreateMethod(extractMethod).addAdvice(new ComponentMethodAdvice(){ You should call transformation.findMethods(filter); instead of getOrCreateMethod. I'm not sure why the getOrCreate is trying to implement the method if it's already there, but I'd guess it has something to do with your new TransformMethodSignature. Josh On Tue, Sep 14, 2010 at 10:20 AM, Markus Feindler markus.feind...@gmx.dewrote: @Christoph: Same Error @Josh Yes, I also removed the Generic Map from the Interface. Just checked in debug method: the method indeed already exists (breakpoint: line 1443 InternalClassTransformationImpl). But how come? Its never added through my code. Did you take the type parameters off of the interface too (return a raw map)? Have you looked at with a debugger? Stick a breakpoint right before the exception and take a look at the methods in the ctclass. I can't look at it now but I'll try to reproduce the problem tonight. Josh On Tue, Sep 14, 2010 at 9:47 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Just tried, does not work :(. Have you tried without specify Generic types ? 2010/9/13 Christophe Cordenierchristophe.corden...@gmail.com Oh, this is maybe due to generics... 2010/9/13 Markus Feindlermarkus.feind...@gmx.de public interface RequestParameterExtractor { MapString, StringextractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Any ideas? Howard? No, I get the exception for all pages, also the ExpcetionReportPage for example. Original-Nachricht Datum: Thu, 9 Sep 2010 08:26:05 +0200 Von: Christophe Cordenierchristophe.corden...@gmail.com An: Tapestry usersusers@tapestry.apache.org Betreff: Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer Weird, does you Index page extends a base class ? 2010/9/8 Markus Feindlermarkus.feind...@gmx.de Sorry to bother you, but Im stuck with a DuplicateMemberException: Caused by: java.lang.RuntimeException: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1458) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOrOverrideMethod(InternalClassTransformationImpl.java:1412) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOverrideOrCreateMethod(InternalClassTransformationImpl.java:1397) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.getOrCreateMethod(InternalClassTransformationImpl.java:1392) at org.apache.tapestry5.portlet.services.PortletRequestParameterWorker.transform(PortletRequestParameterWorker.java:48) at $ComponentClassTransformWorker_12af2cfc4c4.transform($ComponentClassTransformWorker_12af2cfc4c4.java) at $ComponentClassTransformWorker_12af2cfc4c5.transform($ComponentClassTransformWorker_12af2cfc4c5.java) at $ComponentClassTransformWorker_12af2cfc4b6.transform($ComponentClassTransformWorker_12af2cfc4b6.java) at org.apache.tapestry5.internal.services.ComponentClassTransformerImpl$1.run(ComponentClassTransformerImpl.java:194) ... 250 more Caused by: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:637) at javassist.bytecode.ClassFile.addMethod(ClassFile.java:613) at javassist.CtClassType.addMethod(CtClassType.java:1320) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1444) ... 258 more This is my worker: public class PortletRequestParameterWorker implements ComponentClassTransformWorker { private final ValueEncoderSource valueEncoderSource; private final ComponentClassCache classCache; private final RequestParameterContext requestParameterContext; private final ComponentSource componentSource; public PortletRequestParameterWorker(ValueEncoderSource valueEncoderSource, ComponentClassCache classCache, RequestParameterContext requestParameterContext, ComponentSource componentSource) { this.valueEncoderSource = valueEncoderSource; this.classCache = classCache; this.requestParameterContext = requestParameterContext; this.componentSource = componentSource; } public void transform(final ClassTransformation transformation, MutableComponentModel model) { transformation.addImplementedInterface(RequestParameterExtractor.class); TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); //if (transformation.isDeclaredMethod(extractMethod)) { //return; //} transformation.getOrCreateMethod(extractMethod).addAdvice(new ComponentMethodAdvice(){ public void advise(ComponentMethodInvocation invocation) { MapString, String requestParameters = new HashMapString, String(); for (TransformField field : transformation.matchFieldsWithAnnotation(ActivationRequestParameter.class)) { String parameterName = getParameterName(field, field.getAnnotation(ActivationRequestParameter.class)); Class fieldType = classCache.forName(field.getType()); FieldAccess access = field.getAccess(); ValueEncoder encoder = valueEncoderSource.getValueEncoder(fieldType); Object value = access.read(invocation.getInstance()); if (value == null) continue; String clientValue = encoder.toClient(value); requestParameters.put(parameterName, clientValue); } invocation.overrideResult(requestParameters); } }); } private String getParameterName(TransformField field, ActivationRequestParameter annotation) { if (annotation.value().equals
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Please, Can you provide your Tapestry Module class that contributes your worker ? 2010/9/9 Markus Feindler markus.feind...@gmx.de No, I get the exception for all pages, also the ExpcetionReportPage for example. Original-Nachricht Datum: Thu, 9 Sep 2010 08:26:05 +0200 Von: Christophe Cordenier christophe.corden...@gmail.com An: Tapestry users users@tapestry.apache.org Betreff: Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer Weird, does you Index page extends a base class ? 2010/9/8 Markus Feindler markus.feind...@gmx.de Sorry to bother you, but Im stuck with a DuplicateMemberException: Caused by: java.lang.RuntimeException: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1458) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOrOverrideMethod(InternalClassTransformationImpl.java:1412) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOverrideOrCreateMethod(InternalClassTransformationImpl.java:1397) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.getOrCreateMethod(InternalClassTransformationImpl.java:1392) at org.apache.tapestry5.portlet.services.PortletRequestParameterWorker.transform(PortletRequestParameterWorker.java:48) at $ComponentClassTransformWorker_12af2cfc4c4.transform($ComponentClassTransformWorker_12af2cfc4c4.java) at $ComponentClassTransformWorker_12af2cfc4c5.transform($ComponentClassTransformWorker_12af2cfc4c5.java) at $ComponentClassTransformWorker_12af2cfc4b6.transform($ComponentClassTransformWorker_12af2cfc4b6.java) at org.apache.tapestry5.internal.services.ComponentClassTransformerImpl$1.run(ComponentClassTransformerImpl.java:194) ... 250 more Caused by: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:637) at javassist.bytecode.ClassFile.addMethod(ClassFile.java:613) at javassist.CtClassType.addMethod(CtClassType.java:1320) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1444) ... 258 more This is my worker: public class PortletRequestParameterWorker implements ComponentClassTransformWorker { private final ValueEncoderSource valueEncoderSource; private final ComponentClassCache classCache; private final RequestParameterContext requestParameterContext; private final ComponentSource componentSource; public PortletRequestParameterWorker(ValueEncoderSource valueEncoderSource, ComponentClassCache classCache, RequestParameterContext requestParameterContext, ComponentSource componentSource) { this.valueEncoderSource = valueEncoderSource; this.classCache = classCache; this.requestParameterContext = requestParameterContext; this.componentSource = componentSource; } public void transform(final ClassTransformation transformation, MutableComponentModel model) { transformation.addImplementedInterface(RequestParameterExtractor.class); TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); //if (transformation.isDeclaredMethod(extractMethod)) { //return; //} transformation.getOrCreateMethod(extractMethod).addAdvice(new ComponentMethodAdvice(){ public void advise(ComponentMethodInvocation invocation) { MapString, String requestParameters = new HashMapString, String(); for (TransformField field : transformation.matchFieldsWithAnnotation(ActivationRequestParameter.class)) { String parameterName = getParameterName(field, field.getAnnotation(ActivationRequestParameter.class)); Class fieldType = classCache.forName(field.getType()); FieldAccess access = field.getAccess(); ValueEncoder encoder = valueEncoderSource.getValueEncoder(fieldType); Object value = access.read(invocation.getInstance()); if (value == null) continue; String clientValue = encoder.toClient(value
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. // Copyright 2005 The Apache Software Foundation // // Licensed 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.tapestry5.portlet.services; import java.io.IOException; import java.util.List; import javax.portlet.*; import javax.servlet.http.Cookie; import org.apache.tapestry5.SymbolConstants; import org.apache.tapestry5.internal.portlet.services.*; import org.apache.tapestry5.internal.services.*; import org.apache.tapestry5.ioc.*; import org.apache.tapestry5.ioc.annotations.*; import org.apache.tapestry5.ioc.services.PipelineBuilder; import org.apache.tapestry5.ioc.services.PropertyShadowBuilder; import org.apache.tapestry5.portlet.PortletConstants; import org.apache.tapestry5.portlet.PortletPageResolver; import org.apache.tapestry5.services.*; import org.apache.tapestry5.upload.services.MultipartDecoder; import org.slf4j.Logger; public final class PortletModule { public static void bind(ServiceBinder binder) { binder.bind(PortletRequestGlobals.class, PortletRequestGlobalsImpl.class); binder.bind(ComponentEventLinkEncoder.class, ComponentEventLinkEncoderImplPortlet.class).withId(ComponentEventLinkEncoderImplPortlet); } public static void contributeApplicationDefaults(MappedConfigurationString, String configuration) { configuration.add(SymbolConstants.FORCE_ABSOLUTE_URIS, true); configuration.add(SymbolConstants.SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS, true); } public void contributeComponentClassTransformWorker(OrderedConfigurationComponentClassTransformWorker configuration) { configuration.addInstance(PortletRequestParameterWorker, PortletRequestParameterWorker.class); } /** * Builds a shadow of the PortletRequestGlobals.portletRequest property. Note again that the shadow can be * an ordinary singleton, even though PortletRequestGlobals is perthread. */ @Marker(PortletInterfaceProvider.class) public PortletRequest buildPortletRequest( PropertyShadowBuilder shadowBuilder, PortletRequestGlobals portletRequestGlobals) { return shadowBuilder.build(portletRequestGlobals, portletRequest, PortletRequest.class); } /** * Builds a shadow of the PortletRequestGlobals.actionRequest property. Note again that the shadow can be * an ordinary singleton, even though PortletRequestGlobals is perthread. */ @Marker(ActionInterfaceProvider.class) public ActionRequest buildActionRequest( PropertyShadowBuilder shadowBuilder, PortletRequestGlobals portletRequestGlobals) { return shadowBuilder.build(portletRequestGlobals, actionRequest, ActionRequest.class); } /** * Builds a shadow of the PortletRequestGlobals.renderRequest property. Note again that the shadow can be * an ordinary singleton, even though PortletRequestGlobals is perthread. */ @Marker(RenderInterfaceProvider.class) public RenderRequest buildRenderRequest( PropertyShadowBuilder shadowBuilder, PortletRequestGlobals portletRequestGlobals) { return shadowBuilder.build(portletRequestGlobals, renderRequest, RenderRequest.class); } @Marker(ResourceInterfaceProvider.class) public ResourceRequest buildResourceRequest( PropertyShadowBuilder shadowBuilder, PortletRequestGlobals portletRequestGlobals) { return shadowBuilder.build(portletRequestGlobals, resourceRequest, ResourceRequest.class); } /** * Builds a shadow of the
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindler markus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Oh, this is maybe due to generics... 2010/9/13 Markus Feindler markus.feind...@gmx.de public interface RequestParameterExtractor { MapString, String extractRequestParameters(); } is not equal to: TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); ? Everything looks good ... The only thing i see is that the method signature is not exactly the same as the one declared in the interface. 2010/9/13 Markus Feindlermarkus.feind...@gmx.de Am 13.09.2010 22:18, schrieb Thiago H. de Paula Figueiredo: On Mon, 13 Sep 2010 17:02:02 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Please, Can you provide your Tapestry Module class that contributes your worker ? And the worker itself? It seems two different worker instances are trying to add the same method to the same page class. files attached! appreciate your help. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Weird, does you Index page extends a base class ? 2010/9/8 Markus Feindler markus.feind...@gmx.de Sorry to bother you, but Im stuck with a DuplicateMemberException: Caused by: java.lang.RuntimeException: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1458) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOrOverrideMethod(InternalClassTransformationImpl.java:1412) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOverrideOrCreateMethod(InternalClassTransformationImpl.java:1397) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.getOrCreateMethod(InternalClassTransformationImpl.java:1392) at org.apache.tapestry5.portlet.services.PortletRequestParameterWorker.transform(PortletRequestParameterWorker.java:48) at $ComponentClassTransformWorker_12af2cfc4c4.transform($ComponentClassTransformWorker_12af2cfc4c4.java) at $ComponentClassTransformWorker_12af2cfc4c5.transform($ComponentClassTransformWorker_12af2cfc4c5.java) at $ComponentClassTransformWorker_12af2cfc4b6.transform($ComponentClassTransformWorker_12af2cfc4b6.java) at org.apache.tapestry5.internal.services.ComponentClassTransformerImpl$1.run(ComponentClassTransformerImpl.java:194) ... 250 more Caused by: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:637) at javassist.bytecode.ClassFile.addMethod(ClassFile.java:613) at javassist.CtClassType.addMethod(CtClassType.java:1320) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1444) ... 258 more This is my worker: public class PortletRequestParameterWorker implements ComponentClassTransformWorker { private final ValueEncoderSource valueEncoderSource; private final ComponentClassCache classCache; private final RequestParameterContext requestParameterContext; private final ComponentSource componentSource; public PortletRequestParameterWorker(ValueEncoderSource valueEncoderSource, ComponentClassCache classCache, RequestParameterContext requestParameterContext, ComponentSource componentSource) { this.valueEncoderSource = valueEncoderSource; this.classCache = classCache; this.requestParameterContext = requestParameterContext; this.componentSource = componentSource; } public void transform(final ClassTransformation transformation, MutableComponentModel model) { transformation.addImplementedInterface(RequestParameterExtractor.class); TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); //if (transformation.isDeclaredMethod(extractMethod)) { //return; //} transformation.getOrCreateMethod(extractMethod).addAdvice(new ComponentMethodAdvice(){ public void advise(ComponentMethodInvocation invocation) { MapString, String requestParameters = new HashMapString, String(); for (TransformField field : transformation.matchFieldsWithAnnotation(ActivationRequestParameter.class)) { String parameterName = getParameterName(field, field.getAnnotation(ActivationRequestParameter.class)); Class fieldType = classCache.forName(field.getType()); FieldAccess access = field.getAccess(); ValueEncoder encoder = valueEncoderSource.getValueEncoder(fieldType); Object value = access.read(invocation.getInstance()); if (value == null) continue; String clientValue = encoder.toClient(value); requestParameters.put(parameterName, clientValue); } invocation.overrideResult(requestParameters); } }); } private String getParameterName(TransformField field, ActivationRequestParameter annotation) { if (annotation.value().equals()) return field.getName(); return annotation.value(); } } Any ideas? Hi ! Tapestry 5.2 has a brand new API for class manipulation in worker, you have to provide the method signature and implement the logic in a ComponentMethodAdvice (see PropertyWorker sources to have a simple example) HTH 2010/9/7 Markus Feindlermarkus.feind...@gmx.de
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
No, I get the exception for all pages, also the ExpcetionReportPage for example. Original-Nachricht Datum: Thu, 9 Sep 2010 08:26:05 +0200 Von: Christophe Cordenier christophe.corden...@gmail.com An: Tapestry users users@tapestry.apache.org Betreff: Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer Weird, does you Index page extends a base class ? 2010/9/8 Markus Feindler markus.feind...@gmx.de Sorry to bother you, but Im stuck with a DuplicateMemberException: Caused by: java.lang.RuntimeException: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1458) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOrOverrideMethod(InternalClassTransformationImpl.java:1412) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOverrideOrCreateMethod(InternalClassTransformationImpl.java:1397) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.getOrCreateMethod(InternalClassTransformationImpl.java:1392) at org.apache.tapestry5.portlet.services.PortletRequestParameterWorker.transform(PortletRequestParameterWorker.java:48) at $ComponentClassTransformWorker_12af2cfc4c4.transform($ComponentClassTransformWorker_12af2cfc4c4.java) at $ComponentClassTransformWorker_12af2cfc4c5.transform($ComponentClassTransformWorker_12af2cfc4c5.java) at $ComponentClassTransformWorker_12af2cfc4b6.transform($ComponentClassTransformWorker_12af2cfc4b6.java) at org.apache.tapestry5.internal.services.ComponentClassTransformerImpl$1.run(ComponentClassTransformerImpl.java:194) ... 250 more Caused by: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:637) at javassist.bytecode.ClassFile.addMethod(ClassFile.java:613) at javassist.CtClassType.addMethod(CtClassType.java:1320) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1444) ... 258 more This is my worker: public class PortletRequestParameterWorker implements ComponentClassTransformWorker { private final ValueEncoderSource valueEncoderSource; private final ComponentClassCache classCache; private final RequestParameterContext requestParameterContext; private final ComponentSource componentSource; public PortletRequestParameterWorker(ValueEncoderSource valueEncoderSource, ComponentClassCache classCache, RequestParameterContext requestParameterContext, ComponentSource componentSource) { this.valueEncoderSource = valueEncoderSource; this.classCache = classCache; this.requestParameterContext = requestParameterContext; this.componentSource = componentSource; } public void transform(final ClassTransformation transformation, MutableComponentModel model) { transformation.addImplementedInterface(RequestParameterExtractor.class); TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); //if (transformation.isDeclaredMethod(extractMethod)) { //return; //} transformation.getOrCreateMethod(extractMethod).addAdvice(new ComponentMethodAdvice(){ public void advise(ComponentMethodInvocation invocation) { MapString, String requestParameters = new HashMapString, String(); for (TransformField field : transformation.matchFieldsWithAnnotation(ActivationRequestParameter.class)) { String parameterName = getParameterName(field, field.getAnnotation(ActivationRequestParameter.class)); Class fieldType = classCache.forName(field.getType()); FieldAccess access = field.getAccess(); ValueEncoder encoder = valueEncoderSource.getValueEncoder(fieldType); Object value = access.read(invocation.getInstance()); if (value == null) continue; String clientValue = encoder.toClient(value); requestParameters.put(parameterName, clientValue); } invocation.overrideResult(requestParameters); } }); } private
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Hi ! Tapestry 5.2 has a brand new API for class manipulation in worker, you have to provide the method signature and implement the logic in a ComponentMethodAdvice (see PropertyWorker sources to have a simple example) HTH 2010/9/7 Markus Feindler markus.feind...@gmx.de So, I tried to follow your advice, but I don't see how to add a new method after calling transformation.addImplementedInterface(MyInterface.class). The documentation states to use transformation.getOrCreateMethod, but where to define the message body? Actually, I would implement a ClassTransformation and add it to contributeComponentClassTransformWorker (see Tapestry Module), This worker should add and implement an interface that contains the method to extract useful information from the page Then in your PageResponseRenderer, you can use ComponentSource to get the page instance, cast it to your interface and call the method. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de Thats the class I discovered earlier at work. Now my question is how to get ClassTransformation and MutableComponentModel from the Page Object in the PageResponseRenderer? Thanks for you help/hints. Regards markus Hi Logic is enclosed in ActivationRequestParameterWorker, i think you can adapt this to your needs and extract values. At the moment, I don't see any other way to identify ActivationRequestParameters during link creation. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de i would say you can get them from Request directly This only works for the current request. I need to get the parameters, which will be set for the next request/redirect. It would be possible to write get methods for the ActivationRequestParameters, but that would not be the right way. I need to find out how that is solved internally. Oh sorry, i had mis-read your first message. I didn't get deep into this new feature at the time, but at first glance, i would say you can get them from Request directly. Maybe, you can implement a worker that will be in charge of implementing an interface that will contain the method that return the values. I will go deeper to see if there is not a more simple way of doing this. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de Thats what Im doing right now for the PageActivationContext, but I also need the values for the ActivationRequestParameters (introduced in 5.2: http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/annotations/ActivationRequestParameter.html ). Hi So why not passivate the page, see PageActivationContextCollector ? This is how it works to create links. 2010/9/5 Markus Feindlermarkus.feind...@gmx.de No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindler markus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Sorry to bother you, but Im stuck with a DuplicateMemberException: Caused by: java.lang.RuntimeException: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1458) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOrOverrideMethod(InternalClassTransformationImpl.java:1412) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.findOverrideOrCreateMethod(InternalClassTransformationImpl.java:1397) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.getOrCreateMethod(InternalClassTransformationImpl.java:1392) at org.apache.tapestry5.portlet.services.PortletRequestParameterWorker.transform(PortletRequestParameterWorker.java:48) at $ComponentClassTransformWorker_12af2cfc4c4.transform($ComponentClassTransformWorker_12af2cfc4c4.java) at $ComponentClassTransformWorker_12af2cfc4c5.transform($ComponentClassTransformWorker_12af2cfc4c5.java) at $ComponentClassTransformWorker_12af2cfc4b6.transform($ComponentClassTransformWorker_12af2cfc4b6.java) at org.apache.tapestry5.internal.services.ComponentClassTransformerImpl$1.run(ComponentClassTransformerImpl.java:194) ... 250 more Caused by: javassist.bytecode.DuplicateMemberException: duplicate method: extractRequestParameters in de.wiv.tapestryportlet2.pages.Index at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:637) at javassist.bytecode.ClassFile.addMethod(ClassFile.java:613) at javassist.CtClassType.addMethod(CtClassType.java:1320) at org.apache.tapestry5.internal.services.InternalClassTransformationImpl.addOverrideOfSuperclassMethod(InternalClassTransformationImpl.java:1444) ... 258 more This is my worker: public class PortletRequestParameterWorker implements ComponentClassTransformWorker { private final ValueEncoderSource valueEncoderSource; private final ComponentClassCache classCache; private final RequestParameterContext requestParameterContext; private final ComponentSource componentSource; public PortletRequestParameterWorker(ValueEncoderSource valueEncoderSource, ComponentClassCache classCache, RequestParameterContext requestParameterContext, ComponentSource componentSource) { this.valueEncoderSource = valueEncoderSource; this.classCache = classCache; this.requestParameterContext = requestParameterContext; this.componentSource = componentSource; } public void transform(final ClassTransformation transformation, MutableComponentModel model) { transformation.addImplementedInterface(RequestParameterExtractor.class); TransformMethodSignature extractMethod = new TransformMethodSignature(Modifier.PUBLIC, MapString, String, extractRequestParameters, null, null); //if (transformation.isDeclaredMethod(extractMethod)) { //return; //} transformation.getOrCreateMethod(extractMethod).addAdvice(new ComponentMethodAdvice(){ public void advise(ComponentMethodInvocation invocation) { MapString, String requestParameters = new HashMapString, String(); for (TransformField field : transformation.matchFieldsWithAnnotation(ActivationRequestParameter.class)) { String parameterName = getParameterName(field, field.getAnnotation(ActivationRequestParameter.class)); Class fieldType = classCache.forName(field.getType()); FieldAccess access = field.getAccess(); ValueEncoder encoder = valueEncoderSource.getValueEncoder(fieldType); Object value = access.read(invocation.getInstance()); if (value == null) continue; String clientValue = encoder.toClient(value); requestParameters.put(parameterName, clientValue); } invocation.overrideResult(requestParameters); } }); } private String getParameterName(TransformField field, ActivationRequestParameter annotation) { if (annotation.value().equals()) return field.getName(); return annotation.value(); } } Any ideas? Hi ! Tapestry 5.2 has a brand new API for class manipulation in worker, you have to provide the method signature and implement the logic in a ComponentMethodAdvice (see PropertyWorker sources to have a simple example) HTH 2010/9/7 Markus Feindlermarkus.feind...@gmx.de So, I tried to follow your advice, but I don't see how to add a new method after calling
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Actually, I would implement a ClassTransformation and add it to contributeComponentClassTransformWorker (see Tapestry Module), This worker should add and implement an interface that contains the method to extract useful information from the page Then in your PageResponseRenderer, you can use ComponentSource to get the page instance, cast it to your interface and call the method. 2010/9/6 Markus Feindler markus.feind...@gmx.de Thats the class I discovered earlier at work. Now my question is how to get ClassTransformation and MutableComponentModel from the Page Object in the PageResponseRenderer? Thanks for you help/hints. Regards markus Hi Logic is enclosed in ActivationRequestParameterWorker, i think you can adapt this to your needs and extract values. At the moment, I don't see any other way to identify ActivationRequestParameters during link creation. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de i would say you can get them from Request directly This only works for the current request. I need to get the parameters, which will be set for the next request/redirect. It would be possible to write get methods for the ActivationRequestParameters, but that would not be the right way. I need to find out how that is solved internally. Oh sorry, i had mis-read your first message. I didn't get deep into this new feature at the time, but at first glance, i would say you can get them from Request directly. Maybe, you can implement a worker that will be in charge of implementing an interface that will contain the method that return the values. I will go deeper to see if there is not a more simple way of doing this. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de Thats what Im doing right now for the PageActivationContext, but I also need the values for the ActivationRequestParameters (introduced in 5.2: http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/annotations/ActivationRequestParameter.html ). Hi So why not passivate the page, see PageActivationContextCollector ? This is how it works to create links. 2010/9/5 Markus Feindlermarkus.feind...@gmx.de No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
So, I tried to follow your advice, but I don't see how to add a new method after calling transformation.addImplementedInterface(MyInterface.class). The documentation states to use transformation.getOrCreateMethod, but where to define the message body? Actually, I would implement a ClassTransformation and add it to contributeComponentClassTransformWorker (see Tapestry Module), This worker should add and implement an interface that contains the method to extract useful information from the page Then in your PageResponseRenderer, you can use ComponentSource to get the page instance, cast it to your interface and call the method. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de Thats the class I discovered earlier at work. Now my question is how to get ClassTransformation and MutableComponentModel from the Page Object in the PageResponseRenderer? Thanks for you help/hints. Regards markus Hi Logic is enclosed in ActivationRequestParameterWorker, i think you can adapt this to your needs and extract values. At the moment, I don't see any other way to identify ActivationRequestParameters during link creation. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de i would say you can get them from Request directly This only works for the current request. I need to get the parameters, which will be set for the next request/redirect. It would be possible to write get methods for the ActivationRequestParameters, but that would not be the right way. I need to find out how that is solved internally. Oh sorry, i had mis-read your first message. I didn't get deep into this new feature at the time, but at first glance, i would say you can get them from Request directly. Maybe, you can implement a worker that will be in charge of implementing an interface that will contain the method that return the values. I will go deeper to see if there is not a more simple way of doing this. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de Thats what Im doing right now for the PageActivationContext, but I also need the values for the ActivationRequestParameters (introduced in 5.2: http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/annotations/ActivationRequestParameter.html ). Hi So why not passivate the page, see PageActivationContextCollector ? This is how it works to create links. 2010/9/5 Markus Feindlermarkus.feind...@gmx.de No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail:
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Hi So why not passivate the page, see PageActivationContextCollector ? This is how it works to create links. 2010/9/5 Markus Feindler markus.feind...@gmx.de No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Thats what Im doing right now for the PageActivationContext, but I also need the values for the ActivationRequestParameters (introduced in 5.2: http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/annotations/ActivationRequestParameter.html). Hi So why not passivate the page, see PageActivationContextCollector ? This is how it works to create links. 2010/9/5 Markus Feindlermarkus.feind...@gmx.de No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Oh sorry, i had mis-read your first message. I didn't get deep into this new feature at the time, but at first glance, i would say you can get them from Request directly. Maybe, you can implement a worker that will be in charge of implementing an interface that will contain the method that return the values. I will go deeper to see if there is not a more simple way of doing this. 2010/9/6 Markus Feindler markus.feind...@gmx.de Thats what Im doing right now for the PageActivationContext, but I also need the values for the ActivationRequestParameters (introduced in 5.2: http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/annotations/ActivationRequestParameter.html ). Hi So why not passivate the page, see PageActivationContextCollector ? This is how it works to create links. 2010/9/5 Markus Feindlermarkus.feind...@gmx.de No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
i would say you can get them from Request directly This only works for the current request. I need to get the parameters, which will be set for the next request/redirect. It would be possible to write get methods for the ActivationRequestParameters, but that would not be the right way. I need to find out how that is solved internally. Oh sorry, i had mis-read your first message. I didn't get deep into this new feature at the time, but at first glance, i would say you can get them from Request directly. Maybe, you can implement a worker that will be in charge of implementing an interface that will contain the method that return the values. I will go deeper to see if there is not a more simple way of doing this. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de Thats what Im doing right now for the PageActivationContext, but I also need the values for the ActivationRequestParameters (introduced in 5.2: http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/annotations/ActivationRequestParameter.html ). Hi So why not passivate the page, see PageActivationContextCollector ? This is how it works to create links. 2010/9/5 Markus Feindlermarkus.feind...@gmx.de No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Hi Logic is enclosed in ActivationRequestParameterWorker, i think you can adapt this to your needs and extract values. At the moment, I don't see any other way to identify ActivationRequestParameters during link creation. 2010/9/6 Markus Feindler markus.feind...@gmx.de i would say you can get them from Request directly This only works for the current request. I need to get the parameters, which will be set for the next request/redirect. It would be possible to write get methods for the ActivationRequestParameters, but that would not be the right way. I need to find out how that is solved internally. Oh sorry, i had mis-read your first message. I didn't get deep into this new feature at the time, but at first glance, i would say you can get them from Request directly. Maybe, you can implement a worker that will be in charge of implementing an interface that will contain the method that return the values. I will go deeper to see if there is not a more simple way of doing this. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de Thats what Im doing right now for the PageActivationContext, but I also need the values for the ActivationRequestParameters (introduced in 5.2: http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/annotations/ActivationRequestParameter.html ). Hi So why not passivate the page, see PageActivationContextCollector ? This is how it works to create links. 2010/9/5 Markus Feindlermarkus.feind...@gmx.de No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
On Mon, 06 Sep 2010 15:01:09 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Hi Hi! Logic is enclosed in ActivationRequestParameterWorker, i think you can adapt this to your needs and extract values. At the moment, I don't see any other way to identify ActivationRequestParameters during link creation. Why not just @Inject'ing the Request and using the TypeCoercer to do the needed conversions? I haven't read the ActivationRequestParameterWorker source yet, but I guess that's exactly what it does. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Actually, not exactly, it uses an event handler to read values and add them in the current link. 2010/9/6 Thiago H. de Paula Figueiredo thiag...@gmail.com On Mon, 06 Sep 2010 15:01:09 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Hi Hi! Logic is enclosed in ActivationRequestParameterWorker, i think you can adapt this to your needs and extract values. At the moment, I don't see any other way to identify ActivationRequestParameters during link creation. Why not just @Inject'ing the Request and using the TypeCoercer to do the needed conversions? I haven't read the ActivationRequestParameterWorker source yet, but I guess that's exactly what it does. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
On Mon, 06 Sep 2010 15:21:37 -0300, Christophe Cordenier christophe.corden...@gmail.com wrote: Actually, not exactly, it uses an event handler to read values and add them in the current link. Thanks for the correction. :) -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Thats the class I discovered earlier at work. Now my question is how to get ClassTransformation and MutableComponentModel from the Page Object in the PageResponseRenderer? Thanks for you help/hints. Regards markus Hi Logic is enclosed in ActivationRequestParameterWorker, i think you can adapt this to your needs and extract values. At the moment, I don't see any other way to identify ActivationRequestParameters during link creation. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de i would say you can get them from Request directly This only works for the current request. I need to get the parameters, which will be set for the next request/redirect. It would be possible to write get methods for the ActivationRequestParameters, but that would not be the right way. I need to find out how that is solved internally. Oh sorry, i had mis-read your first message. I didn't get deep into this new feature at the time, but at first glance, i would say you can get them from Request directly. Maybe, you can implement a worker that will be in charge of implementing an interface that will contain the method that return the values. I will go deeper to see if there is not a more simple way of doing this. 2010/9/6 Markus Feindlermarkus.feind...@gmx.de Thats what Im doing right now for the PageActivationContext, but I also need the values for the ActivationRequestParameters (introduced in 5.2: http://tapestry.apache.org/tapestry5.2-dev/apidocs/org/apache/tapestry5/annotations/ActivationRequestParameter.html ). Hi So why not passivate the page, see PageActivationContextCollector ? This is how it works to create links. 2010/9/5 Markus Feindlermarkus.feind...@gmx.de No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindler markus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
I don't know if it suits to your case, but you could use ComponentEventLinkEncoder to decode the request path... This will return you an object from which you can extract activation context values. Hope that helps 2010/9/5 Markus Feindler markus.feind...@gmx.de Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
Just curious, you try to include a portlet in a Tapestry page ? 2010/9/5 Markus Feindler markus.feind...@gmx.de Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Regards, Christophe Cordenier. Committer on Apache Tapestry 5 Co-creator of wooki @wookicentral.com
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindler markus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Retrieve ActivationRequestParameters in custom PageResponseRenderer
No, Im trying to upgrade my portlet implementation from 5.1 to 5.2 and up to now the activationrequestparameters aren't put in the url, cause I have to adjust my former 5.1 custom response renderer. If the Request is an ActionRequest (see Portlet lifecycle) you can't write output into a stream instead a redirect is done internally in the portlet container. Therefore I have to add the parameters to the ActionReponse (_actionResponse.setRenderParameter). In order to do so I need to get the parameters. That's not enough details. -- Josh On Sep 5, 2010, at 9:51 AM, Markus Feindlermarkus.feind...@gmx.de wrote: Need it for portlet implementation. Hi What is the purpose ? I guess you are dealing with some kind of dynamic stuff, please can you give more details ? 2010/9/5 Markus Feindlermarkus.feind...@gmx.de Hey folks, I need to access page field values annotated with ActivationRequestParameters in order to retrieve the values. Reflection doesnt work, because the fields are private and a java.lang.IllegalAccessException is thrown. Whats the right way to retrieve the values / activation request parameters? Regards Markus - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org