Re: T5: PageTester and services in AppModule
Hi Howard, Is getServeletContext considered part of Servlet API? I have following in a service and got NullPointerException when calling getServletContext in T5.1. It seems to me more problems encountered with PageTester when the app uses services, how to use pageTester to do some real testing is quite challenging. Angelo final private ApplicationGlobals globals; public MyServicesImpl(ApplicationGlobals globals) { this.globals = globals; } public String fileName() { String infoName = globals.getServletContext().getInitParameter("info.file.name"); return infoName; } Howard Lewis Ship wrote: > > I believe this problem is fixed in 5.1. I did some major surgery on > PageTester, and it now simulates the Tapestry Request, Response, > Session and Context objects (not the Servlet API ones, however). This > means you can test much more of your application beyond pages, > including Dispatchers contributed to MasterDispatcher, and other > filters as well. > > On Sat, Feb 14, 2009 at 7:12 AM, Angelo Chen > wrote: >> >> Hi, >> >> I'm trying to add some page test into a running application, code is just >> simple: >> >>PageTester tester = new PageTester(appPackage, appName, >> "src/main/webapp"); >>PageTester tester = new PageTester(appPackage, appName, >> "src/main/webapp"); >>Document doc = tester.renderPage("Index"); >> >> but I got an nullPointer exception when MyServices refers to globals: >> >>public MyServicesImp(ApplicationGlobals globals) { >>String infoName = >> globals.getServletContext().getInitParameter("info.file.name"); >>} >> >> adding this into AppModule fix the error: >> >> public static void >> contributeAliasOverrides(Configuration >> conf) { >> conf.add(AliasContribution.create(ApplicationGlobals.class, >> EasyMock.createMock(ApplicationGlobals.class))); >> } >> >> but another error comes out: >> Caused by: java.lang.RuntimeException: Exception constructing service >> 'ComponentMessagesSource': Error invoking service builder method >> org.apache.tapestry5.internal.services.InternalModule.buildComponentMessagesSource(AssetFactory, >> String) (at InternalModule.java:132) (for service >> 'ComponentMessagesSource'): Parameter context was null. >> >> Any idea how to fix this? is it a good idea to add PageTester to an app >> that >> uses a lot of services? >> >> Thanks, >> >> Angelo >> >> -- >> View this message in context: >> http://www.nabble.com/T5%3A-PageTester-and-services-in-AppModule-tp22013582p22013582.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 >> >> > > > > -- > Howard M. Lewis Ship > > Creator Apache Tapestry and Apache HiveMind > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/T5%3A-PageTester-and-services-in-AppModule-tp22013582p22020092.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: Login
On Sat, Feb 14, 2009 at 3:00 PM, Luther Baker wrote: > Is anyone aware of a code example integrating JSecurity with Tapestry5? I just started integrating jsecurity with T5 for use in Trails and T5 apps in general, but it'll take a while. I'm a bit put off by the ACEGI stuff ... but honestly not looked into it. Is > there a Tapestry consensus to just use that approach? > > It depends on your needs. Acegi is just as de facto standard as Spring is, but it's cumbersome (just the same way as Spring is), and not so nice to extend. In any case it's way better than CMA (Container Managed Authentication). If you need dynamic roles or rule set or instance-based security, Acegi is not a good choice. There are various smaller annoyances I've had with it, like default system-wide salt source (just doesn't make sense if you have a db), half-baked remember me, default implementation requires roles to be named ROLE_* etc. If you want basic security for your pages and operations in them with defined roles, it'll work for you and tapestry-spring-security makes it easy to use it ( http://www.localhost.nu/java/tapestry-spring-security/). Kalle
Re: intellij
in compiler settings, set resource patterns to !?*.java (everything but java file) On Sun, Feb 15, 2009 at 3:22 AM, Angelo Chen wrote: > > I think you have to update settings to include .tml file, can't remember that > where to update at this moment. > > > luther.baker wrote: >> >> I just downloaded IntelliJ 8.1 and imported my maven project. >> >> It correctly identifies src/main/resources as a src directory and copies >> the >> .properties files to target/classes ... but leaves the .tml files out. >> >> I will check my POM - maybe my filter is doing this ... but thoughts? >> >> Thanks, >> >> -Luther >> >> > > -- > View this message in context: > http://www.nabble.com/intellij-tp22018739p22018968.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 > > -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: PageTester and services in AppModule
5.1.0.0-SNAPSHOT On Sat, Feb 14, 2009 at 4:19 PM, Angelo Chen wrote: > > Hi Howard, > > Sounds good, is 5.1 as stable as 5.0.18? I did: > > 5.1 > > but it did not pull down the 5.1, any idea? thanks. > > > Howard Lewis Ship wrote: >> >> I believe this problem is fixed in 5.1. I did some major surgery on >> PageTester, and it now simulates the Tapestry Request, Response, >> Session and Context objects (not the Servlet API ones, however). This >> means you can test much more of your application beyond pages, >> including Dispatchers contributed to MasterDispatcher, and other >> filters as well. >> >> On Sat, Feb 14, 2009 at 7:12 AM, Angelo Chen >> wrote: >>> >>> Hi, >>> >>> I'm trying to add some page test into a running application, code is just >>> simple: >>> >>>PageTester tester = new PageTester(appPackage, appName, >>> "src/main/webapp"); >>>PageTester tester = new PageTester(appPackage, appName, >>> "src/main/webapp"); >>>Document doc = tester.renderPage("Index"); >>> >>> but I got an nullPointer exception when MyServices refers to globals: >>> >>>public MyServicesImp(ApplicationGlobals globals) { >>>String infoName = >>> globals.getServletContext().getInitParameter("info.file.name"); >>>} >>> >>> adding this into AppModule fix the error: >>> >>> public static void >>> contributeAliasOverrides(Configuration >>> conf) { >>> conf.add(AliasContribution.create(ApplicationGlobals.class, >>> EasyMock.createMock(ApplicationGlobals.class))); >>> } >>> >>> but another error comes out: >>> Caused by: java.lang.RuntimeException: Exception constructing service >>> 'ComponentMessagesSource': Error invoking service builder method >>> org.apache.tapestry5.internal.services.InternalModule.buildComponentMessagesSource(AssetFactory, >>> String) (at InternalModule.java:132) (for service >>> 'ComponentMessagesSource'): Parameter context was null. >>> >>> Any idea how to fix this? is it a good idea to add PageTester to an app >>> that >>> uses a lot of services? >>> >>> Thanks, >>> >>> Angelo >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/T5%3A-PageTester-and-services-in-AppModule-tp22013582p22013582.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 >>> >>> >> >> >> >> -- >> Howard M. Lewis Ship >> >> Creator Apache Tapestry and Apache HiveMind >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> >> > > -- > View this message in context: > http://www.nabble.com/T5%3A-PageTester-and-services-in-AppModule-tp22013582p22018650.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 > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Struggling With Concepts
Acutally, there's no real reason Tapestry 5.1 can't support this scheme, once we make a few more of the Link-generating and Request-path-parsing services public and overridable. On Sat, Feb 14, 2009 at 6:48 PM, Fernando Padilla wrote: > I'm sorry, but this is not quite what Tapestry is meant to solve for.. It > solves nicely for state within a page.. or within a user's session, etc etc. > > Since what you're trying to do is have your code support a form of "virtual > hosting", it might be easier if you deal with it using normal J2EE > mechanisms. > > 1) As Onno suggested, if your virtual hosts can be mapped to different > sub-domains, your code could simply look at the sub-domain to determine how > to behave: HttpServletRequest.getHost() > > 2) If you want a subdirectory method: > http://host/context/typeA/ > http://host/context/typeB/ > > We do this easily by adding a normal J2EE Filter that detects the "typeA" > part and strips it out (adding it to the contextPath, and some request > attribute for later logic). After it's been added to the contextPath, then > tapestry (or any filter/servlet after this filter) would never have to deal > with the "typeA" part of the path, only if they wanted to know which "type" > it was currently running under, it would look it up under a request > attribute or some such ( or look it up through the contextPath ). If this > could serve your purposes, I could share some code ( really small ).. > > > > On 2/13/09 6:16 PM, xfile80303 wrote: >> >> Hello all, >> >> I've been struggling to understand the concepts surrounding T5 and have >> reached a pinnacle of frustration while trying to implement a (supposedly) >> simple piece of functionality. I could very much use some guidance. >> >> What I'm trying to do is have a piece of information specifiable on the >> URL >> which will persist throughout the experience of the user. >> >> Specifically, I am trying to create an application which will be "site >> aware" (where "site" is a made-up term which implies different >> configurations/access/etc.). The "site" will need to be present in the >> URL >> in some form. With URL re-writing I suppose it is possible to have this >> as >> a parameter on the URL, or some other way which can be re-written into a >> Tapestry compatible form, but even so, I'm not sure what approach that >> form >> should take. >> >> If it is a parameter on the URL, how will that parameter persist while the >> user is browsing through the app, submitting forms, clicking links, etc? >> >> If it is an activation context, how would /that/ persist? >> >> Ultimately the ideal solution would be to have this "site" specified early >> in the URL and have Tapestry keep it there (and allow me to access its >> value) throughout the use of the app by a client. >> >> Something like: >> >> http://mysite.com/foosite/blah/blah/blah >> >> where "foosite" would be any string. >> >> As mentioned above, I suppose this could be: >> >> http://mysite.com/blah/blah/blah?site=foosite >> >> or >> >> http://mysite.com/blah/blah/blah/foosite >> >> if that makes achieving this with Tapestry any easier. >> >> I feel that Tapestry has the potential to be very useful and a great >> platform to develop on, but I'm really struggling to understand how to do >> this. >> >> Many Thanks, >> >> Levi >> --- >> For reference, here is a my previous thread: >> http://n2.nabble.com/-T5--URL-Manipulation-tt2276010.html > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: intellij
You were right - I dug a little deeper and found it had to be added in the settings. http://www.nabble.com/-T5--.tml-files-not-recognized-in-IntelliJ-td21616318.html Thanks much. -Luther On Sat, Feb 14, 2009 at 7:22 PM, Angelo Chen wrote: > > I think you have to update settings to include .tml file, can't remember > that > where to update at this moment. > > > luther.baker wrote: > > > > I just downloaded IntelliJ 8.1 and imported my maven project. > > > > It correctly identifies src/main/resources as a src directory and copies > > the > > .properties files to target/classes ... but leaves the .tml files out. > > > > I will check my POM - maybe my filter is doing this ... but thoughts? > > > > Thanks, > > > > -Luther > > > > > > -- > View this message in context: > http://www.nabble.com/intellij-tp22018739p22018968.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: [T5] Struggling With Concepts
I'm sorry, but this is not quite what Tapestry is meant to solve for.. It solves nicely for state within a page.. or within a user's session, etc etc. Since what you're trying to do is have your code support a form of "virtual hosting", it might be easier if you deal with it using normal J2EE mechanisms. 1) As Onno suggested, if your virtual hosts can be mapped to different sub-domains, your code could simply look at the sub-domain to determine how to behave: HttpServletRequest.getHost() 2) If you want a subdirectory method: http://host/context/typeA/ http://host/context/typeB/ We do this easily by adding a normal J2EE Filter that detects the "typeA" part and strips it out (adding it to the contextPath, and some request attribute for later logic). After it's been added to the contextPath, then tapestry (or any filter/servlet after this filter) would never have to deal with the "typeA" part of the path, only if they wanted to know which "type" it was currently running under, it would look it up under a request attribute or some such ( or look it up through the contextPath ). If this could serve your purposes, I could share some code ( really small ).. On 2/13/09 6:16 PM, xfile80303 wrote: Hello all, I've been struggling to understand the concepts surrounding T5 and have reached a pinnacle of frustration while trying to implement a (supposedly) simple piece of functionality. I could very much use some guidance. What I'm trying to do is have a piece of information specifiable on the URL which will persist throughout the experience of the user. Specifically, I am trying to create an application which will be "site aware" (where "site" is a made-up term which implies different configurations/access/etc.). The "site" will need to be present in the URL in some form. With URL re-writing I suppose it is possible to have this as a parameter on the URL, or some other way which can be re-written into a Tapestry compatible form, but even so, I'm not sure what approach that form should take. If it is a parameter on the URL, how will that parameter persist while the user is browsing through the app, submitting forms, clicking links, etc? If it is an activation context, how would /that/ persist? Ultimately the ideal solution would be to have this "site" specified early in the URL and have Tapestry keep it there (and allow me to access its value) throughout the use of the app by a client. Something like: http://mysite.com/foosite/blah/blah/blah where "foosite" would be any string. As mentioned above, I suppose this could be: http://mysite.com/blah/blah/blah?site=foosite or http://mysite.com/blah/blah/blah/foosite if that makes achieving this with Tapestry any easier. I feel that Tapestry has the potential to be very useful and a great platform to develop on, but I'm really struggling to understand how to do this. Many Thanks, Levi --- For reference, here is a my previous thread: http://n2.nabble.com/-T5--URL-Manipulation-tt2276010.html - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: intellij
I think you have to update settings to include .tml file, can't remember that where to update at this moment. luther.baker wrote: > > I just downloaded IntelliJ 8.1 and imported my maven project. > > It correctly identifies src/main/resources as a src directory and copies > the > .properties files to target/classes ... but leaves the .tml files out. > > I will check my POM - maybe my filter is doing this ... but thoughts? > > Thanks, > > -Luther > > -- View this message in context: http://www.nabble.com/intellij-tp22018739p22018968.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
intellij
I just downloaded IntelliJ 8.1 and imported my maven project. It correctly identifies src/main/resources as a src directory and copies the .properties files to target/classes ... but leaves the .tml files out. I will check my POM - maybe my filter is doing this ... but thoughts? Thanks, -Luther
Re: T5: PageTester and services in AppModule
Hi Howard, Sounds good, is 5.1 as stable as 5.0.18? I did: 5.1 but it did not pull down the 5.1, any idea? thanks. Howard Lewis Ship wrote: > > I believe this problem is fixed in 5.1. I did some major surgery on > PageTester, and it now simulates the Tapestry Request, Response, > Session and Context objects (not the Servlet API ones, however). This > means you can test much more of your application beyond pages, > including Dispatchers contributed to MasterDispatcher, and other > filters as well. > > On Sat, Feb 14, 2009 at 7:12 AM, Angelo Chen > wrote: >> >> Hi, >> >> I'm trying to add some page test into a running application, code is just >> simple: >> >>PageTester tester = new PageTester(appPackage, appName, >> "src/main/webapp"); >>PageTester tester = new PageTester(appPackage, appName, >> "src/main/webapp"); >>Document doc = tester.renderPage("Index"); >> >> but I got an nullPointer exception when MyServices refers to globals: >> >>public MyServicesImp(ApplicationGlobals globals) { >>String infoName = >> globals.getServletContext().getInitParameter("info.file.name"); >>} >> >> adding this into AppModule fix the error: >> >> public static void >> contributeAliasOverrides(Configuration >> conf) { >> conf.add(AliasContribution.create(ApplicationGlobals.class, >> EasyMock.createMock(ApplicationGlobals.class))); >> } >> >> but another error comes out: >> Caused by: java.lang.RuntimeException: Exception constructing service >> 'ComponentMessagesSource': Error invoking service builder method >> org.apache.tapestry5.internal.services.InternalModule.buildComponentMessagesSource(AssetFactory, >> String) (at InternalModule.java:132) (for service >> 'ComponentMessagesSource'): Parameter context was null. >> >> Any idea how to fix this? is it a good idea to add PageTester to an app >> that >> uses a lot of services? >> >> Thanks, >> >> Angelo >> >> -- >> View this message in context: >> http://www.nabble.com/T5%3A-PageTester-and-services-in-AppModule-tp22013582p22013582.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 >> >> > > > > -- > Howard M. Lewis Ship > > Creator Apache Tapestry and Apache HiveMind > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/T5%3A-PageTester-and-services-in-AppModule-tp22013582p22018650.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
Login
Is anyone aware of a code example integrating JSecurity with Tapestry5? I'm not sure how to best translate the HttpServletRequest type examples on the JSecurity site. I'm a bit put off by the ACEGI stuff ... but honestly not looked into it. Is there a Tapestry consensus to just use that approach? -Luther
Re: T5: Spring init problem in Jetty
Let's see your web.xml. On Sat, Feb 14, 2009 at 1:07 AM, Inge Solvoll wrote: > Hi! > > I''m trying to get my T5 application up and running with Spring. I've placed > the "kitchen sink" spring.jar in my WEB-INF/lib together with > tapestry-spring.jar. I'm using T5.0.18. > > I'm testing this on Tomcat 6.0.10 and Jetty 6.1.12. Tomcat initializes > correctly, and spring injects work nicely from Tapestry pages. But in Jetty, > spring won't initialize on startup, and I get the exception listed below. > > I have ONE spring listener and ZERO spring servlets and filters. I have > replaced TapestryFilter with TapestrySpringFilter. If I remove the spring > context loader listener, I get the expected message from tapestry saying > that the spring context hasn't been initialized. But all this seems > meaningless to pursue, since spring/tapestry integration is working > correctly in Tomcat with my current setup. Does anyone have a clue? Does > Jetty have some kind of built-in spring support that gets in my way? > > I realize that the problem seems to be related to Jetty and Spring, and not > to Tapestry. I'm still hoping that you guys can help me on this one, as this > is a very common case for most of us. > > 2009-02-14 09:48:14.995:/moby:INFO: Initializing Spring root > WebApplicationContext > 2009-02-14 09:48:15.941::WARN: Failed startup of context > org.mortbay.jetty.webapp.webappcont...@7afaa550 > {/moby,c:/dev/projects/Moby/web} > java.lang.IllegalStateException: Cannot initialize context because there is > already a root application context present - check whether you have multiple > ContextLoader* definitions in your web.xml! >at > org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:182) >at > org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) >at > org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:547) >at org.mortbay.jetty.servlet.Context.startContext(Context.java:136) >at > org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1233) >at > org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:516) >at > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:459) >at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42) >at > org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) >at > org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156) >at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42) >at > org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) >at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42) >at > org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) >at org.mortbay.jetty.Server.doStart(Server.java:222) >at > org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42) >at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985) >at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >at java.lang.reflect.Method.invoke(Method.java:597) >at org.mortbay.start.Main.invokeMain(Main.java:194) >at org.mortbay.start.Main.start(Main.java:523) >at org.mortbay.start.Main.main(Main.java:119) > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Property convention (private field bad for testing)
On Sat, Feb 14, 2009 at 3:53 AM, Thiago H. de Paula Figueiredo wrote: > On Fri, Feb 13, 2009 at 8:24 PM, manuel aldana wrote: >> Why was the decision taken that fields must be private for @Property >> (security reasons, so fields can't be changed directly from default >> visibility -> package level)? From testing perspective this is not so nice. > > First of all, OOP recomends private fields for almost any situation. > Regarding @Property, I guess it was a implementation issue. All > Tapestry annotations must be put in private fields. If they could have > another visibility, Tapestry would have to locate all places that use > that field. If they're private, you only have to look at that class. The AOP aspect of how Tapestry interacts with fields becomes infinitely more complex if you have non-private fields. I suspect that to support non-private fields, you would have to jettison live class reloading and perhaps add a build stage to do the necessary instrumenting. I'm happy with what I've got. In t.1 (and maybe 5.0.18), there are some utility methods on the TestBase class for setting private field values using reflection, suitable for use on non-instrumented classes as part of a test. > > If you use need field access outside the declaring class, use getters > and setters instead of @Property or create package-private methods for > testing purposes like Igor suggested. That's exactly what Tapestry > does in its components. > > -- > Thiago > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: PageTester and services in AppModule
I believe this problem is fixed in 5.1. I did some major surgery on PageTester, and it now simulates the Tapestry Request, Response, Session and Context objects (not the Servlet API ones, however). This means you can test much more of your application beyond pages, including Dispatchers contributed to MasterDispatcher, and other filters as well. On Sat, Feb 14, 2009 at 7:12 AM, Angelo Chen wrote: > > Hi, > > I'm trying to add some page test into a running application, code is just > simple: > >PageTester tester = new PageTester(appPackage, appName, > "src/main/webapp"); >PageTester tester = new PageTester(appPackage, appName, > "src/main/webapp"); >Document doc = tester.renderPage("Index"); > > but I got an nullPointer exception when MyServices refers to globals: > >public MyServicesImp(ApplicationGlobals globals) { >String infoName = > globals.getServletContext().getInitParameter("info.file.name"); >} > > adding this into AppModule fix the error: > > public static void contributeAliasOverrides(Configuration > conf) { > conf.add(AliasContribution.create(ApplicationGlobals.class, > EasyMock.createMock(ApplicationGlobals.class))); > } > > but another error comes out: > Caused by: java.lang.RuntimeException: Exception constructing service > 'ComponentMessagesSource': Error invoking service builder method > org.apache.tapestry5.internal.services.InternalModule.buildComponentMessagesSource(AssetFactory, > String) (at InternalModule.java:132) (for service > 'ComponentMessagesSource'): Parameter context was null. > > Any idea how to fix this? is it a good idea to add PageTester to an app that > uses a lot of services? > > Thanks, > > Angelo > > -- > View this message in context: > http://www.nabble.com/T5%3A-PageTester-and-services-in-AppModule-tp22013582p22013582.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 > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5: PageTester and services in AppModule
Hi, I'm trying to add some page test into a running application, code is just simple: PageTester tester = new PageTester(appPackage, appName, "src/main/webapp"); PageTester tester = new PageTester(appPackage, appName, "src/main/webapp"); Document doc = tester.renderPage("Index"); but I got an nullPointer exception when MyServices refers to globals: public MyServicesImp(ApplicationGlobals globals) { String infoName = globals.getServletContext().getInitParameter("info.file.name"); } adding this into AppModule fix the error: public static void contributeAliasOverrides(Configuration conf) { conf.add(AliasContribution.create(ApplicationGlobals.class, EasyMock.createMock(ApplicationGlobals.class))); } but another error comes out: Caused by: java.lang.RuntimeException: Exception constructing service 'ComponentMessagesSource': Error invoking service builder method org.apache.tapestry5.internal.services.InternalModule.buildComponentMessagesSource(AssetFactory, String) (at InternalModule.java:132) (for service 'ComponentMessagesSource'): Parameter context was null. Any idea how to fix this? is it a good idea to add PageTester to an app that uses a lot of services? Thanks, Angelo -- View this message in context: http://www.nabble.com/T5%3A-PageTester-and-services-in-AppModule-tp22013582p22013582.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.0.18] Bug? : Null property problem with the custom component inside a grid
Hi, @Persist is already there on "books". Anyway, I have no problem with the listing of the search results. Only the images in the grid are not displayed, because of this "null property" problem. I have already tried @Persist on the "book" property (row object of the grid) in the Search page, too. In this case, the images are indeed displayed, but then in the image cells of all books only the image of the last book in the result list. I mean, if there are 3 books, three times the image of the last book, which is for me somehow comprehensible (not totally yet, though :-)). Thanks anyway for the reply. iren Otho wrote: > > Maybe some problem in the setup of the grid page? > > Like forgetting the @Persist on the books list? > > Otho > > -- View this message in context: http://n2.nabble.com/-T5.0.18--Bug--%3A-Null-property-problem-with-the-custom-component-inside-a-grid-tp2324166p2326447.html Sent from the Tapestry Users 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: @Property convention (private field bad for testing)
On Fri, Feb 13, 2009 at 8:24 PM, manuel aldana wrote: > Why was the decision taken that fields must be private for @Property > (security reasons, so fields can't be changed directly from default > visibility -> package level)? From testing perspective this is not so nice. First of all, OOP recomends private fields for almost any situation. Regarding @Property, I guess it was a implementation issue. All Tapestry annotations must be put in private fields. If they could have another visibility, Tapestry would have to locate all places that use that field. If they're private, you only have to look at that class. If you use need field access outside the declaring class, use getters and setters instead of @Property or create package-private methods for testing purposes like Igor suggested. That's exactly what Tapestry does in its components. -- Thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] Struggling With Concepts
> Specifically, I am trying to create an application which will be "site > aware" (where "site" is a made-up term which implies different > configurations/access/etc.). The "site" will need to be present in the URL > in some form. I don't know how many sites you are offering, but have you thought about using different domains or subdomains? Then http://site1.mysite.com and http://site2.mysite.com would get you into the different sites for example. By injecting the Request into your pages and components you can determine what to do and there is no need for url-rewriting. We are using a single application to serve a full version of our product and a light-version, which both have their own url. Based on the url you used for accessing the application the correct welcome page/site style is shown and after the user logged in we know which plan (s)he has purchased and can forward the user to correct url. In the light version there are less pages available (the pages of the full version return a 404 if you don't have a subscription to the premium service). Also components can render paths to different pages based on the active version for the user. We are using subdomains to indicate acceptance and test-environment and while developing we support an url-parameter on the home-page to switch site-mode to ease local testing. regards, Onno
Re: [T5.0.18] Bug? : Null property problem with the custom component inside a grid
Maybe some problem in the setup of the grid page? Like forgetting the @Persist on the books list? Otho
T5: Spring init problem in Jetty
Hi! I''m trying to get my T5 application up and running with Spring. I've placed the "kitchen sink" spring.jar in my WEB-INF/lib together with tapestry-spring.jar. I'm using T5.0.18. I'm testing this on Tomcat 6.0.10 and Jetty 6.1.12. Tomcat initializes correctly, and spring injects work nicely from Tapestry pages. But in Jetty, spring won't initialize on startup, and I get the exception listed below. I have ONE spring listener and ZERO spring servlets and filters. I have replaced TapestryFilter with TapestrySpringFilter. If I remove the spring context loader listener, I get the expected message from tapestry saying that the spring context hasn't been initialized. But all this seems meaningless to pursue, since spring/tapestry integration is working correctly in Tomcat with my current setup. Does anyone have a clue? Does Jetty have some kind of built-in spring support that gets in my way? I realize that the problem seems to be related to Jetty and Spring, and not to Tapestry. I'm still hoping that you guys can help me on this one, as this is a very common case for most of us. 2009-02-14 09:48:14.995:/moby:INFO: Initializing Spring root WebApplicationContext 2009-02-14 09:48:15.941::WARN: Failed startup of context org.mortbay.jetty.webapp.webappcont...@7afaa550 {/moby,c:/dev/projects/Moby/web} java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml! at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:182) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:547) at org.mortbay.jetty.servlet.Context.startContext(Context.java:136) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1233) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:516) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:459) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:222) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42) at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mortbay.start.Main.invokeMain(Main.java:194) at org.mortbay.start.Main.start(Main.java:523) at org.mortbay.start.Main.main(Main.java:119)