RE: Trying to use StateObjectFactory...
Hi Alexander, The way I have done this is to make the factory a service as well. contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session invoke-factory object=service:MyFactory/ /state-object /contribution service-point id=MyFactory interface=org.apache.tapestry.engine.state.StateObjectFactory invoke-factory construct class=com.test.util.SecurityBeanFactory / /invoke-factory /service-point HTH Ben -Original Message- From: Kolesnikov, Alexander GNI [mailto:[EMAIL PROTECTED] Sent: Monday, March 05, 2007 6:34 AM To: Tapestry users Subject: Trying to use StateObjectFactory... Hello everyone, I am using Tapestry 4.0.2. I want to use an ASO with some security information in it. The information should be obtained from HttpRequest on the ASO's creation. I decided to use a StateObjectFactory to create such an ASO and configured it like this: contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session invoke-factory object=com.test.util.SecurityBeanFactory/ /state-object /contribution Then I am trying to obtain the ASO in the page's code like this: @InjectState(security) public abstract SecurityBean getSecurity(); The code for the factory was more sensible, but to find a problem I left just this: public class SecureBeanFactory implements StateObjectFactory { public Object createStateObject() { SecurityBean sb = new SecurityBean(new TestUser(), new TestApplication()); return sb; } } However, I am getting an exception: org.apache.hivemind.ApplicationRuntimeException Unable to construct configuration tapestry.state.ApplicationObjects: Error: Object provider selector 'com.test.util.SecurityBeanFactory' is not properly formatted. What can be wrong here? Thanks, Alexander -- CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify the sender by e-mail at the address shown. This email transmission may contain confidential information. This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly. Please delete it from your files if you are not the intended recipient. Thank you for your compliance. Copyright 2007 CIGNA == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trying to use StateObjectFactory...
Hi Alexander, You need to define a service that you then reference in the invoke-factory: service-point id=SecurityBeanFactory interface=org.apache.tapestry.engine.state.StateObjectFactory invoke-factory construct class=com.test.util.SecurityBeanFactory !-- Any config you need here... -- /construct /invoke-factory /service-point contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session. invoke-factory object=service:SecurityBeanFactory / /state-object /contribution Cheers Richard Kolesnikov, Alexander GNI wrote: Hello everyone, I am using Tapestry 4.0.2. I want to use an ASO with some security information in it. The information should be obtained from HttpRequest on the ASO's creation. I decided to use a StateObjectFactory to create such an ASO and configured it like this: contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session invoke-factory object=com.test.util.SecurityBeanFactory/ /state-object /contribution Then I am trying to obtain the ASO in the page's code like this: @InjectState(security) public abstract SecurityBean getSecurity(); The code for the factory was more sensible, but to find a problem I left just this: public class SecureBeanFactory implements StateObjectFactory { public Object createStateObject() { SecurityBean sb = new SecurityBean(new TestUser(), new TestApplication()); return sb; } } However, I am getting an exception: org.apache.hivemind.ApplicationRuntimeException Unable to construct configuration tapestry.state.ApplicationObjects: Error: Object provider selector 'com.test.util.SecurityBeanFactory' is not properly formatted. What can be wrong here? Thanks, Alexander -- CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify the sender by e-mail at the address shown. This email transmission may contain confidential information. This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly. Please delete it from your files if you are not the intended recipient. Thank you for your compliance. Copyright 2007 CIGNA == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Trying to use StateObjectFactory...
Thank you, Richard, Are there any docs on what I can do in construct? Say, I want to obtain HttpRequest? Alexander -Original Message- From: Richard Kirby [mailto:[EMAIL PROTECTED] Sent: 05 March 2007 14:44 To: Tapestry users Subject: Re: Trying to use StateObjectFactory... Hi Alexander, You need to define a service that you then reference in the invoke-factory: service-point id=SecurityBeanFactory interface=org.apache.tapestry.engine.state.StateObjectFactory invoke-factory construct class=com.test.util.SecurityBeanFactory !-- Any config you need here... -- /construct /invoke-factory /service-point contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session. invoke-factory object=service:SecurityBeanFactory / /state-object /contribution Cheers Richard Kolesnikov, Alexander GNI wrote: Hello everyone, I am using Tapestry 4.0.2. I want to use an ASO with some security information in it. The information should be obtained from HttpRequest on the ASO's creation. I decided to use a StateObjectFactory to create such an ASO and configured it like this: contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session invoke-factory object=com.test.util.SecurityBeanFactory/ /state-object /contribution Then I am trying to obtain the ASO in the page's code like this: @InjectState(security) public abstract SecurityBean getSecurity(); The code for the factory was more sensible, but to find a problem I left just this: public class SecureBeanFactory implements StateObjectFactory { public Object createStateObject() { SecurityBean sb = new SecurityBean(new TestUser(), new TestApplication()); return sb; } } However, I am getting an exception: org.apache.hivemind.ApplicationRuntimeException Unable to construct configuration tapestry.state.ApplicationObjects: Error: Object provider selector 'com.test.util.SecurityBeanFactory' is not properly formatted. What can be wrong here? Thanks, Alexander -- CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify the sender by e-mail at the address shown. This email transmission may contain confidential information. This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly. Please delete it from your files if you are not the intended recipient. Thank you for your compliance. Copyright 2007 CIGNA == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify the sender by e-mail at the address shown. This email transmission may contain confidential information. This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly. Please delete it from your files if you are not the intended recipient. Thank you for your compliance. Copyright 2007 CIGNA == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Trying to use StateObjectFactory...
Thanks a lot, Richard, that was REALLY instructive :D And here is the configuration that I managed to get working: construct class=com.test.util.SecurityBeanFactory set-object property=request value=service:tapestry.globals.HttpServletRequest / /construct Cheers, Alexander -Original Message- From: Richard Kirby [mailto:[EMAIL PROTECTED] Sent: 05 March 2007 15:10 To: Tapestry users Subject: Re: Trying to use StateObjectFactory... Hi Alexander, There are loads of docs! The thing to know is that the construct part is a general feature of HiveMind1, so look at the docs at http://hivemind.apache.org/, however within a Tapestry project you naturally want to access Tapestry related services, so look at http://tapestry.apache.org/ for info there. For your specific question of obtaining the HttpServletRequest, you need to locate where that is offered. The route I followed is: tapestry.apache.org Select the tapestry4 version from left hand menu. Select Framework from left hand menu. Select Reports from the dropped down menu. Select HiveDoc. Search for HttpServletRequest to get the answer that tapestry.globals.HttpServletRequest is a service. Therefore to add this service to your SecurityBeanFactory, just add the line: set-service property=httpServletRequest service-id=service:HttpServletRequest / inside your construct and provide a: public void setHttpServletRequest(javax.servlet.http.HttpServletRequest request) { this.request = request; } method in your SecurityBeanFactory class. Note from the HiveDoc description that the tapestry.globals.HttpServletRequest is a threaded service, which means that it magically returns the actual HttpServletRequest object for that particular web request (cheers to Howard for such a brilliant implementation!). Cheers Richard Kolesnikov, Alexander GNI wrote: Thank you, Richard, Are there any docs on what I can do in construct? Say, I want to obtain HttpRequest? Alexander -Original Message- From: Richard Kirby [mailto:[EMAIL PROTECTED] Sent: 05 March 2007 14:44 To: Tapestry users Subject: Re: Trying to use StateObjectFactory... Hi Alexander, You need to define a service that you then reference in the invoke-factory: service-point id=SecurityBeanFactory interface=org.apache.tapestry.engine.state.StateObjectFactory invoke-factory construct class=com.test.util.SecurityBeanFactory !-- Any config you need here... -- /construct /invoke-factory /service-point contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session. invoke-factory object=service:SecurityBeanFactory / /state-object /contribution Cheers Richard Kolesnikov, Alexander GNI wrote: Hello everyone, I am using Tapestry 4.0.2. I want to use an ASO with some security information in it. The information should be obtained from HttpRequest on the ASO's creation. I decided to use a StateObjectFactory to create such an ASO and configured it like this: contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session invoke-factory object=com.test.util.SecurityBeanFactory/ /state-object /contribution Then I am trying to obtain the ASO in the page's code like this: @InjectState(security) public abstract SecurityBean getSecurity(); The code for the factory was more sensible, but to find a problem I left just this: public class SecureBeanFactory implements StateObjectFactory { public Object createStateObject() { SecurityBean sb = new SecurityBean(new TestUser(), new TestApplication()); return sb; } } However, I am getting an exception: org.apache.hivemind.ApplicationRuntimeException Unable to construct configuration tapestry.state.ApplicationObjects: Error: Object provider selector 'com.test.util.SecurityBeanFactory' is not properly formatted. What can be wrong here? Thanks, Alexander - - CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify the sender by e-mail at the address shown. This email transmission may contain confidential information. This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly. Please delete it from your files if you are not the intended recipient. Thank you for your compliance. Copyright 2007 CIGNA == == == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED