Tapestry 5: @Property object is null when using in onActivate
Hi I have a situation where I have a @property object. @Property private Command cmd. My onActivate would take an id and load it from db and set the obj onActivate(Integer databaseId) { DBRecord dbRecord = myDao.getById(databaseId); if (dbRecord != null) { cmd.setVal(dbRecord.getValue()); -- causes npe } } How would I be able to load the db object from db and than setup the value of Object into the command. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-Property-object-is-null-when-using-in-onActivate-tp4335791p4335791.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5: @Property object is null when using in onActivate
Hi Where do you initialize 'cmd' ? The variable has to be initialized somewhere. @Property only creates public setter/getter for you, you have to create an instance yourself. Do something like cmd = new Command() somewhere in onActivate() before using cmd regards Taha On Sun, Apr 24, 2011 at 11:37 AM, cablepuff cablep...@gmail.com wrote: Hi I have a situation where I have a @property object. @Property private Command cmd. My onActivate would take an id and load it from db and set the obj onActivate(Integer databaseId) { DBRecord dbRecord = myDao.getById(databaseId); if (dbRecord != null) { cmd.setVal(dbRecord.getValue()); -- causes npe } } How would I be able to load the db object from db and than setup the value of Object into the command. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-Property-object-is-null-when-using-in-onActivate-tp4335791p4335791.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5: @Property object is null when using in onActivate
Hi I tried it. End up getting this. Firefox has detected that the server is redirecting the request for this address in a way that will never complete. It seems like their is a endless loop going from onActivate and object annotated with @property -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-Property-object-is-null-when-using-in-onActivate-tp4335791p4336539.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Latest tapx 1.1 snapshot depends on T5.3
My mistake, will fix shortly. On Apr 23, 2011 4:24 PM, Luca Menegus lu...@dbmsrl.com wrote: Hi, I've noticed that the latest tapx 1.1 snapshot [1] deployed into http://howardlewisship.com/snapshot-repository/ repository depends on T5.3.0-SNAPSHOT and not on T5.2.x. In facts it is no more usable with T5.2: It throws IncompatibleClassChangeError when trying to load com.howardlewisship.tapx.core.services.ExtensibleJavaScriptStack$1 It seems that the 1.2 branch was created to work with T5.3, so the artifacts must have slipped in. Additional info: - latest working snapshot was [2] regards, Luca [1] http://howardlewisship.com/snapshot-repository/com/howardlewisship/tapx-core/1.1-SNAPSHOT/tapx-core-1.1-20110421.231707-21.pom [2] http://howardlewisship.com/snapshot-repository/com/howardlewisship/tapx-core/1.1-SNAPSHOT/tapx-core-1.1-20110408.223432-20.pom - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5: @Property object is null when using in onActivate
Are you returning something from onActivate() method ? It will help if you share the code causing the problem. regards Taha On Sun, Apr 24, 2011 at 9:28 PM, cablepuff cablep...@gmail.com wrote: Hi I tried it. End up getting this. Firefox has detected that the server is redirecting the request for this address in a way that will never complete. It seems like their is a endless loop going from onActivate and object annotated with @property -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-Property-object-is-null-when-using-in-onActivate-tp4335791p4336539.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[ANN] tapestry-breadcrumbs
Hi, Just wanted to mention that I just released my little bread crumb trail library tapestry-breadcrumbs over at Github (https://github.com/argoyle/tapestry-breadcrumbs). It should be available at Maven Central soonish I hope. It's not much but I hope it can be of use. Regards, Joakim - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Plastic: nondeterministic PlasticManager behavior
Hi, i'm taking a deep dive into plastic and came across a behavior i cannot explain. If i create a ClassInstantiator from a PlasticManager that was created with the transformers and packages in the constructor, i get the PlasticClass in my transformer where i can e.g. assert that the class under test has only one method. But if i instantiate a PlasticManager with the empty constructor and call createClass() with the class under test and the transformer, the transformer will always return an empty list if i ask the PlasticClass for the number of methods. Can somebody explain why? g, kris public class PlasticManagerExperiment { private final PlasticClassTransformer transformer = new PlasticClassTransformer() { @Override public void transform(PlasticClass plasticClass) { assert plasticClass.getMethods().size() == 1; } }; @Test public void instantiate_without_packages() { PlasticManager m = new PlasticManager(); m.createClass(ClassUnderTest.class, transformer); } @Test public void instantiate_with_packages() { PlasticManager m = new PlasticManager(Thread.currentThread().getContextClassLoader(), new StandardDelegate(transformer), new HashSetString(Arrays.asList(ClassUnderTest.class.getPackage().getName(; m.getClassInstantiator(ClassUnderTest.class.getName()); } } - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: IOC Setter injection
On Fri, 22 Apr 2011 08:18:24 -0300, Denis Stepanov denis.stepa...@gmail.com wrote: Is there any way to use setter injection in Tapestry IOC? Yes, but not using autobuilding. Use a builder method instead: public static YourService buildYourService(DependencyType1 type1, ...) { YourService service = new ...; service.setDependencyType1(type1); return build; } -- 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
Link to root
What is the best way to get the url of the root of a web application? In other words, If I'm on a page like: http://server:8080/appname/mypage?showAll=true I want to get: http://server:8080/appname I tried using: pageRenderLinkSource.createPageRenderLink(Index).toAbsoluteURI(); But that seems to retain the Request Parameters. I could use a regex to strop them off, but I'm guessing that I'm missing a better way to do it. Mark
Re: IOC Setter injection
Actually setter injection is supposed to work when autobuilding services. Отправлено с iPhone 25.04.2011, в 00:00, Thiago H. de Paula Figueiredo thiag...@gmail.com написал(а): On Fri, 22 Apr 2011 08:18:24 -0300, Denis Stepanov denis.stepa...@gmail.com wrote: Is there any way to use setter injection in Tapestry IOC? Yes, but not using autobuilding. Use a builder method instead: public static YourService buildYourService(DependencyType1 type1, ...) { YourService service = new ...; service.setDependencyType1(type1); return build; } -- 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Link to root
One way to do it: @Inject private Request request; ... int port = request.getServerPort(); String serverName = request.getServerName(); On Sun, Apr 24, 2011 at 7:28 PM, Mark mark-li...@xeric.net wrote: What is the best way to get the url of the root of a web application? In other words, If I'm on a page like: http://server:8080/appname/mypage?showAll=true I want to get: http://server:8080/appname I tried using: pageRenderLinkSource.createPageRenderLink(Index).toAbsoluteURI(); But that seems to retain the Request Parameters. I could use a regex to strop them off, but I'm guessing that I'm missing a better way to do it. Mark
Re: Link to root
Try @Inject private RequestGlobals requestGlobals; requestGlobals.getHttpServletRequest().getContextPath() regards Taha On Mon, Apr 25, 2011 at 6:37 AM, Bryan Lewis jbryanle...@gmail.com wrote: One way to do it: @Inject private Request request; ... int port = request.getServerPort(); String serverName = request.getServerName(); On Sun, Apr 24, 2011 at 7:28 PM, Mark mark-li...@xeric.net wrote: What is the best way to get the url of the root of a web application? In other words, If I'm on a page like: http://server:8080/appname/mypage?showAll=true I want to get: http://server:8080/appname I tried using: pageRenderLinkSource.createPageRenderLink(Index).toAbsoluteURI(); But that seems to retain the Request Parameters. I could use a regex to strop them off, but I'm guessing that I'm missing a better way to do it. Mark
Re: Link to root
Thanks Brian and Taha. I know I can build what I need by combining both of your suggestions. I wanted to make sure there wasn't a simple way to get what I wanted without needing to build it manually, but it doesn't sound like there is another way to get this directly from Tapestry. Thanks for your help. Mark On Sun, Apr 24, 2011 at 8:15 PM, Taha Hafeez tawus.tapes...@gmail.comwrote: Try @Inject private RequestGlobals requestGlobals; requestGlobals.getHttpServletRequest().getContextPath() regards Taha On Mon, Apr 25, 2011 at 6:37 AM, Bryan Lewis jbryanle...@gmail.com wrote: One way to do it: @Inject private Request request; ... int port = request.getServerPort(); String serverName = request.getServerName(); On Sun, Apr 24, 2011 at 7:28 PM, Mark mark-li...@xeric.net wrote: What is the best way to get the url of the root of a web application? In other words, If I'm on a page like: http://server:8080/appname/mypage?showAll=true I want to get: http://server:8080/appname I tried using: pageRenderLinkSource.createPageRenderLink(Index).toAbsoluteURI(); But that seems to retain the Request Parameters. I could use a regex to strop them off, but I'm guessing that I'm missing a better way to do it. Mark
Re: Tapestry 5: @Property object is null when using in onActivate
public Object onActivate(final Integer databaseId) { Validate.notNull(this.myCommand, command should be injected); this.dbRecord = this.myDao.getRecordById(databaseId); final User user = this.securityService.getCurrentUser(); Object obj = this; if (user == null) { obj = this.index; } else { this.myCommand.setValue(dbRecord.getValue()); this.databaseId = databaseId; } return obj; } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-Property-object-is-null-when-using-in-onActivate-tp4335791p4337766.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Event Handler Method
Hi, If I have an event link for a request. I can find the target component (with its proper class) with the ComponentSourceService. Is there a more elegant way to find the event handler method that will be invoked on the component than to search through matching method names in the component class (by reflection) and compare parameters (or check OnEvent annotations)? Background is that I want to create a new Annotation on an event handler method and need to check this when creating a special link in a custom ComponentEventLinkEncoder. Thanks Moritz - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org