T5: RESTful web services module
Well, against my better judgment, I've posted the little jar I use to make T5 services serve RESTful web service requets. It does this by shooting a RequestFilter into the pipeline that you contribute your service classes to via the IoC. The code and some documentation are at http://code.google.com/p/t5-restful-webservices/ This is ALPHA software, allowing only one method in a T5 service to handle RESTful web service requests. I'm planning to have the beta version include an annotation you can stick on any IoC service method that will restful-web-service-enable it. Feel free to flame. Bill in Austin
Re: Reloading component templates from Maven's jetty plugin
Classes under myapp.components, myapp.pages, myapp.base and myapp.mixins are hot-deployed by Tapestry. Exclude these from the Jetty hot-deploy feature. Olle 2008/12/22 Josh Long starbux...@gmail.com Thank you for the help. I've adjusted my IntelliJ environment as you suggested and its working, sort of. It does seem like a waste, though. For my page templates I need only make a change and jetty scans it and makes the change. With the component templates, jetty perceives it as a class change, which necessitates a restart of the web app. This is, frankly, no better than using JSF with the jetty plugin. What, exactly, is the use case described in the docs where it says component and page templates will be reloaded? I have no doubt it works somewhere, but it's not fully elaborated upon. What do I have to use/ do to have true reloading of component an page templates without restarting the app? Do I need Eclipse on OS X with Tomcat? What's the happy path of that feature? I'm willing to switch to whatever it is... Thanks, as usual, for your indulgence, Josh http://www.joshlong.com On Sun, Dec 21, 2008 at 2:41 PM, Hugo Palma hugo.m.pa...@gmail.com wrote: I have that same setup running without any problems, T5 + Jetty + Maven + IntelliJ. Can you check if IntelliJ is copying your templates to the build directory (target/classes) ? If not then check if you have the following configured: - src/main/resources configured as a source directory in IntelliJ. - you have configured IntelliJ to compile .tml files. (Settings - Compiler - Resource Patterns) On Sun, Dec 21, 2008 at 7:46 AM, Josh Long starbux...@gmail.com wrote: Hi, I have a maven project generated usig the stock mvn archetype for tapestry 5. According to the docs, component templates should be in src/main/resources/. I can't seem to get those to 'reload' correctly, forcing me to ctrl + c the maven jetty plug in and re run. Any input on how to change this (from tapestry or the maven jetty plug in?) would be appreciated. I'm editing in Intellij (I opened the pom with IntelliJ, which in turn created a project). Im doing Build Rebuild project to try and trigger the refresh, but no go. Any input on possible configuration changes/options woud be appreciated. Thanks Josh - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Joshua Long http://www.joshlong.com/ -- Olle Hallin Senior Java Developer and Architect olle.hal...@crisp.se www.crisp.se
Tapestry 5 with Spring Security - problem with unit tests.
Hi there, I've integrated spring security to my sample tapestry5 application (I'm using version 5.0.18) based on tapestry-spring-security (http://www.localhost.nu/java/tapestry-spring-security), but now my unit tests that use PageTester don't work, because there is no Authentication object in SecurityContext. I thought about creating SecurityContext, something like: SecurityContext securityContext = new SecurityContextImpl(); User user = new User(); user.setId(1L); user.setUsername(user); user.setPassword(password); UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken( user.getUsername(), user.getPassword(), user.getAuthorities()); token.setDetails(user); securityContext.setAuthentication(token); and adding it to the rendered page through PageTester, as it is described in http://tapestry.apache.org/tapestry5/guide/unit-testing-pages.html: PageTester tester = new PageTester(appPackage, appName, src/main/webapp); Object[] context = new Object[]{ abc, 123 }; Document doc = tester.invoke(new ComponentInvocation(new PageLinkTarget(MyPage), context)); However this doesn't work, ComponentInvocation is an interface and I don't know how to initialize properly ComponentInvocationImpl. Anyone care to help? -- Michał Jedynak
Re: Reloading component templates from Maven's jetty plugin
Ive done the following - src/main/resources configured as a source directory in IntelliJ. - you have configured IntelliJ to compile .tml files. (Settings - Compiler - Resource Patterns) still only picks up changes to tml files under webapp folder ie to pages not components. @Olle - how do you exclude myapp.components, myapp.pages from the jetty hot-deploy feature? Right now in target/classes I have three folders - components/pages/services. Components folder has both .tml files and .class files. Pages directory has only .class files. ..kace -- View this message in context: http://www.nabble.com/Reloading-component-templates-from-Maven%27s-jetty-plugin-tp21112833p21127419.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[T5] Exposing child component parameters : inherit, autoconnect... Nothing better ?
In my component building, I have a really common pattern which is: - I have a child component, which has a parameter, like : t:ChildComponent childParameter=... / - I have a parent component, in which I use ChildComponent (standard component composition), and I want to expose some or all parameters of ChildComponent as parameter for ParentComponent. For now, I believe that there is only two way of dealing with it: - the ChilParameter parameter may be marked as autoconnect, and so if ParentComponent has a parameter named ChildParameter, the binding is done for me ; - the ChilParameter parameter is not marked as autoconnect. So in my ParentComponent, I can have a parameter named ParentParameter, and use inherit as bindind for the ChildParameter: @Parameter private ParentParameter pp; @Component(parameters={ChilParameter=inherit:ParentParameter}) private ChildComponent cc; That seems not good, because in each case, I have to declare in the parent all the exposed parameter (and for the autoconnect, I have to be able to modify the child component, what ease not always possible if it is in the core lib, or in a third party one). So, if I want to expose a lot of parameter from child in parent, I have a lot of copy/paste to do, and this kind of stuff is really error and refactoring prone. I also understand that it is unwanted to expose child parameters without warning, so what I need is an expose parameter for the Component annotation that takes a list of properties names and make the @Paramater private ParentParameter / ChilParameter=inherit:ParentParameter}) for me. Is there already somethink like that in T5, or do I have to copy/paste parameters ? -- Francois Armand Etudes Développements J2EE Groupe Linagora - http://www.linagora.com Tél.: +33 (0)1 58 18 68 28 --- http://fanf42.blogspot.com InterLDAP - http://interldap.org FederID - http://www.federid.org/ Open Source identities management and federation - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5: how to make a module that is available to two t5 apps?
Hi, I have a project similar to this: 1) T5 web app 2) T5 IOC only app This has been working quite nicely, now I need to have some classes/services which should be used by #1 and #2, that means I need another module that can be compiled into jar file that #1 and #2 can call, any idea how to achieve this? Thanks. Angelo -- View this message in context: http://www.nabble.com/T5%3A-how-to-make-a-module-that-is-available-to-two-t5-apps--tp21129534p21129534.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: how to make a module that is available to two t5 apps?
Hi, This can help: http://tapestry.apache.org/tapestry5/cookbook/lib.html /Serge Angelo Chen wrote: Hi, I have a project similar to this: 1) T5 web app 2) T5 IOC only app This has been working quite nicely, now I need to have some classes/services which should be used by #1 and #2, that means I need another module that can be compiled into jar file that #1 and #2 can call, any idea how to achieve this? Thanks. Angelo -- View this message in context: http://www.nabble.com/T5%3A-how-to-make-a-module-that-is-available-to-two-t5-apps--tp21129534p21129584.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 with Spring Security - problem with unit tests.
Hi, This seems to be related to this thread: http://www.nabble.com/PageLinkTarget%2C-where-did-it-go--to21022001.html#a21022001 /Serge Michał Jedynak wrote: Hi there, I've integrated spring security to my sample tapestry5 application (I'm using version 5.0.18) based on tapestry-spring-security (http://www.localhost.nu/java/tapestry-spring-security), but now my unit tests that use PageTester don't work, because there is no Authentication object in SecurityContext. I thought about creating SecurityContext, something like: SecurityContext securityContext = new SecurityContextImpl(); User user = new User(); user.setId(1L); user.setUsername(user); user.setPassword(password); UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken( user.getUsername(), user.getPassword(), user.getAuthorities()); token.setDetails(user); securityContext.setAuthentication(token); and adding it to the rendered page through PageTester, as it is described in http://tapestry.apache.org/tapestry5/guide/unit-testing-pages.html: PageTester tester = new PageTester(appPackage, appName, src/main/webapp); Object[] context = new Object[]{ abc, 123 }; Document doc = tester.invoke(new ComponentInvocation(new PageLinkTarget(MyPage), context)); However this doesn't work, ComponentInvocation is an interface and I don't know how to initialize properly ComponentInvocationImpl. Anyone care to help? -- Michał Jedynak -- View this message in context: http://www.nabble.com/Tapestry-5-with-Spring-Security---problem-with-unit-tests.-tp21126486p21129652.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
Accessing form data inside AddRowLink
Is it possible to access form data inside AddRowLink? I am trying to get hold of the category value which is defined as: @Persist @Property private Category category; form t:type=form t:id=valuesedit t:errors/ table thead tr thId/th thCategory/th thName/th thAction/th /tr /thead tbody tr t:type=AJaxFormLoop t:source=valueHolders t:value=valueHolder t:encoder=encoder t:unless t:test=valueHolder.deleted t:submitnotifier td${valueHolder.value.id}/td tdvalueHolder.category.name/td tdt:select model=valueSelectModel encoder=valueSelectModel value=valueHolder.value//td tdt:removerowlinkremove/t:removerowlink/td /t:submitnotifier /t:unless t:parameter name=addRow td colspan=5 style=text-align: right t:select model=categorySelectModel encoder=categorySelectModel value=category/ t:addrowlinkAdd a row/t:addrowlink /td /t:parameter /tr /tbody /table input type=submit value=Save/ t:actionlink id=refreshRefresh/t:actionlink /form - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: PageLinkTarget, where did it go?
I have a similar issue: http://www.nabble.com/Tapestry-5-with-Spring-Security---problem-with-unit-tests.-td21126486.html. The problem is not about PageLinkTarget - PageRenderTarget, but about the way to properly initialize ComponentInvocationImpl. nille hammer wrote: Hi Mark, first I have to admit I am not familliar with Tapestry´s testing mechanisms so this information is based on browsing through the javadocs rather than experience. I think this is the class you are looking for: http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/internal/services/PageRenderTarget.html Hope that helps, cheers nillehammer - original Nachricht Betreff: PageLinkTarget, where did it go? Gesendet: Mo, 15. Dez 2008 Von: Mark Hornmark.h...@agilesrc.com I am in the process of updating our application from Tapestry version 5.0.15 to 5.0.18 and it looks like PageLinkTarget has disappeared. We have been following the Unit testing as outlined http://tapestry.apache.org/tapestry5/guide/unit-testing-pages.html which uses the PageLinkTarget when testing a page with a context. I looked around and can't find the class or any documentation on what its replacement is. Any help is greatly appreciated. Thanks, Mark - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --- original Nachricht Ende - 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/PageLinkTarget%2C-where-did-it-go--tp21022001p21134364.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: Reloading component templates from Maven's jetty plugin
See http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin .http://docs.codehaus.org/display/JETTY/Maven+Jetty+PluginSearch for excludes. Olle 2008/12/22 kace me_myself_and_...@hotmail.com Ive done the following - src/main/resources configured as a source directory in IntelliJ. - you have configured IntelliJ to compile .tml files. (Settings - Compiler - Resource Patterns) still only picks up changes to tml files under webapp folder ie to pages not components. @Olle - how do you exclude myapp.components, myapp.pages from the jetty hot-deploy feature? Right now in target/classes I have three folders - components/pages/services. Components folder has both .tml files and .class files. Pages directory has only .class files. ..kace -- View this message in context: http://www.nabble.com/Reloading-component-templates-from-Maven%27s-jetty-plugin-tp21112833p21127419.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 -- Olle Hallin Senior Java Developer and Architect olle.hal...@crisp.se www.crisp.se
T5: encoding issues
Hi, I have a strange issue with character encoding. I use Tapestry 5 on a Tomcat 6.0.18 installation. No difference between java5 or java6, MacOSX or Linux. Special characters on my pages look fine when they come from a .tml file, whne they come from a .properties file used for translations, and when they come from a database. They get garbled however if they come directly from some Java class. As an example a page class with the following method: public String getSomeString() { return Water boils at 100 °C.; } and this in the corresponding .tml file: Remember: ${someString} creates output like: Remember: Water boils at 100¬∞C. Maybe it's not even a Tapestry issue, but a Tomcat one? Thanks, Christoph Jäger - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Cached Annotation watch property seems to use '==' instead of 'equals'
I'm trying to use the '@Cached' annotation with a watch expression to cache results of methods in a form contained within a loop. For some watch expressions, I construct a string, so the code basically looks like @Cached(watch=watchKey) Object getData() { // return data; } String getWatchKey() { return a.toString() + : + b.toString(); } When I do this, though, the cached annotation does not seem to work properly, in that the 'getData()' method is called multiple times in a request. The problem seems to be that '==' is used instead of 'equals' in the code 'CachedWorker' generates to compare the result of the watch expression. Is this intentional, so we need to make sure the watch expression returns the exact same object if we want to use a cached value? Or should it be changed to use 'equals'? Doug - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Confirm(are you sure want to delete) in action link
hi, i have found a solution. http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained this one maybe can help up Thank you. Tan. On Fri, Dec 12, 2008 at 7:21 PM, Martijn Brinkers martijn.l...@gmail.comwrote: Could you check if the Event.stop(event) works when used directly from the onclick event handler? So in you page tml file use something like: input onclick=Event.stop(event); alert('event was stopped'); / Martijn On Fri, 2008-12-12 at 03:12 -0800, zack1403 wrote: My component uses Event.stop and it wont actually stop the form submit. Martijn Brinkers (List)-2 wrote: I think it's more a prototype issue than a Tapestry issue I think you can stop the event with: Event.stop(event); So your onclick should look something like onclick=if(!confirm('Are you sure want to delete?')) Event.stop(event); Regards, Martijn Brinkers On Fri, 2008-12-12 at 11:25 +0100, Andy Pahne wrote: This is sad. We cannot even fill a JIRA, because Confirm is not part of the framework. Andy zack1403 schrieb: I am using the confirm functionality as a component and am having similar problems. Confirm does not work with the linkSubmit component. It is currently a major bug in my app. Zack Tan cyb...@n wrote: hi, i'm a newbie in tapestry. may i know is it possible to do like: t:actionlink t:zone=zoneFormView t:id=toolbarDel t:context=${id} onclick=if(!confirm('Are you sure want to delete?')) return false;button images/deleteRecord24.png /button/t:actionlink I have tried to put in button as well, but after choose cancel. it will still submit. May i know how to avoid the postback? Thank you. Tan - 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: Cached Annotation watch property seems to use '==' instead of 'equals'
Looks like an oversight to me ... using equals() would make more sense to me as well. It is intended primarily for Hibernate entities, but equals() works there as well, as Hibernate ensures that primary key identity is the same as object identity with a context. Perhaps Dan can shed some light? @Cached was written by Dan Adams. On Mon, Dec 22, 2008 at 4:44 PM, Doug Hauge doug.ha...@lithium.com wrote: I'm trying to use the '@Cached' annotation with a watch expression to cache results of methods in a form contained within a loop. For some watch expressions, I construct a string, so the code basically looks like @Cached(watch=watchKey) Object getData() { // return data; } String getWatchKey() { return a.toString() + : + b.toString(); } When I do this, though, the cached annotation does not seem to work properly, in that the 'getData()' method is called multiple times in a request. The problem seems to be that '==' is used instead of 'equals' in the code 'CachedWorker' generates to compare the result of the watch expression. Is this intentional, so we need to make sure the watch expression returns the exact same object if we want to use a cached value? Or should it be changed to use 'equals'? Doug - 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
Tapestry 5, Netbeans 6.5
We recently got a very basic Tapestry 5 app working with NetBeans 6.5 on Windows. We did not use Hibernate, Spring, or Maven (Maven's repository is blocked by work proxy server). Just thought I would post what we did in case it was useful to anyone else. A lot of this came from the official tutorial (http://tapestry.apache.org/tapestry5/tutorial1/) and the Tapestry for Non-Believers tutorial (http://www.infoq.com/articles/tapestry5-intro). Here is how we got it working: 1. Download and install the latest JDK 1.6 (We used 1.6.0_07) 2. Download Tapestry 5.0.18 (currently the latest release) and unzip somewhere convenient. 3. Download NetBeans 6.5 (We used build 20081111), the Java version that includes Tomcat. 4. Install NetBeans; you may to have to specify that you want to install Tomcat. 5. After the install, open NetBeans and go to File - New Project 6. Choose Java Web - Web Application 7. Name the project something like Test and keep the default options (Set as main project), then hit Next. 8. If you don't have a Server listed, hit Add and follow the steps to set up a Tomcat server. 9. Leave frameworks empty and hit Finish. Now you should have a basic Web project that will compile and run in Tomcat. To convert this to a Tapestry application: 10. Under Web Pages, right-click and delete the index.jsp. 11. Open WEB-INF/web.xml (or Configuration Files - Web.xml) and go to the XML view. 12. Change the XML between the webapp tags so the doc looks like this: web-app ...(leave this) display-nameTest Application/display-name context-param param-nametapestry.app-package/param-name param-valuetest/param-value /context-param filter filter-nameapp/filter-name filter-classorg.apache.tapestry5.TapestryFilter/filter-class /filter filter-mapping filter-nameapp/filter-name url-pattern/*/url-pattern /filter-mapping /web-app 13. The only two you need to change are the display-name and the param-value for tapestry.app-package; the latter is the name of your package and is where Tapestry will look for your Java classes. 14. Right-click Web Pages and do New - Other, then choose Other - Empty File 15. Name the file Start.tml and hit Finish. 16. Copy the following HTML into the new file: html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; head titleStart Page/title /head body h1Start Page (Start.tml/Start.java)/h1 p The current time is: ${currentTime}. /p p [t:pagelink t:page=StartRefresh/t:pagelink] /p /body /html 17. Save the Start.tml file, then right-click Source Packages and go to New - Java Class 18. Name the class Start (.java) and put it in the package test.pages, substituting test for the package you specified in the web.xml. Then hit Finish. 19. Open the Start.java file and make it look like this, with your package instead of test: package test.pages; import java.util.Date; public class Start { public Date getCurrentTime() { return new Date(); } } 20. This next step may not be 100% necessary (or even done correctly) but is was the only way to we were able to see the logs: Right-click Source Packages and go to New - Empty File. Name the file log4j.properties and hit Finish. 21. Copy the following into the new file, then save it, again changing the last line to match your package: log4j.rootCategory=WARN, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%p] %c{1} %m%n log4j.category.org.apache.tapestry5.TapestryFilter=info log4j.category.org.apache.tapestry=info log4j.category.tapestry=info log4j.category.test=info 22. Finally, add the tapestry jars to your project by right-clicking Libraries and clicking Add JAR/Folder. 23. Browse to the unzipped tapestry folder (like C:\tapestry-bin-5.0.18\lib) and select all the jars EXCEPT tapestry-hibernate-5.0.18.jar. If you include this, Tapestry seems to fail trying to set up a default Hibernate configuration, which we did not use. 24. Now you should be able to Run - Build Main Project and Run - Run Main Project. It's probably best to use fresh installs of everything, as I had problems running multiple Tapestry test applications on Tomcat. Be sure to stop the Tomcat server before you do a manual Clean (there should be a stop button in the Tomcat window, or you can do it from the Services tab). You can continue adding pages the same way you added Start.java and Start.tml. I know this was pretty low level and there are probably advanced Tapestry/Java EE programmers yelling that I did it all wrong, but it would have been helpful to us in evaluating Tapestry last week. Hopefully it will be helpful to someone else. -- View this message in context: http://www.nabble.com/Tapestry-5%2C-Netbeans-6.5-tp21139299p21139299.html
Blog post about Tapestry 5 - Project Structure
I made another post at http://bbwebcraft.blogspot.com/ Task 2 – Explore the Tapestry 5 project structure and learn where to put your stuff I hope you don't consider this email as spam. Cheers, Borut
Mixin for javascript.
hi all, regarding the tutorial about the mixin to prompt a confirm box before press the button. I have try to use the tutorial in http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained but seems like even i press the cancel. it also will post back. here are the sample: t:actionlink t:mixins=confirm t:zone=zoneFormView t:id=toolbarDel t:context=${id}buttonimg src=images/deleteRecord24.png //button/t:actionlink is any one able to help me? Thank you. Regards, Tan
Re: About the value of the parameters
hi 滕训华 , do you might to share out your coding about @Component(parameters = {onClick=literal:return confirm(\do you want to delete this record?\);}) ? i have a problem on prompt a confirmation box before submit. but when i even press cancel. it also do the submit post back. Thank you. Regards, Tan 2008/6/27 滕训华 ten...@magic-sw.com.cn Hi,everyone @Component(parameters = {onClick=literal:return confirm(\do you want to delete this record?\);}) The string do you want to delete this record? that I want to read it from the properties file,how to do it? I am using the t5