Re: dwr java chat demo in t5
You would do this by the topic (eg: /chat/user1). You can add custom Authorizers for topic security.
Re: dwr java chat demo in t5
Hi, Lance, wow, thank you for pointing me to your project! Integration is more than easy, your example works outofthebox in my browsers. I had to install jetty7 support, seems that jetty6 does not support websockets. What are the disadvantages of websockets compared to ajax? I think not all browsers support websockets? Especially the older versions? But i think that all the major browsers support that in their latest versions? I did read that the t5 team want to integrate push, but did not see how this is scheduled. So i want to go with your project. Thanks again, Lance! Kind regards David On 22.05.2013 23:37, Lance Java wrote: Hi, as a previous dwr committer myself, I was keen to provide dwr reverse ajax / tapestry integration. After speaking to the dwr team, I found that the push mechanism in dwr was not considered bulletproof and was directed towards cometd For this reason, I have created tapestry-cometd, a push library for tapestry that requires zero javascript https://github.com/uklance/tapestry-cometd You must be aware that the tapestry team currently have push as a high priority feature for the next release. So watch this space for an out of the box solution. In the meantime, I'll be happy to help with a tapestry - cometd solution . - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: dwr java chat demo in t5
tapestry-cometd is built using the cometd integration in atmosphere. Atmosphere supports a variety of push mechanisms including WebSockets, Server Side Events (SSE), Long-Polling, HTTP Streaming (Forever frame) and JSONP. Out of the box, tapestry-cometd is configured to use org.cometd.websocket.server.WebSocketTransport but this can be configured in your AppModule ( https://github.com/uklance/tapestry-cometd/blob/master/src/main/java/org/lazan/t5/cometd/services/CometdModule.java#L54 ) The supported servers and browsers are listed here: https://github.com/Atmosphere/atmosphere/wiki/Supported-WebServers-and-Browsers Some more docs here https://github.com/Atmosphere/atmosphere https://github.com/Atmosphere/atmosphere/wiki/Getting-started-with-Cometd https://github.com/uklance/tapestry-cometd/wiki/Configuring-the-CometD-Servlet http://cometd.org/
Re: dwr java chat demo in t5
The supported browsers section on the atmosphere page can be ignored as this refers to atmosphere.js which is not used by the cometd integration. Only the supported servers section is relevant. Best to check the cometd docs for supported browsers at www.cometd.org
dwr java chat demo in t5
Hi @all, i was suprised that t5 does not support reverse ajax ;-( googleing around, the only thing mentioned often enough is dwr and i ended here: http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Implement-chat-function-td5606481.html Actually, i want to do the same thing as the threadstarter: A loggedin user can start a one-to-one chat with an admin. The admin can handle multiple chats at the same time... I don't really know if dwr is what i really want and if dwr is the best thing recommended? Or are better solutions out there? So i've tried to integrate the Java Chat with the latest dwr-RC3 from dwr first, but only with partial success. My implementation does not have the same behaviour like the demo: http://directwebremoting.org/dwr-demo/reverseajax/java-chat.html I've put the HTML source (i had to replace the div with an ul) and the Javascript source into a .tml and the Java source into a corresponding java class into my t5 jumpstart project. GOOD: i can see the clients polling: ... [INFO] log.accessLog Incoming request: /dwr/call/plainpoll/ReverseAjax.dwr [INFO] log.accessLog Incoming request: /dwr/call/plainpoll/ReverseAjax.dwr [INFO] log.accessLog Incoming request: /dwr/call/plainpoll/ReverseAjax.dwr [INFO] log.accessLog Incoming request: /dwr/call/plainpoll/ReverseAjax.dwr ... GOOD: the addMessage() Method is called when the button is pressed ok, this is default behaviour GOOD: with opera i first get the expected behaviour: open page in opera and firefox, type opera1 in opera and the message will be displayed in firefox and opera correctly. NOT GOOD: Then i type an opera2 in opera and in opera i see the correct output: ul id=chatlog liopera2/li liopera1/li /ul But in firefox, the first message did not disapear, i get: ul id=chatlog liopera1/li liopera2/li liopera1/li /ul BAD: now i type firefox in firefox and i get in opera: ul id=chatlog liopera2/li liopera1/li lifirefox/li liopera2/li liopera1/li /ul In the firefox browser nothing happens... the textfield is not reset and i still have: liopera1/li liopera2/li liopera1/li BAD: when i now type an opera3 in opera, i get in opera: ul id=chatlog liopera3/li lifirefox/li liopera2/li liopera1/li /ul initially what i did really expected, but before was the wrong output, which is now replaced with the correct output :-) In firefox still everythig is wrong: ul id=chatlog liopera1/li liopera2/li liopera1/li liopera3/li lifirefox/li liopera2/li liopera1/li /ul VERY BAD: i get a lot of: 2013-05-22 22:28:47.976:WARN::header full: java.lang.NullPointerException and: 2013-05-22 22:28:47.976:WARN::header full: java.lang.IllegalStateException: last? and i don't know anything about these message, from where they come and what they mean and how i can trace them Also with chrome i am facing similar issues to firefox. I know the most questions will come, when i want to access tapestryservices later, but when i get these strange behaviour i don't know if dwr is the right thing when i don't get this simple example running. The thing is that i don't really know what the clients are calling. They call the dwr-servlet via the generated .js: return dwr.engine._execute(p._path, 'MyChat', 'addMessage', arguments); but how does dwr response? In the end i must access a t5 service, so the response must be filled with data from the t5 service... At this point i can not imagine how i can encapsulate dwr with t5 and let dwr interact with t5. Informations and examples are more than rare :-( A reverse ajax chat-webapp is not the most extreme case i can imagine :-) Anybody out there with some suggestions? Kind regards David - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: dwr java chat demo in t5
Hi, as a previous dwr committer myself, I was keen to provide dwr reverse ajax / tapestry integration. After speaking to the dwr team, I found that the push mechanism in dwr was not considered bulletproof and was directed towards cometd For this reason, I have created tapestry-cometd, a push library for tapestry that requires zero javascript https://github.com/uklance/tapestry-cometd You must be aware that the tapestry team currently have push as a high priority feature for the next release. So watch this space for an out of the box solution. In the meantime, I'll be happy to help with a tapestry - cometd solution .
Re: dwr java chat demo in t5
Hi Lance, This email thread caught my eye so I went and got your example app. It seems to be running, in a fashion. However, I'm seeing NPE's at runtime... 1 caveat, maybe pertinent. I had to add a dependency to the pom to get a good build... dependency groupIdorg.eclipse.jetty/groupId artifactIdjetty-server/artifactId version7.6.4.v20120524/version /dependency If you've got a moment, maybe you could take a look. Quite interested in using your project. thanks Jon Here my console output... /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dmaven.home=/usr/share/java/maven-3.0.4 -Dclassworlds.conf=/usr/share/java/maven-3.0.4/bin/m2.conf -Didea.launcher.port=7532 -Didea.launcher.bin.path=/Applications/jetbrains2013/IntelliJ IDEA 12.app/bin -Dfile.encoding=UTF-8 -classpath /usr/share/java/maven-3.0.4/boot/plexus-classworlds-2.4.jar:/Applications/jetbrains2013/IntelliJ IDEA 12.app/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher --fail-fast --strict-checksums org.mortbay.jetty:maven-jetty-plugin:6.1.16:run -P jetty-hightide [INFO] Scanning for projects... [INFO] [INFO] [INFO] Building tapestry-cometd-demo Tapestry 5 Application 1.0-SNAPSHOT [INFO] [INFO] [INFO] maven-jetty-plugin:6.1.16:run (default-cli) @ tapestry-cometd-demo [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ tapestry-cometd-demo --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 8 resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ tapestry-cometd-demo --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ tapestry-cometd-demo --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ tapestry-cometd-demo --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] maven-jetty-plugin:6.1.16:run (default-cli) @ tapestry-cometd-demo [INFO] [INFO] --- maven-jetty-plugin:6.1.16:run (default-cli) @ tapestry-cometd-demo --- [INFO] Configuring Jetty for project: tapestry-cometd-demo Tapestry 5 Application [INFO] Webapp source directory = /Users/jonwilliams/wrk/java/3rdParty/tapestry-cometd-demo-master/src/main/webapp [INFO] Reload Mechanic: automatic [INFO] web.xml file = /Users/jonwilliams/wrk/java/3rdParty/tapestry-cometd-demo-master/src/main/webapp/WEB-INF/web.xml [INFO] Classes = /Users/jonwilliams/wrk/java/3rdParty/tapestry-cometd-demo-master/target/classes 2013-05-22 18:02:35.124::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [INFO] Context path = /tapestry-cometd-demo [INFO] Tmp directory = determined at runtime [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml [INFO] Web overrides = none [INFO] Webapp directory = /Users/jonwilliams/wrk/java/3rdParty/tapestry-cometd-demo-master/src/main/webapp [INFO] Starting jetty 6.1.16 ... 2013-05-22 18:02:35.211::INFO: jetty-6.1.16 2013-05-22 18:02:35.327::INFO: No Transaction manager found - if your webapp requires one, please configure one. [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.ioc.services.TapestryIOCModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.json.services.JSONModule [INFO] ioc.RegistryBuilder Adding module definition for class org.lazan.t5.cometd.services.CometdModule [INFO] ioc.RegistryBuilder Adding module definition for class org.got5.tapestry5.jquery.services.JQueryModule [INFO] ioc.RegistryBuilder Adding module definition for class org.got5.tapestry5.jquery.services.js.JSModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.upload.services.UploadModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.TapestryModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.internal.services.InternalModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.assets.AssetsModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.pageload.PageLoadModule [INFO] ioc.RegistryBuilder Adding module definition for class org.lazan.t5.cometddemo.services.AppModule [INFO] TapestryModule.ComponentClassResolver Registering cometd component library [INFO] TapestryModule.ComponentClassResolver Available pages (8): (blank): org.lazan.t5.cometddemo.pages.Index
Re: dwr java chat demo in t5
Never mind Lance, Seems I have an error in my configuration. I think I'll be able to figure it out myself. thanks anyhow Jon On Wed, May 22, 2013 at 6:10 PM, Jon Williams williams.jonat...@gmail.comwrote: Hi Lance, This email thread caught my eye so I went and got your example app. It seems to be running, in a fashion. However, I'm seeing NPE's at runtime... 1 caveat, maybe pertinent. I had to add a dependency to the pom to get a good build... dependency groupIdorg.eclipse.jetty/groupId artifactIdjetty-server/artifactId version7.6.4.v20120524/version /dependency If you've got a moment, maybe you could take a look. Quite interested in using your project. thanks Jon Here my console output... /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dmaven.home=/usr/share/java/maven-3.0.4 -Dclassworlds.conf=/usr/share/java/maven-3.0.4/bin/m2.conf -Didea.launcher.port=7532 -Didea.launcher.bin.path=/Applications/jetbrains2013/IntelliJ IDEA 12.app/bin -Dfile.encoding=UTF-8 -classpath /usr/share/java/maven-3.0.4/boot/plexus-classworlds-2.4.jar:/Applications/jetbrains2013/IntelliJ IDEA 12.app/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher --fail-fast --strict-checksums org.mortbay.jetty:maven-jetty-plugin:6.1.16:run -P jetty-hightide [INFO] Scanning for projects... [INFO] [INFO] [INFO] Building tapestry-cometd-demo Tapestry 5 Application 1.0-SNAPSHOT [INFO] [INFO] [INFO] maven-jetty-plugin:6.1.16:run (default-cli) @ tapestry-cometd-demo [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ tapestry-cometd-demo --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 8 resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ tapestry-cometd-demo --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ tapestry-cometd-demo --- [debug] execute contextualize [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ tapestry-cometd-demo --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] maven-jetty-plugin:6.1.16:run (default-cli) @ tapestry-cometd-demo [INFO] [INFO] --- maven-jetty-plugin:6.1.16:run (default-cli) @ tapestry-cometd-demo --- [INFO] Configuring Jetty for project: tapestry-cometd-demo Tapestry 5 Application [INFO] Webapp source directory = /Users/jonwilliams/wrk/java/3rdParty/tapestry-cometd-demo-master/src/main/webapp [INFO] Reload Mechanic: automatic [INFO] web.xml file = /Users/jonwilliams/wrk/java/3rdParty/tapestry-cometd-demo-master/src/main/webapp/WEB-INF/web.xml [INFO] Classes = /Users/jonwilliams/wrk/java/3rdParty/tapestry-cometd-demo-master/target/classes 2013-05-22 18:02:35.124::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [INFO] Context path = /tapestry-cometd-demo [INFO] Tmp directory = determined at runtime [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml [INFO] Web overrides = none [INFO] Webapp directory = /Users/jonwilliams/wrk/java/3rdParty/tapestry-cometd-demo-master/src/main/webapp [INFO] Starting jetty 6.1.16 ... 2013-05-22 18:02:35.211::INFO: jetty-6.1.16 2013-05-22 18:02:35.327::INFO: No Transaction manager found - if your webapp requires one, please configure one. [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.ioc.services.TapestryIOCModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.json.services.JSONModule [INFO] ioc.RegistryBuilder Adding module definition for class org.lazan.t5.cometd.services.CometdModule [INFO] ioc.RegistryBuilder Adding module definition for class org.got5.tapestry5.jquery.services.JQueryModule [INFO] ioc.RegistryBuilder Adding module definition for class org.got5.tapestry5.jquery.services.js.JSModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.upload.services.UploadModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.TapestryModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.internal.services.InternalModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.assets.AssetsModule [INFO] ioc.RegistryBuilder Adding module definition for class org.apache.tapestry5.services.pageload.PageLoadModule [INFO]
Re: T5 and AppEngine 1.7.3 dev server IllegalStateException
Just out of curiosity - this exception is thrown by Tapestry itself; however, since it's just a sanity check and it only happens on the Dev server , is there a way to disable this filter using Tapestry IoC ? org.apache.tapestry5.internal.services.ImmediateActionRenderResponseF ilter.handle(ImmediateActionRenderResponseFilter.java:63) I can certainly keep plugging along w/ GAE 1.7.1 ( I don't have a reason to upgrade); however, it would be nice if things could just work w/ just a little tweaks. Cheers - On Thu, Feb 7, 2013 at 4:32 AM, arnold.mi...@gmail.com arnold.mi...@gmail.com wrote: This is caused by this issue: http://code.google.com/p/googleappengine/issues/detail?id=8201 -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-and-AppEngine-1-7-3-dev-server-IllegalStateException-tp5717683p5719841.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 and AppEngine 1.7.3 dev server IllegalStateException
A much better option is to fix the bug with a RequestFilter. Wrap the response in a custom implementation that sets a flag to true when redirect() is called and returns the correct value in isComitted()
Re: T5 and AppEngine 1.7.3 dev server IllegalStateException
Alright - I'm not entirely sure if anyone will find any use for this, but I implemented the approach suggested by Lance (thank you Lance!) and pushed the code into BitBucket : https://bitbucket.org/akochnev/tap5-gae-utils The project wiki explains how to use it, but in short, just include the module either as a @SubModule or as a module in your Development configuration. Now my application runs just fine using the official GAE Maven plugin w/ version 1.8.0. Sweet ! Cheers - On Fri, May 17, 2013 at 9:24 AM, Lance Java lance.j...@googlemail.comwrote: A much better option is to fix the bug with a RequestFilter. Wrap the response in a custom implementation that sets a flag to true when redirect() is called and returns the correct value in isComitted()
Re: Problem in starting up T5 registry (not web app)
Hi again, this is just for curiosity but maybe some T5Guru has a clear explanation: Do PerThread scoped services needs an interface + implementation ? I am curios because I noticed these different behaviors: I setup a registry using t5 - 3.6, define my Module Class with one service annotated with PerThread Scope. The service depends on other services, and symbols. On my Mac, Everything is working fine, running it using mvn exec:java, and withing eclipse On my Linux (Ubuntu 12.04) virtual machine I git-pulled the very same project and run with the same configurations (startup options, dependencies, etc.). In this case however I got an exception on startup (see below ): As suggested by the exception, I refactored my code such that ServiceDeployer has an interface and an implementation. And everything seems to work just fine. However, I am curios about the different behavior of the same java code on the two machines. -- Alessio = Trace = 2013-05-14 12:35:11,206 [at.ac.tuwien.dsg.cloud.CloudDriver.main()] INFO org.apache.tapestry5.ioc.RegistryBuilder - Adding module definition for class org.apache.tapestry5.ioc.services.TapestryIOCModule 2013-05-14 12:35:11,309 [at.ac.tuwien.dsg.cloud.CloudDriver.main()] INFO org.apache.tapestry5.ioc.RegistryBuilder - Adding module definition for class at.ac.tuwien.dsg.cloud.modules.CloudAppModule 2013-05-14 12:35:11,570 [at.ac.tuwien.dsg.cloud.CloudDriver.main()] INFO at.ac.tuwien.dsg.cloud.services.impl.ConfigurationFileSymbolProvider - Properties read from /home/ubuntu/elasticTest/euca-interface/src/ main/resources/cloud.properties 2013-05-14 12:35:11,570 [at.ac.tuwien.dsg.cloud.CloudDriver.main()] INFO at.ac.tuwien.dsg.cloud.services.impl.ConfigurationFileSymbolProvider - [ch.usi.cloud.controller.eucalyptus.accessKey, ch.usi.cloud.contr oller.eucalyptus.ccPort, ch.usi.cloud.nova.userName, ch.usi.cloud.nova.tenant.id, ch.usi.cloud.nova.tenant.name, ch.usi.cloud.controller.eucalyptus.secretKey, ch.usi.cloud.controller.eucalyptus.ccAddress, ch.us i.cloud.nova.password] 2013-05-14 12:35:11,682 [at.ac.tuwien.dsg.cloud.CloudDriver.main()] ERROR org.apache.tapestry5.ioc.Registry - Error building service proxy for service 'ServiceDeployer' (at at.ac.tuwien.dsg.cloud.modules.CloudA ppModule.buildServiceDeployer(String, String, String, Integer, EucalyptusController, EucaServiceStateDBInterface, CloudInterface) (at CloudAppModule.java:109)): Service scope 'perthread' requires a proxy, but t he service does not have a service interface (necessary to create a proxy). Provide a service interface or select a different service scope. 2013-05-14 12:35:11,682 [at.ac.tuwien.dsg.cloud.CloudDriver.main()] ERROR org.apache.tapestry5.ioc.Registry - Operations trace: 2013-05-14 12:35:11,682 [at.ac.tuwien.dsg.cloud.CloudDriver.main()] ERROR org.apache.tapestry5.ioc.Registry - [ 1] Creating non-proxied instance of service ServiceDeployer [WARNING] java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) at java.lang.Thread.run(Thread.java:679) Caused by: org.apache.tapestry5.ioc.internal.OperationException: Error building service proxy for service 'ServiceDeployer' (at at.ac.tuwien.dsg.cloud.modules.CloudAppModule.buildServiceDeployer(String, String, String, Integer, EucalyptusController, EucaServiceStateDBInterface, CloudInterface) (at CloudAppModule.java:109)): Service scope 'perthread' requires a proxy, but the service does not have a service interface (necessary to create a proxy). Provide a service interface or select a different service scope. at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) at org.apache.tapestry5.ioc.internal.ModuleImpl.create(ModuleImpl.java:332) at org.apache.tapestry5.ioc.internal.ModuleImpl.access$100(ModuleImpl.java:39) at org.apache.tapestry5.ioc.internal.ModuleImpl$1.invoke(ModuleImpl.java:191) at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withWrite(ConcurrentBarrier.java:140) at org.apache.tapestry5.ioc.internal.ModuleImpl$2.invoke(ModuleImpl.java:207) at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85) at org.apache.tapestry5
Re: Problem in starting up T5 registry (not web app)
On Tue, 14 May 2013 11:02:24 -0300, Alessio Gambi alessioga...@gmail.com wrote: Hi again, Hi! this is just for curiosity but maybe some T5Guru has a clear explanation: Do PerThread scoped services needs an interface + implementation ? I think so. Look at the error message: Service scope 'perthread' requires a proxy, but the service does not have a service interface (necessary to create a proxy). Provide a service interface or select a different service scope. That's the explanation I'd give before reading the error message above. The difference between machines is probably due to different code or different Tapestry versions. Otherwise, I have no idea. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Problem in starting up T5 registry (not web app)
Hi all, maybe I have overlook something but I cannot figure out why the registry fails at startup. The funny thing is that it worked yesterday and this morning, then it stopped... I am using eclispe, m2eclips, and mvn, but also mvn directly from the command line (I need to run mvn through a SOCKS proxy) From the exception I see that the problem might not be strictly due to Tapestry ... but maybe someone can help on how to approach/solve this. Many thanks. -- Alessio Here my configuration (pom.xml): !-- Use Tap5 IoC for the setup/conf/DI and so on -- dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-ioc/artifactId version5.3.6/version /dependency Here my code: public static void main(String[] args) throws Exception { RegistryBuilder builder = new RegistryBuilder(); Registry registry = builder.build(); registry.performRegistryStartup(); } Here the console output: 2013-05-11 16:43:28,956 [main] INFO org.apache.tapestry5.ioc.RegistryBuilder - Adding module definition for class org.apache.tapestry5.ioc.services.TapestryIOCModule Contributions for org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl(List) (at SymbolSourceImpl.java:198) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49) [ Location : org.apache.tapestry5.ioc.services.TapestryIOCModule.setupStandardSymbolProviders(OrderedConfiguration, SymbolProvider, SymbolProvider) (at TapestryIOCModule.java:474) ContributionMethod : setupStandardSymbolProviders(org.apache.tapestry5.ioc.OrderedConfigurationorg.apache.tapestry5.ioc.services.SymbolProvider interface org.apache.tapestry5.ioc.services.SymbolProvider interface org.apache.tapestry5.ioc.services.SymbolProvider )] 2013-05-11 16:43:29,108 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 1] -- Eager loading services 2013-05-11 16:43:29,110 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 1] -- Eager loading services [0.52 ms] 2013-05-11 16:43:29,111 [main] DEBUG org.apache.tapestry5.ioc.services.TapestryIOCModule.RegistryStartup - Creating proxy for service RegistryStartup 2013-05-11 16:43:29,112 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 1] -- Creating proxy for service RegistryStartup .2013-05-11 16:43:29,118 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 2] -- Creating plan to instantiate org.apache.tapestry5.ioc.internal.services.RegistryStartup via public org.apache.tapestry5.ioc.internal.services.RegistryStartup(org.slf4j.Logger,java.util.List) 2013-05-11 16:43:29,121 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 3] -- Determining injection value for parameter #1 (org.slf4j.Logger) 2013-05-11 16:43:29,123 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 3] -- Determining injection value for parameter #1 (org.slf4j.Logger) [1.99 ms] 2013-05-11 16:43:29,123 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 3] -- Determining injection value for parameter #2 (java.util.List) 2013-05-11 16:43:29,124 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 4] -- Collecting ordered configuration for service RegistryStartup 2013-05-11 16:43:29,128 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 4] -- Collecting ordered configuration for service RegistryStartup [4.14 ms] 2013-05-11 16:43:29,133 [main] ERROR org.apache.tapestry5.ioc.Registry - java.lang.ExceptionInInitializerError 2013-05-11 16:43:29,133 [main] ERROR org.apache.tapestry5.ioc.Registry - Operations trace: 2013-05-11 16:43:29,133 [main] ERROR org.apache.tapestry5.ioc.Registry - [ 1] Creating proxy for service RegistryStartup 2013-05-11 16:43:29,133 [main] ERROR org.apache.tapestry5.ioc.Registry - [ 2] Creating plan to instantiate org.apache.tapestry5.ioc.internal.services.RegistryStartup via public org.apache.tapestry5.ioc.internal.services.RegistryStartup(org.slf4j.Logger,java.util.List) 2013-05-11 16:43:29,134 [main] ERROR org.apache.tapestry5.ioc.Registry - [ 3] Determining injection value for parameter #2 (java.util.List) Exception in thread main java.lang.ExceptionInInitializerError at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.logConfiguration(ServiceResourcesImpl.java:100) at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getOrderedConfiguration(ServiceResourcesImpl.java:114) at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getOrderedConfiguration(AbstractServiceCreator.java:123) at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.access$200(AbstractServiceCreator.java:35) at org.apache.tapestry5.ioc.internal.AbstractServiceCreator$1.findResource(AbstractServiceCreator.java:103) at org.apache.tapestry5.ioc.internal.util.DelegatingInjectionResources.findResource(DelegatingInjectionResources.java:38) at
Re: Problem in starting up T5 registry (not web app)
Hi, I ended up in creating a brand new file called IOCStrings.properties and put it in the org/apache/tapestry5/ioc/internal. I filled the file with the content of the same file but taken from the version number 5.3.5... Apparently in the version 5.3.6 that I downloaded the file is missing... I cannot explain how I managed to remove it (if the file was there). Any suggestion is welcome. -- Alessio On May 11, 2013, at 4:50 PM, Alessio Gambi wrote: Hi all, maybe I have overlook something but I cannot figure out why the registry fails at startup. The funny thing is that it worked yesterday and this morning, then it stopped... I am using eclispe, m2eclips, and mvn, but also mvn directly from the command line (I need to run mvn through a SOCKS proxy) From the exception I see that the problem might not be strictly due to Tapestry ... but maybe someone can help on how to approach/solve this. Many thanks. -- Alessio Here my configuration (pom.xml): !-- Use Tap5 IoC for the setup/conf/DI and so on -- dependency groupIdorg.apache.tapestry/groupId artifactIdtapestry-ioc/artifactId version5.3.6/version /dependency Here my code: public static void main(String[] args) throws Exception { RegistryBuilder builder = new RegistryBuilder(); Registry registry = builder.build(); registry.performRegistryStartup(); } Here the console output: 2013-05-11 16:43:28,956 [main] INFO org.apache.tapestry5.ioc.RegistryBuilder - Adding module definition for class org.apache.tapestry5.ioc.services.TapestryIOCModule Contributions for org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl(List) (at SymbolSourceImpl.java:198) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:49) [ Location : org.apache.tapestry5.ioc.services.TapestryIOCModule.setupStandardSymbolProviders(OrderedConfiguration, SymbolProvider, SymbolProvider) (at TapestryIOCModule.java:474) ContributionMethod : setupStandardSymbolProviders(org.apache.tapestry5.ioc.OrderedConfigurationorg.apache.tapestry5.ioc.services.SymbolProvider interface org.apache.tapestry5.ioc.services.SymbolProvider interface org.apache.tapestry5.ioc.services.SymbolProvider )] 2013-05-11 16:43:29,108 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 1] -- Eager loading services 2013-05-11 16:43:29,110 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 1] -- Eager loading services [0.52 ms] 2013-05-11 16:43:29,111 [main] DEBUG org.apache.tapestry5.ioc.services.TapestryIOCModule.RegistryStartup - Creating proxy for service RegistryStartup 2013-05-11 16:43:29,112 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 1] -- Creating proxy for service RegistryStartup .2013-05-11 16:43:29,118 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 2] -- Creating plan to instantiate org.apache.tapestry5.ioc.internal.services.RegistryStartup via public org.apache.tapestry5.ioc.internal.services.RegistryStartup(org.slf4j.Logger,java.util.List) 2013-05-11 16:43:29,121 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 3] -- Determining injection value for parameter #1 (org.slf4j.Logger) 2013-05-11 16:43:29,123 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 3] -- Determining injection value for parameter #1 (org.slf4j.Logger) [1.99 ms] 2013-05-11 16:43:29,123 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 3] -- Determining injection value for parameter #2 (java.util.List) 2013-05-11 16:43:29,124 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 4] -- Collecting ordered configuration for service RegistryStartup 2013-05-11 16:43:29,128 [main] DEBUG org.apache.tapestry5.ioc.Registry - [ 4] -- Collecting ordered configuration for service RegistryStartup [4.14 ms] 2013-05-11 16:43:29,133 [main] ERROR org.apache.tapestry5.ioc.Registry - java.lang.ExceptionInInitializerError 2013-05-11 16:43:29,133 [main] ERROR org.apache.tapestry5.ioc.Registry - Operations trace: 2013-05-11 16:43:29,133 [main] ERROR org.apache.tapestry5.ioc.Registry - [ 1] Creating proxy for service RegistryStartup 2013-05-11 16:43:29,133 [main] ERROR org.apache.tapestry5.ioc.Registry - [ 2] Creating plan to instantiate org.apache.tapestry5.ioc.internal.services.RegistryStartup via public org.apache.tapestry5.ioc.internal.services.RegistryStartup(org.slf4j.Logger,java.util.List) 2013-05-11 16:43:29,134 [main] ERROR org.apache.tapestry5.ioc.Registry - [ 3] Determining injection value for parameter #2 (java.util.List) Exception in thread main java.lang.ExceptionInInitializerError at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.logConfiguration(ServiceResourcesImpl.java:100) at
Re: loop pagination - T5 Bootstrap
Still i thank you for inspiration with your gallery component and other components in library. Thanks! Sorry for my previous answer… I didn't realise that this tapestry-bootstrap mixin existed. After looking at the source here: https://github.com/trsvax/tapestry-bootstrap/blob/master/src/main/java/com/trsvax/bootstrap/mixins/Pager.java It seems to me that this mixin does not do 'true' paging since the source is a java.util.List. I realise that the client only sees a page of data at a time. But on the server, the entire List must be loaded into memory which may cause OutOfMemoryErrors for large collections. The GridDataSource (or similar interface that supports serverside paging) is the more scalable solution. Please correct me if I'm wrong… I only had a quick look through the source code.
Re: loop pagination - T5 Bootstrap
Sorry for my previous answer… I didn't realise that this tapestry-bootstrap mixin existed. After looking at the source here: https://github.com/trsvax/tapestry-bootstrap/blob/master/src/main/java/com/trsvax/bootstrap/mixins/Pager.java It seems to me that this mixin does not do 'true' paging since the source is a java.util.List. I realise that the client only sees a page of data at a time. But on the server, the entire List must be loaded into memory which may cause OutOfMemoryErrors for large collections. The GridDataSource (or similar interface that supports serverside paging) is the more scalable solution. Please correct me if I'm wrong… I only had a quick look through the source code.
Re: loop pagination - T5 Bootstrap
It's true the mixin does not support GridDataSource, probably should but it works OK for most things as is. To support really large collections the pagination component would also need to be rewritten since it displays a link per page and that would not work well for thousands of pages. The other thing that got lost in my conversion to Bootstrap 2 was the mixin that allowed infinite scrolling if javascript is enabled. Perhaps it's time for some updates. On Tue, May 7, 2013 at 2:52 AM, Lance Java lance.j...@googlemail.comwrote: Sorry for my previous answer… I didn't realise that this tapestry-bootstrap mixin existed. After looking at the source here: https://github.com/trsvax/tapestry-bootstrap/blob/master/src/main/java/com/trsvax/bootstrap/mixins/Pager.java It seems to me that this mixin does not do 'true' paging since the source is a java.util.List. I realise that the client only sees a page of data at a time. But on the server, the entire List must be loaded into memory which may cause OutOfMemoryErrors for large collections. The GridDataSource (or similar interface that supports serverside paging) is the more scalable solution. Please correct me if I'm wrong… I only had a quick look through the source code.
Re: loop pagination - T5 Bootstrap
Great, you saved my day! Thank you, guys!If you are using the tapestry-bootstrap module your tml will be somethinglike thist:any t:mixins="tb/pager" pager.source="works" pager.rowsPerPage="12"t:tb.pagination /ul class="thumbnails"t:loop source="works" value="work" li class="span3"t:pagelink page="work/view" context="work" t:type="any" class="thumbnail"img src=""/h4${work.title}/h4 /t:pagelink /li/t:loop /ult:tb.pagination //t:anyOn Sun, May 5, 2013 at 1:46 PM, Lance Java lance.j...@googlemail.comwrote: The only core tapestry component which supports paging is the grid. If you're rendering a table, then use a grid http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Grid.html If you'd an example of a custom paging, take a look at my gallery component in tapestry-stitch which supports next and previous pages... this could easily be tweaked for page 1,2,3 etc. http://tapestry-stitch.uklance.cloudbees.net/gallerydemo Note that my example uses it's own interface for paging (ie GalleryDataModel). I'd recommend using tapestry's GridDataModel instead so that you can take advantage of the HibernateGridDataModel and also tapestry's built in type coercion from Collection/Array to GridDataModel. On 5 May 2013 18:19, Jan Fryblik jan.fryb...@ebrothers.cz wrote: ** Hi guys, I using Tapestry 5 and Tapestry Bootstrap and i tried to apply pagination on loop component. I`m using it like that... t:loop source="list" value="company" t:mixin="tb/LoopEnvironmentMixin" ... /t:loopbut it doesn't render any pagination, just complete list. Probably i need to connect it with Pagination component, but i don't know how. Could you please tell me, what i've missed? Best with an example, thanks in advance. BR, Jan -- * * *Mgr. Jan Fryblík* +420 739 094 784 jan.fryb...@ebrothers.cz *eBrothers Software s.r.o. | www.ebrothers.cz*
loop pagination - T5 Bootstrap
Hi guys,I using Tapestry 5 and Tapestry Bootstrap and i tried to apply pagination on loop component. I`m using it like that...t:loop source="list" value="company" t:mixin="tb/LoopEnvironmentMixin".../t:loopbut it doesn't render any pagination, just complete list. Probably i need to connect it with Pagination component, but i don't know how. Could you please tell me, what i've missed? Best with an example, thanks in advance.BR,Jan--Mgr. Jan Fryblík+420 739 094 784jan.fryb...@ebrothers.czeBrothers Software s.r.o. |www.ebrothers.cz
Re: loop pagination - T5 Bootstrap
The only core tapestry component which supports paging is the grid. If you're rendering a table, then use a grid http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Grid.html If you'd an example of a custom paging, take a look at my gallery component in tapestry-stitch which supports next and previous pages... this could easily be tweaked for page 1,2,3 etc. http://tapestry-stitch.uklance.cloudbees.net/gallerydemo Note that my example uses it's own interface for paging (ie GalleryDataModel). I'd recommend using tapestry's GridDataModel instead so that you can take advantage of the HibernateGridDataModel and also tapestry's built in type coercion from Collection/Array to GridDataModel. On 5 May 2013 18:19, Jan Fryblik jan.fryb...@ebrothers.cz wrote: ** Hi guys, I using Tapestry 5 and Tapestry Bootstrap and i tried to apply pagination on loop component. I`m using it like that... t:loop source=list value=company t:mixin=tb/LoopEnvironmentMixin ... /t:loop but it doesn't render any pagination, just complete list. Probably i need to connect it with Pagination component, but i don't know how. Could you please tell me, what i've missed? Best with an example, thanks in advance. BR, Jan -- * * *Mgr. Jan Fryblík* +420 739 094 784 jan.fryb...@ebrothers.cz *eBrothers Software s.r.o. | www.ebrothers.cz*
Re: loop pagination - T5 Bootstrap
If you are using the tapestry-bootstrap module your tml will be something like this t:any t:mixins=tb/pager pager.source=works pager.rowsPerPage=12 t:tb.pagination / ul class=thumbnails t:loop source=works value=work li class=span3 t:pagelink page=work/view context=work t:type=any class= thumbnail img src=${src}/ h4${work.title}/h4 /t:pagelink /li /t:loop /ul t:tb.pagination / /t:any On Sun, May 5, 2013 at 1:46 PM, Lance Java lance.j...@googlemail.comwrote: The only core tapestry component which supports paging is the grid. If you're rendering a table, then use a grid http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Grid.html If you'd an example of a custom paging, take a look at my gallery component in tapestry-stitch which supports next and previous pages... this could easily be tweaked for page 1,2,3 etc. http://tapestry-stitch.uklance.cloudbees.net/gallerydemo Note that my example uses it's own interface for paging (ie GalleryDataModel). I'd recommend using tapestry's GridDataModel instead so that you can take advantage of the HibernateGridDataModel and also tapestry's built in type coercion from Collection/Array to GridDataModel. On 5 May 2013 18:19, Jan Fryblik jan.fryb...@ebrothers.cz wrote: ** Hi guys, I using Tapestry 5 and Tapestry Bootstrap and i tried to apply pagination on loop component. I`m using it like that... t:loop source=list value=company t:mixin=tb/LoopEnvironmentMixin ... /t:loop but it doesn't render any pagination, just complete list. Probably i need to connect it with Pagination component, but i don't know how. Could you please tell me, what i've missed? Best with an example, thanks in advance. BR, Jan -- * * *Mgr. Jan Fryblík* +420 739 094 784 jan.fryb...@ebrothers.cz *eBrothers Software s.r.o. | www.ebrothers.cz*
Re: basic auth in T5
Oops! Didn't get that (Not used Basic Authentication since a long long time). Http Basic auth is implemented at the container level. http://docs.oracle.com/cd/E19798-01/821-1841/bncck/index.html Once you are authenticated you can use the details (principal, roles) with the annotation approach. regards Taha On 02-May-2013, at 10:55 AM, Angelo Chen angelochen...@gmail.com wrote: Not yet, but that seems not the http basic auth. On Thu, May 2, 2013 at 12:31 PM, Taha Hafeez Siddiqi tawus.tapes...@gmail.com wrote: Did you try this. http://tapestryjava.blogspot.in/2009/12/securing-tapestry-pages-with.html regards Taha On 02-May-2013, at 9:59 AM, Angelo Chen angelochen...@gmail.com wrote: Hi, I'd like to put http basic authentication in some of page classes, not all, is there a simple way to do this? probably an annotation approach? Thanks Angelo
Re: basic auth in T5
Come on people - basic authentication is not that old... You can of course you the standard servlet container managed authentication whether you use form or basic authentication but it's not a requirement for basic. You can also use tapestry-security exactly the same way as you otherwise would and configure SecurityFilterChainFactory.basic() filter to authenticate via basic authentication headers. Kalle On Wed, May 1, 2013 at 11:06 PM, Taha Hafeez Siddiqi tawus.tapes...@gmail.com wrote: Oops! Didn't get that (Not used Basic Authentication since a long long time). Http Basic auth is implemented at the container level. http://docs.oracle.com/cd/E19798-01/821-1841/bncck/index.html Once you are authenticated you can use the details (principal, roles) with the annotation approach. regards Taha On 02-May-2013, at 10:55 AM, Angelo Chen angelochen...@gmail.com wrote: Not yet, but that seems not the http basic auth. On Thu, May 2, 2013 at 12:31 PM, Taha Hafeez Siddiqi tawus.tapes...@gmail.com wrote: Did you try this. http://tapestryjava.blogspot.in/2009/12/securing-tapestry-pages-with.html regards Taha On 02-May-2013, at 9:59 AM, Angelo Chen angelochen...@gmail.com wrote: Hi, I'd like to put http basic authentication in some of page classes, not all, is there a simple way to do this? probably an annotation approach? Thanks Angelo
Re: basic auth in T5
Hi, Thanks for the tip, it is in the servlet level, it will be nice if we can have a simply way to mark a certain route in tapestry5 with http basic authentication, the use case is, an app might have a very rich javascript client, and accessing pages with restful api, if those api can be protected with http basic authentication, development will be easier. Angelo On Thu, May 2, 2013 at 2:06 PM, Taha Hafeez Siddiqi tawus.tapes...@gmail.com wrote: Oops! Didn't get that (Not used Basic Authentication since a long long time). Http Basic auth is implemented at the container level. http://docs.oracle.com/cd/E19798-01/821-1841/bncck/index.html Once you are authenticated you can use the details (principal, roles) with the annotation approach. regards Taha On 02-May-2013, at 10:55 AM, Angelo Chen angelochen...@gmail.com wrote: Not yet, but that seems not the http basic auth. On Thu, May 2, 2013 at 12:31 PM, Taha Hafeez Siddiqi tawus.tapes...@gmail.com wrote: Did you try this. http://tapestryjava.blogspot.in/2009/12/securing-tapestry-pages-with.html regards Taha On 02-May-2013, at 9:59 AM, Angelo Chen angelochen...@gmail.com wrote: Hi, I'd like to put http basic authentication in some of page classes, not all, is there a simple way to do this? probably an annotation approach? Thanks Angelo
basic auth in T5
Hi, I'd like to put http basic authentication in some of page classes, not all, is there a simple way to do this? probably an annotation approach? Thanks Angelo
Re: basic auth in T5
Did you try this. http://tapestryjava.blogspot.in/2009/12/securing-tapestry-pages-with.html regards Taha On 02-May-2013, at 9:59 AM, Angelo Chen angelochen...@gmail.com wrote: Hi, I'd like to put http basic authentication in some of page classes, not all, is there a simple way to do this? probably an annotation approach? Thanks Angelo
Re: basic auth in T5
Not yet, but that seems not the http basic auth. On Thu, May 2, 2013 at 12:31 PM, Taha Hafeez Siddiqi tawus.tapes...@gmail.com wrote: Did you try this. http://tapestryjava.blogspot.in/2009/12/securing-tapestry-pages-with.html regards Taha On 02-May-2013, at 9:59 AM, Angelo Chen angelochen...@gmail.com wrote: Hi, I'd like to put http basic authentication in some of page classes, not all, is there a simple way to do this? probably an annotation approach? Thanks Angelo
Re: basic auth in T5
Isn't HTTP Basic Auth is all done in web.xml? It is not related to Tapestry (or any other web framework) at all. On Thu, May 2, 2013 at 9:25 AM, Angelo Chen angelochen...@gmail.com wrote: Not yet, but that seems not the http basic auth. On Thu, May 2, 2013 at 12:31 PM, Taha Hafeez Siddiqi tawus.tapes...@gmail.com wrote: Did you try this. http://tapestryjava.blogspot.in/2009/12/securing-tapestry-pages-with.html regards Taha On 02-May-2013, at 9:59 AM, Angelo Chen angelochen...@gmail.com wrote: Hi, I'd like to put http basic authentication in some of page classes, not all, is there a simple way to do this? probably an annotation approach? Thanks Angelo -- Dmitry Gusev AnjLab Team http://anjlab.com
Re: [T5 5.3.6] Dead Lock while initializing tapestry
Sorry I do not understand your response. From the stacktrace T5 is building your service. In the constructor of the service currently created you are spawning a new thread which again needs services from the T5 app in the run method, right? Can't you defer thread creation to a method in your module class annotated by @Startup ? Jens Sent from my iPhone On 18.04.2013, at 19:02, Arunas F arun...@gmail.com wrote: No, not at all. New Thread is spawned at some moment while initializing T5 app. And there is nothing special about a code: new Thread(new Runnable() { @Override public void run() { if (logger.isDebugEnabled()) logger.debug(etlName + initializing... ); try { for (EtlAbstractJob job : jobs.getJobs()) { job.initialize(); } } catch (EtlJobException e) { logger.error(e.toString()); e.printStackTrace(); } if (logger.isDebugEnabled()) logger.debug(etlName + finished initialization... ); } }).start(); And in the code at line job.initialize(); the var job are T5 IOC services and these services depend on MongoDB service at some deeper level. public class ReportStorageImpl implements ReportStorage { . private MongoDB mongoDB; public ReportStorageImpl(MongoDB mongoDB) { this.mongoDB = mongoDB; } .. @Override public MongoDB getMongoDB() { return mongoDB; } } About MongoDB also nothing special. The module is taken from https://github.com/mlusetti/tapestry-mongodb-core (look at earlier revisions). BR, Arunas On 18/04/2013 18:53, mailingl...@j-b-s.de wrote: Are you spawning a new thread in your MongoDBImpl.java:30 which makes use of T5 services, too? From the Stacktrace you are (well T5 IOC is) building the mongodb service right now. What happens in the ctor of your class? Can you paste some code?? Jens Sent from my iPhone On 18.04.2013, at 17:31, Arunas F arun...@gmail.com wrote: Hi, We are using T5 version 5.3.6. I found that Tapestry runs into a dead lock while building registry (initializing) if I start a new Thread what uses some T5 services. Right now we have disabled multi threading while initializing app. But I would like to know, is it a T5 bug and I should file it into JIRA or this is an expected behavior and it is a T5 limitation. Problem description: If the T5 registry and new Thread tries to create same service (from proxy) simultaneously sometimes you can run into deadlock and T5 app wont initialize. In the stacktrace dump below, you can find that both threads tried to create MongoDB instance and ran into a deadlock. Found one Java-level deadlock: = Thread-10: waiting for ownable synchronizer 0x0007c27e65f0, (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync), which is held by Thread-4 Thread-4: waiting to lock monitor 0x7fdf5b91c658 (object 0x0007eda35c20, a org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator), which is held by Thread-10 Java stack information for the threads listed above: === Thread-10: at sun.misc.Unsafe.park(Native Method) - parking to wait for 0x0007c27e65f0 (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282) at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731) at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75) at org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:213) at org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:109) at org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:421) at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:868) at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:57) at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:257) at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:50) at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:289) at org.apache.tapestry5.ioc.internal.util.InternalUtils$4
[T5 5.3.6] Dead Lock while initializing tapestry
Hi, We are using T5 version 5.3.6. I found that Tapestry runs into a dead lock while building registry (initializing) if I start a new Thread what uses some T5 services. Right now we have disabled multi threading while initializing app. But I would like to know, is it a T5 bug and I should file it into JIRA or this is an expected behavior and it is a T5 limitation. Problem description: If the T5 registry and new Thread tries to create same service (from proxy) simultaneously sometimes you can run into deadlock and T5 app wont initialize. In the stacktrace dump below, you can find that both threads tried to create MongoDB instance and ran into a deadlock. Found one Java-level deadlock: = Thread-10: waiting for ownable synchronizer 0x0007c27e65f0, (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync), which is held by Thread-4 Thread-4: waiting to lock monitor 0x7fdf5b91c658 (object 0x0007eda35c20, a org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator), which is held by Thread-10 Java stack information for the threads listed above: === Thread-10: at sun.misc.Unsafe.park(Native Method) - parking to wait for 0x0007c27e65f0 (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282) at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731) at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75) at org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:213) at org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:109) at org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:421) at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:868) at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:57) at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:257) at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:50) at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:289) at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:286) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:293) at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1488) at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1483) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) at org.apache.tapestry5.ioc.internal.util.InternalUtils.createConstructorConstructionPlan(InternalUtils.java:1480) at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.getPlan(ConstructorServiceCreator.java:52) at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:61) at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49) at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29) at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:46
Re: [T5 5.3.6] Dead Lock while initializing tapestry
Are you spawning a new thread in your MongoDBImpl.java:30 which makes use of T5 services, too? From the Stacktrace you are (well T5 IOC is) building the mongodb service right now. What happens in the ctor of your class? Can you paste some code?? Jens Sent from my iPhone On 18.04.2013, at 17:31, Arunas F arun...@gmail.com wrote: Hi, We are using T5 version 5.3.6. I found that Tapestry runs into a dead lock while building registry (initializing) if I start a new Thread what uses some T5 services. Right now we have disabled multi threading while initializing app. But I would like to know, is it a T5 bug and I should file it into JIRA or this is an expected behavior and it is a T5 limitation. Problem description: If the T5 registry and new Thread tries to create same service (from proxy) simultaneously sometimes you can run into deadlock and T5 app wont initialize. In the stacktrace dump below, you can find that both threads tried to create MongoDB instance and ran into a deadlock. Found one Java-level deadlock: = Thread-10: waiting for ownable synchronizer 0x0007c27e65f0, (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync), which is held by Thread-4 Thread-4: waiting to lock monitor 0x7fdf5b91c658 (object 0x0007eda35c20, a org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator), which is held by Thread-10 Java stack information for the threads listed above: === Thread-10: at sun.misc.Unsafe.park(Native Method) - parking to wait for 0x0007c27e65f0 (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282) at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731) at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75) at org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:213) at org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:109) at org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:421) at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:868) at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:57) at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:257) at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:50) at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:289) at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:286) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:293) at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1488) at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1483) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) at org.apache.tapestry5.ioc.internal.util.InternalUtils.createConstructorConstructionPlan(InternalUtils.java:1480) at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.getPlan(ConstructorServiceCreator.java:52) at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:61) at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49
Re: [T5 5.3.6] Dead Lock while initializing tapestry
No, not at all. New Thread is spawned at some moment while initializing T5 app. And there is nothing special about a code: new Thread(new Runnable() { @Override public void run() { if (logger.isDebugEnabled()) logger.debug(etlName + initializing... ); try { for (EtlAbstractJob job : jobs.getJobs()) { job.initialize(); } } catch (EtlJobException e) { logger.error(e.toString()); e.printStackTrace(); } if (logger.isDebugEnabled()) logger.debug(etlName + finished initialization... ); } }).start(); And in the code at line job.initialize(); the var job are T5 IOC services and these services depend on MongoDB service at some deeper level. public class ReportStorageImpl implements ReportStorage { . private MongoDB mongoDB; public ReportStorageImpl(MongoDB mongoDB) { this.mongoDB = mongoDB; } .. @Override public MongoDB getMongoDB() { return mongoDB; } } About MongoDB also nothing special. The module is taken from https://github.com/mlusetti/tapestry-mongodb-core (look at earlier revisions). BR, Arunas On 18/04/2013 18:53, mailingl...@j-b-s.de wrote: Are you spawning a new thread in your MongoDBImpl.java:30 which makes use of T5 services, too? From the Stacktrace you are (well T5 IOC is) building the mongodb service right now. What happens in the ctor of your class? Can you paste some code?? Jens Sent from my iPhone On 18.04.2013, at 17:31, Arunas F arun...@gmail.com wrote: Hi, We are using T5 version 5.3.6. I found that Tapestry runs into a dead lock while building registry (initializing) if I start a new Thread what uses some T5 services. Right now we have disabled multi threading while initializing app. But I would like to know, is it a T5 bug and I should file it into JIRA or this is an expected behavior and it is a T5 limitation. Problem description: If the T5 registry and new Thread tries to create same service (from proxy) simultaneously sometimes you can run into deadlock and T5 app wont initialize. In the stacktrace dump below, you can find that both threads tried to create MongoDB instance and ran into a deadlock. Found one Java-level deadlock: = Thread-10: waiting for ownable synchronizer 0x0007c27e65f0, (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync), which is held by Thread-4 Thread-4: waiting to lock monitor 0x7fdf5b91c658 (object 0x0007eda35c20, a org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator), which is held by Thread-10 Java stack information for the threads listed above: === Thread-10: at sun.misc.Unsafe.park(Native Method) - parking to wait for 0x0007c27e65f0 (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282) at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731) at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75) at org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:213) at org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:109) at org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:421) at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:868) at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:57) at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:257) at org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:50) at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:289) at org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:286) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:293) at org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke
Re: [T5] Avoid logs in error for wrong urls and missing components ?
What about configuring robots.txt? On Sat, Apr 6, 2013 at 1:50 PM, Nicolas Bouillon nico...@bouillon.netwrote: Thanks for your thoughts, and that leads me to the following suggestion to resolve my problem: I've already contributed a custom RequestExceptionHandler using binder.bind(RequestExceptionHandler.class, CustomRequestExceptionHandler.class) .withId(CustomRequestExceptionHandler); That is this service which is responsible of my log error message (org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler#handleRequestException). In my Custom RequestExceptionHandler, I could check the user agent to match against bots, and then instead of rendering the exception page, give them a 404 response code so they could stop crawling the page (and me skipping logger.error at the top of the handleRequestException method). Best regards. 2013/4/6 Muhammad Gelbana m.gelb...@gmail.com When you create a tapestry project using maven's archtype, it creates the below request filter (slightly modified) to log how much time each request consumed. // Service building public RequestFilter buildTimingFilter(final Logger log) { return new RequestFilter() { @Override public boolean service(Request request, Response response, RequestHandler handler) throws IOException { long startTime = System.currentTimeMillis(); try { // The responsibility of a filter is to invoke the corresponding method // in the handler. When you chain multiple filters together, each filter // received a handler that is a bridge to the next filter. return handler.service(request, response); } finally { long elapsed = System.currentTimeMillis() - startTime; if (TimeUnit.MILLISECONDS.toSeconds(elapsed) = 10) { log.warn(String.format(Request time: %d ms, elapsed)); } } } }; } // Service contribution public void contributeRequestHandler(OrderedConfigurationRequestFilter configuration, @Local RequestFilter filter) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. configuration.add(Timing, filter); } From there, if you find a pattern for requests coming from bots, you can drop these requests if that suits you. This way these bots will also learn that the links they are requesting doesn't exists anymore and will eventually stop bothering you, if they are smart enough ! Regards On Fri, Apr 5, 2013 at 10:08 PM, Nicolas Bouillon nico...@bouillon.net wrote: Dear all, I'm working on a e-commerce website in Tapestry 5 since a couple of years and we are making our website evolving constantly, adding some features and changing stuff here and there. I'm closely monitoring application logs but i'm very annoyed by robots who reminds some URLs that are not valid anymore. For example, they remind (or follow old links) to webpages that used to be coded in PHP and where the URL contained special chars, not allowed in Tapestry URLs. Or those spiders try to access an URL of a grid pager event, but the Grid component is not there anymore (or has a different name). Each of those hit generate a log.error message, and that hide the important errors messages inside many noise. (I know, Cool URI don't change, but for page events, it could be quite had to keep old URLs...) The error log is something like that : org.apache.tapestry5.ioc.util.UnknownValueException: Component product/domain/PriceList does not contain embedded component 'v3grid'. It's seems to be too wide to ignore totally UnknownValueException log appender, because it might hide real mistakes in the web application. Is there a way to avoid this kind of behavior ? How do you treat error logs from your applications ? Thanks. Nicolas. -- BR Ivan
Re: [T5] Avoid logs in error for wrong urls and missing components ?
When you create a tapestry project using maven's archtype, it creates the below request filter (slightly modified) to log how much time each request consumed. // Service building public RequestFilter buildTimingFilter(final Logger log) { return new RequestFilter() { @Override public boolean service(Request request, Response response, RequestHandler handler) throws IOException { long startTime = System.currentTimeMillis(); try { // The responsibility of a filter is to invoke the corresponding method // in the handler. When you chain multiple filters together, each filter // received a handler that is a bridge to the next filter. return handler.service(request, response); } finally { long elapsed = System.currentTimeMillis() - startTime; if (TimeUnit.MILLISECONDS.toSeconds(elapsed) = 10) { log.warn(String.format(Request time: %d ms, elapsed)); } } } }; } // Service contribution public void contributeRequestHandler(OrderedConfigurationRequestFilter configuration, @Local RequestFilter filter) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. configuration.add(Timing, filter); } From there, if you find a pattern for requests coming from bots, you can drop these requests if that suits you. This way these bots will also learn that the links they are requesting doesn't exists anymore and will eventually stop bothering you, if they are smart enough ! Regards On Fri, Apr 5, 2013 at 10:08 PM, Nicolas Bouillon nico...@bouillon.netwrote: Dear all, I'm working on a e-commerce website in Tapestry 5 since a couple of years and we are making our website evolving constantly, adding some features and changing stuff here and there. I'm closely monitoring application logs but i'm very annoyed by robots who reminds some URLs that are not valid anymore. For example, they remind (or follow old links) to webpages that used to be coded in PHP and where the URL contained special chars, not allowed in Tapestry URLs. Or those spiders try to access an URL of a grid pager event, but the Grid component is not there anymore (or has a different name). Each of those hit generate a log.error message, and that hide the important errors messages inside many noise. (I know, Cool URI don't change, but for page events, it could be quite had to keep old URLs...) The error log is something like that : org.apache.tapestry5.ioc.util.UnknownValueException: Component product/domain/PriceList does not contain embedded component 'v3grid'. It's seems to be too wide to ignore totally UnknownValueException log appender, because it might hide real mistakes in the web application. Is there a way to avoid this kind of behavior ? How do you treat error logs from your applications ? Thanks. Nicolas.
Re: [T5] Avoid logs in error for wrong urls and missing components ?
Thanks for your thoughts, and that leads me to the following suggestion to resolve my problem: I've already contributed a custom RequestExceptionHandler using binder.bind(RequestExceptionHandler.class, CustomRequestExceptionHandler.class) .withId(CustomRequestExceptionHandler); That is this service which is responsible of my log error message (org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler#handleRequestException). In my Custom RequestExceptionHandler, I could check the user agent to match against bots, and then instead of rendering the exception page, give them a 404 response code so they could stop crawling the page (and me skipping logger.error at the top of the handleRequestException method). Best regards. 2013/4/6 Muhammad Gelbana m.gelb...@gmail.com When you create a tapestry project using maven's archtype, it creates the below request filter (slightly modified) to log how much time each request consumed. // Service building public RequestFilter buildTimingFilter(final Logger log) { return new RequestFilter() { @Override public boolean service(Request request, Response response, RequestHandler handler) throws IOException { long startTime = System.currentTimeMillis(); try { // The responsibility of a filter is to invoke the corresponding method // in the handler. When you chain multiple filters together, each filter // received a handler that is a bridge to the next filter. return handler.service(request, response); } finally { long elapsed = System.currentTimeMillis() - startTime; if (TimeUnit.MILLISECONDS.toSeconds(elapsed) = 10) { log.warn(String.format(Request time: %d ms, elapsed)); } } } }; } // Service contribution public void contributeRequestHandler(OrderedConfigurationRequestFilter configuration, @Local RequestFilter filter) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. configuration.add(Timing, filter); } From there, if you find a pattern for requests coming from bots, you can drop these requests if that suits you. This way these bots will also learn that the links they are requesting doesn't exists anymore and will eventually stop bothering you, if they are smart enough ! Regards On Fri, Apr 5, 2013 at 10:08 PM, Nicolas Bouillon nico...@bouillon.net wrote: Dear all, I'm working on a e-commerce website in Tapestry 5 since a couple of years and we are making our website evolving constantly, adding some features and changing stuff here and there. I'm closely monitoring application logs but i'm very annoyed by robots who reminds some URLs that are not valid anymore. For example, they remind (or follow old links) to webpages that used to be coded in PHP and where the URL contained special chars, not allowed in Tapestry URLs. Or those spiders try to access an URL of a grid pager event, but the Grid component is not there anymore (or has a different name). Each of those hit generate a log.error message, and that hide the important errors messages inside many noise. (I know, Cool URI don't change, but for page events, it could be quite had to keep old URLs...) The error log is something like that : org.apache.tapestry5.ioc.util.UnknownValueException: Component product/domain/PriceList does not contain embedded component 'v3grid'. It's seems to be too wide to ignore totally UnknownValueException log appender, because it might hide real mistakes in the web application. Is there a way to avoid this kind of behavior ? How do you treat error logs from your applications ? Thanks. Nicolas.
[T5] Avoid logs in error for wrong urls and missing components ?
Dear all, I'm working on a e-commerce website in Tapestry 5 since a couple of years and we are making our website evolving constantly, adding some features and changing stuff here and there. I'm closely monitoring application logs but i'm very annoyed by robots who reminds some URLs that are not valid anymore. For example, they remind (or follow old links) to webpages that used to be coded in PHP and where the URL contained special chars, not allowed in Tapestry URLs. Or those spiders try to access an URL of a grid pager event, but the Grid component is not there anymore (or has a different name). Each of those hit generate a log.error message, and that hide the important errors messages inside many noise. (I know, Cool URI don't change, but for page events, it could be quite had to keep old URLs...) The error log is something like that : org.apache.tapestry5.ioc.util.UnknownValueException: Component product/domain/PriceList does not contain embedded component 'v3grid'. It's seems to be too wide to ignore totally UnknownValueException log appender, because it might hide real mistakes in the web application. Is there a way to avoid this kind of behavior ? How do you treat error logs from your applications ? Thanks. Nicolas.
Re: T5 and AppEngine 1.7.3 dev server IllegalStateException
This is caused by this issue: http://code.google.com/p/googleappengine/issues/detail?id=8201 -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-and-AppEngine-1-7-3-dev-server-IllegalStateException-tp5717683p5719841.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 Varargs in service methods
(Unknown Source) at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Varargs-in-service-methods-tp2426400p5719600.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 Varargs in service methods
On Mon, 28 Jan 2013 07:53:52 -0200, llama-king p.hv...@albourne.com wrote: Sorry to dig up an old thread but seems I'm experiencing precisely the same issue. Running on 5.3.6, injecting a service, calling method in service that takes varargs. Any ideas what might be the cause? This doesn't look like it's related to varargs at all. java.lang.LinkageError: loader constraint violation: when resolving method com.albourne.web.services.AjaxRenderHelper.render([Lorg/apache/tapestry5/corelib/components/Zone;)V the class loader (instance of org/apache/tapestry5/internal/plastic/PlasticClassLoader) of the current class, com/albourne/web/components/hf/risk/ListingConditionNew, and the class loader (instance of runjettyrun/ProjectClassLoader) for resolved class, com/albourne/web/services/AjaxRenderHelper, have different Class objects for the type apestry5/corelib/components/Zone;)V used in the signature You seem to be receiving an instance of a page or component or mixin in a service. Never do that. As Tapestry changes that classes in a different classpath when they're loaded, non-transformed classes (like your service) only see the original, non-transformed page, component or mixin. The solution is to create an interface, make the page, component or mixin implement it and then use the new interface as the parameter in your service. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: new javascript support for T5
Folks ... is there new javascript support in T-5.3.4 that I can try ? /_ __/__ ___ ___ / /___ __ / __/ / / / _ `/ _ \/ -_|_-/ __/ __/ // / /__ \ /_/ \_,_/ .__/\__/___/\__/_/ \_, / // /_/ /___/ 5.3.4 Best regards and thanks... KEN From: nhhockeypla...@hotmail.com To: users@tapestry.apache.org Subject: new javascript support for T5 Date: Wed, 2 Jan 2013 15:06:25 -0500 Folks, Any idea when the new javascript support will be available for T5? Can wait to try it out. Best regards and thanks... KEN
Re: new javascript support for T5
Tapestry 5.4-alpha-2 is now available for the intrepid and experienced. Documentation is lagging until things have stabilized. See my prior posts. On Fri, Jan 4, 2013 at 12:18 PM, nhhockeyplayer nashua nhhockeypla...@hotmail.com wrote: Folks ... is there new javascript support in T-5.3.4 that I can try ? /_ __/__ ___ ___ / /___ __ / __/ / / / _ `/ _ \/ -_|_-/ __/ __/ // / /__ \ /_/ \_,_/ .__/\__/___/\__/_/ \_, / // /_/ /___/ 5.3.4 Best regards and thanks... KEN From: nhhockeypla...@hotmail.com To: users@tapestry.apache.org Subject: new javascript support for T5 Date: Wed, 2 Jan 2013 15:06:25 -0500 Folks, Any idea when the new javascript support will be available for T5? Can wait to try it out. Best regards and thanks... KEN -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com
new javascript support for T5
Folks, Any idea when the new javascript support will be available for T5? Can wait to try it out. Best regards and thanks... KEN
RE: what javascript does T5 use
Tapestry5 has been tied to prototype / script.aculo.us since the beginning but this is about to change. Howard has just committed changes to the unreleased 5.4 branch which will make it easy to swap the foundation framework (jquery/prototype/etc). If you want to use jquery today, there is 3rd party library tapestry-jquery which removes prototype from a tapestry application and uses jquery instead. It comes with some jquery-ui based components built in. http://tapestry5-jquery.com/ -- View this message in context: http://tapestry.1045711.n5.nabble.com/what-javascript-does-T5-use-tp5718828p5718830.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
what javascript does T5 use
Sorry folks, i been scoping out T5 javascript and still confused. i have been operating T5.3 http://tapestry.apache.org/release-notes-532.html http://tapestry.apache.org/2012/02/07/announcing-tapestry-532.html Still wondering if T5 goes with some javascript framework. Scriptaculous, prototype or anything else ? thanks for any update to this as it seems to be in play i would like to know where I am at with 5.3, and where to find the docs that show the ground zero features with 5.3 i also would like to know where it is going. thanks in advance. Best regards and thanks... KEN
RE: what javascript does T5 use
Ok found it http://tapestry.apache.org/javascript.html So is the Javascript portion of T5 going to anew framework in future releases ? Thanks for your patience Best regards and thanks... KEN From: nhhockeypla...@hotmail.com To: users@tapestry.apache.org Subject: what javascript does T5 use Date: Tue, 18 Dec 2012 23:50:45 -0500 Sorry folks, i been scoping out T5 javascript and still confused. i have been operating T5.3 http://tapestry.apache.org/release-notes-532.html http://tapestry.apache.org/2012/02/07/announcing-tapestry-532.html Still wondering if T5 goes with some javascript framework. Scriptaculous, prototype or anything else ? thanks for any update to this as it seems to be in play i would like to know where I am at with 5.3, and where to find the docs that show the ground zero features with 5.3 i also would like to know where it is going. thanks in advance. Best regards and thanks... KEN
T5 Embedded Components
Embedded components I have a page (welcome) in which I am looking to use a custom simpletextfiled component to display numerous text fields (in the future I envisage simpledate and simple select components, The simpleTextfield contains numerous other divs, css and other components). public class Welcome{ @Persist private String field1,field2,field3; @Component(id = field1) private TextField field1Field; @Component(id = field2) private TextField field2Field; @Component(id = field3) private TextField field2Field; } welcome.tml uses t:SimpleTextField/ where SimpleTextField.tml is as follows t:container xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd; input t:type=textfield t:id=field1Field t:value=field1Field label=message:field1Field-label name=field1Field size=35 class=height10Px //div t:helpText (a custom component for helptext) /t:container When I run this I recieved the following error Embedded component(s) field1Field are defined within component class com.axa.cao.pages.partner.Welcome (or a super-class of Welcome), but are not present in the component template (classpath:com/axa/cao/pages/partner/Welcome.tml). How can I pass the Text field component to the SimpleTextField Component to avoid the above error or is there a different approach I should be taking? Thanks in advance. -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Embedded-Components-tp5718541.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 Embedded Components
Hi, first remove the id parameter from the @Component annotation; this is only needed if the field name in the java class is different from the t:id attribute in the template. second because you already defined your component in the template you don't have to declare it in your java class; so you should remove the TextField fields from your java class; if you still want to access the component from within java use the @InjectComponent annotation g, kris On Fri, Dec 7, 2012 at 1:51 PM, captain_rhino graeme.kitc...@axa-travel-insurance.com wrote: Embedded components I have a page (welcome) in which I am looking to use a custom simpletextfiled component to display numerous text fields (in the future I envisage simpledate and simple select components, The simpleTextfield contains numerous other divs, css and other components). public class Welcome{ @Persist private String field1,field2,field3; @Component(id = field1) private TextField field1Field; @Component(id = field2) private TextField field2Field; @Component(id = field3) private TextField field2Field; } welcome.tml uses t:SimpleTextField/ where SimpleTextField.tml is as follows t:container xmlns:t=http://tapestry.apache.org/schema/tapestry_5_3.xsd; input t:type=textfield t:id=field1Field t:value=field1Field label=message:field1Field-label name=field1Field size=35 class=height10Px //div t:helpText (a custom component for helptext) /t:container When I run this I recieved the following error Embedded component(s) field1Field are defined within component class com.axa.cao.pages.partner.Welcome (or a super-class of Welcome), but are not present in the component template (classpath:com/axa/cao/pages/partner/Welcome.tml). How can I pass the Text field component to the SimpleTextField Component to avoid the above error or is there a different approach I should be taking? Thanks in advance. -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Embedded-Components-tp5718541.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Embedded Components
On Fri, 07 Dec 2012 10:51:44 -0200, captain_rhino graeme.kitc...@axa-travel-insurance.com wrote: Embedded components It's a little weird to talk in Tapestry about embedded components because all components can be used inside another component and pages are 99% the same as components. How can I pass the Text field component to the SimpleTextField Component to avoid the above error or is there a different approach I should be taking? Tapestry components are meant to be used as black boxes, so you're not supposed to refer to anything declared inside a component. If you really need to get the component inside the component, something you should avoid, create a getter in the component that has the component you want. Cheers! -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5 jQuery - how to integrate?
How do I include http://tapestry5-jquery.com/ into my application? added this to pom: dependency groupIdorg.got5/groupId artifactIdtapestry5-jquery/artifactId version3.3.3/version /dependency But when I add an example form to one of my pages: t:form t:jquery.autocomplete / t:submit / /t:form I get an ex: Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Unable to resolve 'jquery/autocomplete' to a component class name. Did I miss something? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-jQuery-how-to-integrate-tp5717696.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 jQuery - how to integrate?
hi. The AutoComplete is not a component. It is a mixin. You should use it like this : t:textfield t:mixins=jquery/autocomplete / Manu 2012/11/6 membersound memberso...@web.de How do I include http://tapestry5-jquery.com/ into my application? added this to pom: dependency groupIdorg.got5/groupId artifactIdtapestry5-jquery/artifactId version3.3.3/version /dependency But when I add an example form to one of my pages: t:form t:jquery.autocomplete / t:submit / /t:form I get an ex: Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Unable to resolve 'jquery/autocomplete' to a component class name. Did I miss something? -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-jQuery-how-to-integrate-tp5717696.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 -- Emmanuel DEMEY Ingénieur Etude et Développement ATOS Worldline +33 (0)6 47 47 42 02 demey.emman...@gmail.com http://emmanueldemey.fr/ Twitter : @EmmanuelDemey
Re: T5 and AppEngine 1.7.3 dev server IllegalStateException
Correction, this issue seems to have shown up w/ GAE 1.7.2 instead of 1.7.3 . Reverting the appengine sdk to version 1.7.1.1 resolves the issue whereas staying w/ 1.7.2 does not. Cheers - Alex K On Mon, Nov 5, 2012 at 11:35 PM, Alex Kotchnev akoch...@gmail.com wrote: I was migrating an older application running on GAE to the latest app engine SDK and I ran into the following issue : any form submissions (whenever there would be a redirect-after-post), result in an IllegalStateException with the stacktrace below. This seems somewhat related to a previous message that cited the exception ( http://tapestry.1045711.n5.nabble.com/Tapestry-Problem-on-Google-App-Engine-in-Development-td5716763.html#a5716858); however, I get this issue in all cases (with or without the contribution to enable/disable gzip encoding). I havent tried deploying this application to production yet to see how it behaves outside of the dev environment. Just switching the GAE version to 1.7.2 makes the application behave properly in the dev environment. So, this is obviously an issue w/ the GAE tooling and I want to file an issue w/ the GAE project - from the stacktrace, any thoughts of why this might be happening (or why Tapestry doesn't like this behavior) ? Cheers - Alex K P.S. The stacktrace is below: - java.lang.IllegalStateException Sanity check - neither a stream response nor a redirect response was generated for this action request. Filter stack framesStack trace - org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:63) - org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42) - org.apache.tapestry5.services.TapestryModule$41.handle(TapestryModule.java:2476) - org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43) - org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39) - org.tynamo.security.SecurityComponentRequestFilter.handleComponentEvent(SecurityComponentRequestFilter.java:41) - org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46) - org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302) - org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26) - org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902) - org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892) - org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90) - org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105) - org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95) - org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85) - org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119) - org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253) - org.tynamo.security.services.impl.SecurityConfiguration$1.call(SecurityConfiguration.java:55) - org.tynamo.security.services.impl.SecurityConfiguration$1.call(SecurityConfiguration.java:53) - org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) - org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) - org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:380) - org.tynamo.security.services.impl.SecurityConfiguration.service(SecurityConfiguration.java:53) - org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53) - org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62) - org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852) - org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171) -
Suppressing t5 translations
Hello Guys, Today I found issue: https://issues.apache.org/jira/browse/TAP5-2023 Short version is that a specific locale (zh_CN) produces an exception in conjunction with field validators because some messages don't use indexed format parameters. The work-around we thought of until this is fixed in tapestry is to suppress the specific locale (zh_CN) and only allowing local zh. Of course, this means that our texts will be translated but tapestry's messages won't be. We can make do with this at the moment but it does raise the question of whether or not there is any way to overwrite T5s already translated messages? If there is not, can I kindly request this feature because if this had happened with locale de or some other important top-level locale we would be in a very, very bad situation right now. Kind Regards, Wulf
Re: Suppressing t5 translations
You can contribute an override message catalog, with overrides of the affected message keys, to the ComponentMessagesSource service. On Tue, Oct 30, 2012 at 10:25 AM, Wechsung, Wulf wulf.wechs...@sap.com wrote: Hello Guys, Today I found issue: https://issues.apache.org/jira/browse/TAP5-2023 Short version is that a specific locale (zh_CN) produces an exception in conjunction with field validators because some messages don't use indexed format parameters. The work-around we thought of until this is fixed in tapestry is to suppress the specific locale (zh_CN) and only allowing local zh. Of course, this means that our texts will be translated but tapestry's messages won't be. We can make do with this at the moment but it does raise the question of whether or not there is any way to overwrite T5s already translated messages? If there is not, can I kindly request this feature because if this had happened with locale de or some other important top-level locale we would be in a very, very bad situation right now. Kind Regards, Wulf -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: Suppressing t5 translations
Wow, that was quick. Thanks :) -Original Message- From: Howard Lewis Ship [mailto:hls...@gmail.com] Sent: Dienstag, 30. Oktober 2012 18:34 To: Tapestry users Subject: Re: Suppressing t5 translations You can contribute an override message catalog, with overrides of the affected message keys, to the ComponentMessagesSource service. On Tue, Oct 30, 2012 at 10:25 AM, Wechsung, Wulf wulf.wechs...@sap.com wrote: Hello Guys, Today I found issue: https://issues.apache.org/jira/browse/TAP5-2023 Short version is that a specific locale (zh_CN) produces an exception in conjunction with field validators because some messages don't use indexed format parameters. The work-around we thought of until this is fixed in tapestry is to suppress the specific locale (zh_CN) and only allowing local zh. Of course, this means that our texts will be translated but tapestry's messages won't be. We can make do with this at the moment but it does raise the question of whether or not there is any way to overwrite T5s already translated messages? If there is not, can I kindly request this feature because if this had happened with locale de or some other important top-level locale we would be in a very, very bad situation right now. Kind Regards, Wulf -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.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: t5: clear cookie when browser closes
Well I ended up injecting the HttpServletResponse and use HttpServletResponse.addCookie directly. I really would liked to use the methods provided by Tapestry to keep the code clean of any workarounds, but I don't think this is possible for this issue. Thanks, Tim -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-clear-cookie-when-browser-closes-tp3380592p5717271.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: clear cookie when browser closes
On Fri, 26 Oct 2012 06:30:05 -0200, sub b4679...@nwldx.com wrote: Well I ended up injecting the HttpServletResponse and use HttpServletResponse.addCookie directly. I really would liked to use the methods provided by Tapestry to keep the code clean of any workarounds, but I don't think this is possible for this issue. Could you please file a JIRA asking for this missing method? -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: t5: clear cookie when browser closes
Thiago, there already is a ticket: https://issues.apache.org/jira/browse/TAP5-1394 I voted for it. -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-clear-cookie-when-browser-closes-tp3380592p5717292.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: clear cookie when browser closes
On Fri, 26 Oct 2012 11:22:06 -0200, sub b4679...@nwldx.com wrote: Thiago, Hi! there already is a ticket: https://issues.apache.org/jira/browse/TAP5-1394 I voted for it. Ah, OK, I overlooked that. Thanks! -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: t5: clear cookie when browser closes
I also have the problem to set a so called session cookie with tapestry. org.apache.tapestry5.services.Cookies Interface is missing (among others) this method: public void writeCookieValue(String name, String value, String path, int maxAge) So if you want to write a Cookie with a custom path and also a custom maxAge you can't. The workaround that I used so far is public void writeCookieValue(String name, String value, String path) and set the maxAge global via AppModule: configuration.add(SymbolConstants.COOKIE_MAX_AGE, 720); But now I want to switch from the persistent cookie to a session cookie, so I changed the line to: configuration.add(SymbolConstants.COOKIE_MAX_AGE, -1); which results in this exception: Exception constructing service 'Cookies': Coercion of -1 to type org.apache.tapestry5.ioc.util.TimeInterval (via String -- org.apache.tapestry5.ioc.util.TimeInterval) failed: Unexpected string '-' (in time interval '-1'). What other options do I have? Thx Tim -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-clear-cookie-when-browser-closes-tp3380592p5717232.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 checkbox and validate
I wonder why the component Checkbox doesn't have the parameter validate like most of the other fields. I have the following security use case: Even when some fields are not rendered to UI (or only rendered disabled) because the user doesn't have the required permission/role, I need to make sure these fields don't get changed through HTTP Post data manipulation. A new validator checking the permissions works fine for fields with validate (for instance a TextField). However, the Checkbox can't be validated. I think the parameter validate would also be useful for any other unpredictable reasons. There was a related topic in 2008: http://tapestry.1045711.n5.nabble.com/T5-checkbox-component-and-validation-td2420125.html In T5 the fields RadioGroup and Palette were extended with this parameter: https://issues.apache.org/jira/browse/TAP5-166 https://issues.apache.org/jira/browse/TAP5-868 Although I managed to solve the scenario the next way, with validate it would be much simpler. 1) New validatable Checkbox /** * Checkbox with validate parameter. (/Note:/ {@link org.apache.tapestry5.corelib.components.Checkbox} components * can not be validated.) * * @author ferengra */ public class ValidatableCheckbox extends AbstractTextField { @Inject private Request request; @Environmental private ValidationTracker tracker; @Override protected void writeFieldTag(MarkupWriter writer, String value) { writer.element(input, type, checkbox, name, getControlName(), id, getClientId(), checked, Boolean.parseBoolean(value) ? checked : null); } final void afterRender(MarkupWriter writer) { writer.end(); // input } @Override protected void processSubmission(String controlName) { super.processSubmission(controlName); String postedValue = request.getParameter(controlName); // Record as true or false tracker.recordInput(this, Boolean.toString(postedValue != null)); } } 2) Add a new translator. /** * Performs boolean translation between server-side and client-side representations. * * @author ferengra */ public class BooleanTranslator extends AbstractTranslatorBoolean { /** * Constructor. */ public BooleanTranslator() { super(boolean, Boolean.class, a-boolean-is-a-boolean); } @Override public void render(Field field, String message, MarkupWriter writer, FormSupport formSupport) { // Does nothing } @Override public Boolean parseClient(Field field, String clientValue, String message) { return on.equalsIgnoreCase(clientValue) || Boolean.TRUE.toString().equalsIgnoreCase(clientValue); } @Override public String toClient(Boolean value) { return String.valueOf(value); } } 3) Add a null field strategy for handling the unchecked checkbox value /** * Treats nulls to or from the client as if they were false. * * @author ferengra */ public class FalseNullFieldStrategy implements NullFieldStrategy { @Override public Object replaceToClient() { return Boolean.FALSE; } @Override public String replaceFromClient() { return Boolean.FALSE.toString(); } } 4) Contribute the above two. public void contributeTranslatorSource(MappedConfigurationClass, Translatorlt;? translator) { translator.add(Boolean.class, new BooleanTranslator()); } public static void contributeNullFieldStrategySource(MappedConfigurationString, NullFieldStrategy configuration) { configuration.add(false, new FalseNullFieldStrategy()); } 5) Add the new checkbox with validation and null field strategy. @SuppressWarnings(unused) @Component(parameters = {value=dto.valueBoolean validate=permission=PERMISSION_UPDATE, nulls=false}) private ValidatableCheckbox valueBoolean; -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-checkbox-and-validate-tp5717169.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: New article re: T5-Flash integration
Ioko-Tapestry-Commons 1.11.0 is compatible with T5.3.6 :) https://github.com/ioko-tapestry-commons/ioko-tapestry-commons Just build the source to have a jar file. -- View this message in context: http://tapestry.1045711.n5.nabble.com/New-article-re-T5-Flash-integration-tp2422860p5717048.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: New article re: T5-Flash integration
Any new link for this? http://knol.google.com/k/toby-hobson/tapestry5-flash-integration/ Dead link... -- View this message in context: http://tapestry.1045711.n5.nabble.com/New-article-re-T5-Flash-integration-tp2422860p5717028.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 and JS UI Frameworks
Hi Everyone, I'm currently evaluating a proprietary JavaScript UI Framework for use with Tapestry5. This framework works like ExtJS in that rich components are instantiated and placed via JavaScript (basically how you'd do UI programming in Swing). Does anyone here have and experience with using a framework like this together with Tapestry for a larger application? Thanks in advance for any pointers or resources! Kind Regards, Wulf
Re: T5 and JS UI Frameworks
Many UI frameworks work best with restful web services that return json responses. You might find tapestry-resteasy a good fit (http://tynamo.org/tapestry-resteasy+guide) -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-and-JS-UI-Frameworks-tp5716703p5716704.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 and JS UI Frameworks
Sounds like vaadin. We use smartgwt in our apps within tapestry. It works great along with an integration layer in the FlowLogix library. On Oct 8, 2012, at 6:38 AM, Wechsung, Wulf wulf.wechs...@sap.com wrote: Hi Everyone, I'm currently evaluating a proprietary JavaScript UI Framework for use with Tapestry5. This framework works like ExtJS in that rich components are instantiated and placed via JavaScript (basically how you'd do UI programming in Swing). Does anyone here have and experience with using a framework like this together with Tapestry for a larger application? Thanks in advance for any pointers or resources! Kind Regards, Wulf - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: calling java native functions in T5
I highly doubt it but T5 is always updating so you might have to read the docs thoroughly to make sure. Yet it's not hard at all to call java functions from templates. http://tapestry.apache.org/property-expressions.html On Sat, Sep 29, 2012 at 12:10 AM, Ken in Nashua kcola...@live.com wrote: Folks, Normally in T4 one would call java native functions as follows: @java.lang.Math@min(collection.size,itemsPerPage) Is this still valid? Or is there another approach to call native functions from a template. Thanks Ken
Re: T4 javascript code snippet upgrade to T5 ?
On Thu, 27 Sep 2012 10:57:40 -0300, Ken in Nashua kcola...@live.com wrote: Folks, Hi! i have a T4 snippet HOME.TML span jwcid=@Script script=/org/trails/demo/components/Gallery.script component = ognl:components.galleryWidget itemsPerPage = ognl:components.galleryWidget.itemsPerPage tableColumns = ognl:components.galleryWidget.tableColumns itemCount=ognl:components.galleryWidget.collection.size cursor=ognl:cursor / Can this all be remodeled in the TML file ? or do I have to remodel it in the JAVA ? Check http://tapestry.apache.org/javascript.html. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: T4 to T5 select component usage
Ivan, Preeviette !!! Thanks for the generous contribution and good faith. I am excited. I will give that a shot over the weekend. Your tech support for tapestry 5 looks good. I will be as generous to post my widget when I get it QA'd... going to be some weeks though... each month I think i have time and keep getting clobbered with interference. I meant to get this gallery going months ago but been pre-empted. I will be sure to share when done. have a great week KEN
Re: [T5] Select, palette, multiselect
Martin Grotzke wrote On Fri, 2007-07-27 at 17:37 -0300, Thiago H de Paula Figueiredo wrote: And has anyone implemented a Select-like component for multiple option selection? It would be very nice to have both multiselect and palette, as T4 has. Take a look at this thread, it's really easy to implement multiselect with T5: http://www.nabble.com/T5%3A-select-component-with-support-for-attribute-%22multiple%22-tf3880056.html#a10996038 Cheers, Martin Thiago - To unsubscribe, e-mail: users-unsubscribe@.apache For additional commands, e-mail: users-help@.apache signature.asc (196 bytes) lt;http://tapestry.1045711.n5.nabble.com/attachment/2408345/0/signature.ascgt; link no longer exists -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Select-palette-multiselect-tp2408343p5716472.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: adding http header
Wulf: Why (rather how) the @Override annotation ? I actually had to remove it for it work. Anyhooo...here is the complete working example (right or wrong, not sure)...comments welcome... Step 1. Created a class in your src/main/java -- SERVICES package - where you will find AppModule.java already installed by Tapestry. In my case, I created a class called RevalidateHTTPHeader package org.yourGroupId.yourArtifactId.services; import java.io.IOException; import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.RequestFilter; import org.apache.tapestry5.services.RequestHandler; import org.apache.tapestry5.services.Response; public class RevalidateHTTPHeader implements RequestFilter { private static final String CACHE_CTRL = Cache-Control; private static final String EXPIRE_DATE = Exprires; public boolean service(Request request, Response response, RequestHandler handler) throws IOException { response.setHeader(CACHE_CTRL, no-cache, no-store, must-revalidate); response.setHeader(EXPIRE_DATE, Sun, 07 Dec 1941 07:55:00 GMT); return handler.service(request, response); } } Step 2. Within AppModule.java, do two things - a. declare the following member variable RevalidateHTTPHeader nocache = new RevalidateHTTPHeader(); b. add the following within contributeRequestHandler method: public void contributeRequestHandler(OrderedConfigurationRequestFilter configuration, @Local RequestFilter filter) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. /// // ADD the custom nocache HTTP header(s) configuration.add(NoCache, nocache); // // configuration.add(Timing, filter); } Step 3: Run Jetty to verify/examine headers - I am using Google Chrome - which has a free HTTP Headers extension. http://localhost:8080/yourArtifactId/[yourPage] Name Extension Content-Encodinggzip Exprires Sun, 07 Dec 1941 07:55:00 GMT Transfer-Encoding chunked ServerJetty(6.1.26) Content-Type text/html; charset=utf-8 Cache-Control no-cache, no-store, must-revalidate -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716459.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: adding http header
If the compiler complained about @Override, you are problem using a 1.5 JDK and Wulf (I assume) was using 1.6. On Sun, Sep 23, 2012 at 3:25 PM, netdawg net.d...@yahoo.com wrote: Wulf: Why (rather how) the @Override annotation ? I actually had to remove it for it work. Anyhooo...here is the complete working example (right or wrong, not sure)...comments welcome... Step 1. Created a class in your src/main/java -- SERVICES package - where you will find AppModule.java already installed by Tapestry. In my case, I created a class called RevalidateHTTPHeader package org.yourGroupId.yourArtifactId.services; import java.io.IOException; import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.RequestFilter; import org.apache.tapestry5.services.RequestHandler; import org.apache.tapestry5.services.Response; public class RevalidateHTTPHeader implements RequestFilter { private static final String CACHE_CTRL = Cache-Control; private static final String EXPIRE_DATE = Exprires; public boolean service(Request request, Response response, RequestHandler handler) throws IOException { response.setHeader(CACHE_CTRL, no-cache, no-store, must-revalidate); response.setHeader(EXPIRE_DATE, Sun, 07 Dec 1941 07:55:00 GMT); return handler.service(request, response); } } Step 2. Within AppModule.java, do two things - a. declare the following member variable RevalidateHTTPHeader nocache = new RevalidateHTTPHeader(); b. add the following within contributeRequestHandler method: public void contributeRequestHandler(OrderedConfigurationRequestFilter configuration, @Local RequestFilter filter) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. /// // ADD the custom nocache HTTP header(s) configuration.add(NoCache, nocache); // // configuration.add(Timing, filter); } Step 3: Run Jetty to verify/examine headers - I am using Google Chrome - which has a free HTTP Headers extension. http://localhost:8080/yourArtifactId/[yourPage] Name Extension Content-Encodinggzip Exprires Sun, 07 Dec 1941 07:55:00 GMT Transfer-Encoding chunked ServerJetty(6.1.26) Content-Type text/html; charset=utf-8 Cache-Control no-cache, no-store, must-revalidate -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716459.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: t5: adding http header
probably, not problem, sorry. On Sun, Sep 23, 2012 at 3:36 PM, Bob Harner bobhar...@gmail.com wrote: If the compiler complained about @Override, you are problem using a 1.5 JDK and Wulf (I assume) was using 1.6. On Sun, Sep 23, 2012 at 3:25 PM, netdawg net.d...@yahoo.com wrote: Wulf: Why (rather how) the @Override annotation ? I actually had to remove it for it work. Anyhooo...here is the complete working example (right or wrong, not sure)...comments welcome... Step 1. Created a class in your src/main/java -- SERVICES package - where you will find AppModule.java already installed by Tapestry. In my case, I created a class called RevalidateHTTPHeader package org.yourGroupId.yourArtifactId.services; import java.io.IOException; import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.RequestFilter; import org.apache.tapestry5.services.RequestHandler; import org.apache.tapestry5.services.Response; public class RevalidateHTTPHeader implements RequestFilter { private static final String CACHE_CTRL = Cache-Control; private static final String EXPIRE_DATE = Exprires; public boolean service(Request request, Response response, RequestHandler handler) throws IOException { response.setHeader(CACHE_CTRL, no-cache, no-store, must-revalidate); response.setHeader(EXPIRE_DATE, Sun, 07 Dec 1941 07:55:00 GMT); return handler.service(request, response); } } Step 2. Within AppModule.java, do two things - a. declare the following member variable RevalidateHTTPHeader nocache = new RevalidateHTTPHeader(); b. add the following within contributeRequestHandler method: public void contributeRequestHandler(OrderedConfigurationRequestFilter configuration, @Local RequestFilter filter) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. /// // ADD the custom nocache HTTP header(s) configuration.add(NoCache, nocache); // // configuration.add(Timing, filter); } Step 3: Run Jetty to verify/examine headers - I am using Google Chrome - which has a free HTTP Headers extension. http://localhost:8080/yourArtifactId/[yourPage] Name Extension Content-Encodinggzip Exprires Sun, 07 Dec 1941 07:55:00 GMT Transfer-Encoding chunked ServerJetty(6.1.26) Content-Type text/html; charset=utf-8 Cache-Control no-cache, no-store, must-revalidate -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716459.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: t5: adding http header
you've got a typo here :) private static final String EXPIRE_DATE = Exprires; s/Exprires/Expires/g i haven't tried it but may give it a go l8r, useful looking service! off topic but [1] seems relevant there is a jquery prefilter suggestion when using jquery [1] = http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results On 24/09/2012, at 5:25 AM, netdawg wrote: Wulf: Why (rather how) the @Override annotation ? I actually had to remove it for it work. Anyhooo...here is the complete working example (right or wrong, not sure)...comments welcome... Step 1. Created a class in your src/main/java -- SERVICES package - where you will find AppModule.java already installed by Tapestry. In my case, I created a class called RevalidateHTTPHeader package org.yourGroupId.yourArtifactId.services; import java.io.IOException; import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.RequestFilter; import org.apache.tapestry5.services.RequestHandler; import org.apache.tapestry5.services.Response; public class RevalidateHTTPHeader implements RequestFilter { private static final String CACHE_CTRL = Cache-Control; private static final String EXPIRE_DATE = Exprires; public boolean service(Request request, Response response, RequestHandler handler) throws IOException { response.setHeader(CACHE_CTRL, no-cache, no-store, must-revalidate); response.setHeader(EXPIRE_DATE, Sun, 07 Dec 1941 07:55:00 GMT); return handler.service(request, response); } } Step 2. Within AppModule.java, do two things - a. declare the following member variable RevalidateHTTPHeader nocache = new RevalidateHTTPHeader(); b. add the following within contributeRequestHandler method: public void contributeRequestHandler(OrderedConfigurationRequestFilter configuration, @Local RequestFilter filter) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. /// // ADD the custom nocache HTTP header(s) configuration.add(NoCache, nocache); // // configuration.add(Timing, filter); } Step 3: Run Jetty to verify/examine headers - I am using Google Chrome - which has a free HTTP Headers extension. http://localhost:8080/yourArtifactId/[yourPage] Name Extension Content-Encoding gzip Exprires Sun, 07 Dec 1941 07:55:00 GMT Transfer-Encoding chunked Server Jetty(6.1.26) Content-Type text/html; charset=utf-8 Cache-Controlno-cache, no-store, must-revalidate -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716459.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: adding http header
Thanks!! Yep, even though java -version on command line shows 1.6, the Eclipse (right click) project -- properties -- java compiler shows using JDK 1.5 compliance. Changed that to 1.6 and sure enough no complaints on the @Override annotation anymore. And thanks for that typo catch ;-). In fact, off-topic, but in case anyone would like to use this code, the whole expires date can be made redundant by using max-age in the HTTP request header, per RFC 2616 14.21. response.setHeader(CACHE_CTRL, no-cache, no-store, max-age=0, must-revalidate); Also see: http://www.mnot.net/blog/2007/05/15/expires_max-age (this also has a link to an excellent tutorial on caches - must read - basic message being cache control is probably best handled by web server, if you can control it, rather than in your application) -- View this message in context: http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716463.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: T4 to T5 select component usage
1. To place components defined in java class on your template you should use t:id attribute equal to field name(id attribute references clientId logic). As you don't use this attribute in your code snippet you have 2 separate selects. One of this selects are defined within java class and doesn't present on template, so you have an exception(As far as I understand you have such mistakes with page and tableColumnsSelect components too). To fix this issue you can: 1) set t:id attribute: select t:type=Select t:id=itemsPerPageSelect model=literal:5,10,15,25,50, 100,250,500,1000,5000,1 value=itemsPerPage / 2) remove component definition from java class(if you don't use it for custom validation) 2. To use select component dynamic behaviour you should wrap it with zone component and define its zone parameter. Default event propogated will be EventConstants.VALUE_CHANGED: TML: t:zone t:id=updateZone ... select t:type=Select t:id=itemsPerPageSelect model=literal:5,10,15,25,50, 100,250,500,1000,5000,1 value=itemsPerPage zone=prop:updateZone / ... /t:zone JAVA: @Component private Zone updateZone; public String getUpdateZoneId() { return updateZone.getClientId(); } @OnEvent(value = EventConstants.VALUE_CHANGED, component = itemsPerPageSelect ) public Object onItemsPerPageChange() { ... return updateZone; } http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Select.html 3. Select component doesn't have defaultValue parameter. On Fri, Sep 21, 2012 at 6:10 AM, Ken in Nashua kcola...@live.com wrote: Referring to syntax... nothing personal. kcola...@live.com From: kcola...@live.com To: users@tapestry.apache.org Subject: RE: T4 to T5 select component usage Date: Thu, 20 Sep 2012 23:06:27 -0400 Apologies for post... I uncovered some additional configurations that I failed to migrate to my T5 code base. The actual definitions of the components usage I am attempting to use... inside my Home.tml h1 div id=page.title span jwcid=@Insert value=Listings/ /div /h1 form jwcid=galleryForm@Form listener=listener:galleryFormSubmit div jwcid=galleryWidget@custom:Gallery collectionType=ognl:@org.trails.demo.Listing@class itemsPerPage=ognl:itemsPerPage tableColumns=ognl:tableColumns cursor=ognl:cursor span jwcid=@RenderBodycontent goes here/span /div /form span jwcid=@Script script=/org/trails/demo/components/Gallery.script component = ognl:components.galleryWidget itemsPerPage = ognl:components.galleryWidget.itemsPerPage tableColumns = ognl:components.galleryWidget.tableColumns itemCount=ognl:components.galleryWidget.collection.size cursor=ognl:cursor / ghack... glad ognl is gone... and thats no fluff kcola...@live.com From: kcola...@live.com To: users@tapestry.apache.org Subject: T4 to T5 select component usage Date: Thu, 20 Sep 2012 21:15:39 -0400 Guys/Gals (if any), I am upgrading some T4 code to T5 I have a T4 select component configuration/usage as follows: --- TML snippet --- tr td width=25% align=left nowrap=NOWRAP t:LabelItems Per Page/t:Label select t:type=Select id=itemsPerPageSelect model=literal:5,10,15,25,50,100,250,500,1000,5000,1 value=itemsPerPage defaultValue=9 onchange=tapestry.form.refresh(this.form) / --- JAVA snippet --- @Component(parameters = { event=itemsPerPageChange, clientId=itemsPerPageSelect }) private Select itemsPerPageSelect; @OnEvent(value = action, component = select) public Object onItemsPerPageChange() { ... Am I missing something ? I don't understand the error below as to why this configuration is not sufficient. Thanks in advance... kcola...@live.com An unexpected application exception has occurred.java.lang.RuntimeExceptionException assembling root component of page Home: Embedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).org.apache.tapestry5.ioc.internal.OperationExceptionEmbedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org
T4 to T5 select component usage
Guys/Gals (if any), I am upgrading some T4 code to T5 I have a T4 select component configuration/usage as follows: --- TML snippet --- tr td width=25% align=left nowrap=NOWRAP t:LabelItems Per Page/t:Label select t:type=Select id=itemsPerPageSelect model=literal:5,10,15,25,50,100,250,500,1000,5000,1 value=itemsPerPage defaultValue=9 onchange=tapestry.form.refresh(this.form) / --- JAVA snippet --- @Component(parameters = { event=itemsPerPageChange, clientId=itemsPerPageSelect }) private Select itemsPerPageSelect; @OnEvent(value = action, component = select) public Object onItemsPerPageChange() { ... Am I missing something ? I don't understand the error below as to why this configuration is not sufficient. Thanks in advance... kcola...@live.com An unexpected application exception has occurred.java.lang.RuntimeExceptionException assembling root component of page Home: Embedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).org.apache.tapestry5.ioc.internal.OperationExceptionEmbedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).traceConstructing instance of page class org.tynamo.examples.hibernatesecurity.pages.HomeAssembling root component for page HomeCreating ComponentAssembler for org.tynamo.examples.hibernatesecurity.components.Galleryjava.lang.RuntimeExceptionEmbedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).
RE: T4 to T5 select component usage
Apologies for post... I uncovered some additional configurations that I failed to migrate to my T5 code base. The actual definitions of the components usage I am attempting to use... inside my Home.tml h1 div id=page.title span jwcid=@Insert value=Listings/ /div /h1 form jwcid=galleryForm@Form listener=listener:galleryFormSubmit div jwcid=galleryWidget@custom:Gallery collectionType=ognl:@org.trails.demo.Listing@class itemsPerPage=ognl:itemsPerPage tableColumns=ognl:tableColumns cursor=ognl:cursor span jwcid=@RenderBodycontent goes here/span /div /form span jwcid=@Script script=/org/trails/demo/components/Gallery.script component = ognl:components.galleryWidget itemsPerPage = ognl:components.galleryWidget.itemsPerPage tableColumns = ognl:components.galleryWidget.tableColumns itemCount=ognl:components.galleryWidget.collection.size cursor=ognl:cursor / ghack... glad ognl is gone... and thats no fluff kcola...@live.com From: kcola...@live.com To: users@tapestry.apache.org Subject: T4 to T5 select component usage Date: Thu, 20 Sep 2012 21:15:39 -0400 Guys/Gals (if any), I am upgrading some T4 code to T5 I have a T4 select component configuration/usage as follows: --- TML snippet --- tr td width=25% align=left nowrap=NOWRAP t:LabelItems Per Page/t:Label select t:type=Select id=itemsPerPageSelect model=literal:5,10,15,25,50,100,250,500,1000,5000,1 value=itemsPerPage defaultValue=9 onchange=tapestry.form.refresh(this.form) / --- JAVA snippet --- @Component(parameters = { event=itemsPerPageChange, clientId=itemsPerPageSelect }) private Select itemsPerPageSelect; @OnEvent(value = action, component = select) public Object onItemsPerPageChange() { ... Am I missing something ? I don't understand the error below as to why this configuration is not sufficient. Thanks in advance... kcola...@live.com An unexpected application exception has occurred.java.lang.RuntimeExceptionException assembling root component of page Home: Embedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).org.apache.tapestry5.ioc.internal.OperationExceptionEmbedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).traceConstructing instance of page class org.tynamo.examples.hibernatesecurity.pages.HomeAssembling root component for page HomeCreating ComponentAssembler for org.tynamo.examples.hibernatesecurity.components.Galleryjava.lang.RuntimeExceptionEmbedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).
RE: T4 to T5 select component usage
Referring to syntax... nothing personal. kcola...@live.com From: kcola...@live.com To: users@tapestry.apache.org Subject: RE: T4 to T5 select component usage Date: Thu, 20 Sep 2012 23:06:27 -0400 Apologies for post... I uncovered some additional configurations that I failed to migrate to my T5 code base. The actual definitions of the components usage I am attempting to use... inside my Home.tml h1 div id=page.title span jwcid=@Insert value=Listings/ /div /h1 form jwcid=galleryForm@Form listener=listener:galleryFormSubmit div jwcid=galleryWidget@custom:Gallery collectionType=ognl:@org.trails.demo.Listing@class itemsPerPage=ognl:itemsPerPage tableColumns=ognl:tableColumns cursor=ognl:cursor span jwcid=@RenderBodycontent goes here/span /div /form span jwcid=@Script script=/org/trails/demo/components/Gallery.script component = ognl:components.galleryWidget itemsPerPage = ognl:components.galleryWidget.itemsPerPage tableColumns = ognl:components.galleryWidget.tableColumns itemCount=ognl:components.galleryWidget.collection.size cursor=ognl:cursor / ghack... glad ognl is gone... and thats no fluff kcola...@live.com From: kcola...@live.com To: users@tapestry.apache.org Subject: T4 to T5 select component usage Date: Thu, 20 Sep 2012 21:15:39 -0400 Guys/Gals (if any), I am upgrading some T4 code to T5 I have a T4 select component configuration/usage as follows: --- TML snippet --- tr td width=25% align=left nowrap=NOWRAP t:LabelItems Per Page/t:Label select t:type=Select id=itemsPerPageSelect model=literal:5,10,15,25,50,100,250,500,1000,5000,1 value=itemsPerPage defaultValue=9 onchange=tapestry.form.refresh(this.form) / --- JAVA snippet --- @Component(parameters = { event=itemsPerPageChange, clientId=itemsPerPageSelect }) private Select itemsPerPageSelect; @OnEvent(value = action, component = select) public Object onItemsPerPageChange() { ... Am I missing something ? I don't understand the error below as to why this configuration is not sufficient. Thanks in advance... kcola...@live.com An unexpected application exception has occurred.java.lang.RuntimeExceptionException assembling root component of page Home: Embedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).org.apache.tapestry5.ioc.internal.OperationExceptionEmbedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).traceConstructing instance of page class org.tynamo.examples.hibernatesecurity.pages.HomeAssembling root component for page HomeCreating ComponentAssembler for org.tynamo.examples.hibernatesecurity.components.Galleryjava.lang.RuntimeExceptionEmbedded component(s) itemsPerPageSelect, page, tableColumnsSelect are defined within component class org.tynamo.examples.hibernatesecurity.components.Gallery (or a super-class of Gallery), but are not present in the component template (classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml).
Re: T5 Auto Binding of DAOs
There's a typo in the code snippet, should be: String className = interfacesPackage.getName() + .impl. + intf.getSimpleName() + Impl; We need just package name, not its toString() presentation which is package com.x.y.z On Thu, Aug 16, 2012 at 11:34 AM, Dmitry Gusev dmitry.gu...@gmail.comwrote: Thanks for sharing, Norman! Here's mine implementation: public static void bind(ServiceBinder binder) throwsClassNotFoundException { autobindServices(binder, ProjectDAO.class.getPackage()); autobindServices(binder, ProjectManager.class.getPackage()); ... } @SuppressWarnings({unchecked, rawtypes}) private static void autobindServices(ServiceBinder binder, Package interfacesPackage) throws ClassNotFoundException { ListClass? interfaces = Utils.getClassesForPackage(interfacesPackage.getName()); for (Class intf : interfaces) { String className = interfacesPackage + .impl. + intf.getSimpleName() + Impl; try { Class impl = Class.forName(className); binder.bind(intf, impl); } catch (ClassNotFoundException e) { logger.warn(Class not found during autobinding: {}, className); } } } On Thu, Aug 16, 2012 at 2:33 AM, Norman Franke nor...@myasd.com wrote: Something similar was asked in another thread, but I figured others may find this helpful. I wanted to automatically bind my interfaces and implementations of my numerous DAOs in my AppModule. It's pretty easy, so here is what I idd. This is called from the bind static method. Obviously you'd need to change the package names. My naming convention is to put the implementation packages in a sub .impl package, e.g. com.myasd.db.dao.impl in my case. Classes then are suffixed with Impl to make Eclipse's package auto-complete suggestions work better. I've been using this for a few years, at lest. @SuppressWarnings({ unchecked, rawtypes }) static void bindDAOs(ServiceBinder binder) { try { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); ListClass? daos = PackageEnumerator.getClassesForPackage(com.myasd.db.dao); for (Class? dao : daos) { String pkg = dao.getPackage().getName(); String cls = dao.getSimpleName(); try { Class impl = contextClassLoader.loadClass(pkg+.impl.+cls+Impl); binder.bind(dao, impl).scope(ScopeConstants.PERTHREAD); } catch (ClassNotFoundException e) { // Ignore, we just won't bind that class. } } } catch (ClassNotFoundException e) { e.printStackTrace(); } } Helper method borrowed from who-knows-where: public static ListClass? getClassesForPackage(String packageName) throws ClassNotFoundException { // This will hold a list of directories matching the pckgname. // There may be more than one if a package is split over multiple // jars/paths ListClass? classes = new ArrayListClass?(); ArrayListFile directories = new ArrayListFile(); try { ClassLoader cld = Thread.currentThread().getContextClassLoader(); if (cld == null) { throw new ClassNotFoundException(Can't get class loader.); } // Ask for all resources for the path EnumerationURL resources = cld.getResources(packageName.replace('.', '/')); while (resources.hasMoreElements()) { URL res = resources.nextElement(); if (res.getProtocol().equalsIgnoreCase(jar)) { JarURLConnection conn = (JarURLConnection) res.openConnection(); JarFile jar = conn.getJarFile(); for (JarEntry e : Collections.list(jar.entries())) { if (e.getName().startsWith(packageName.replace('.', '/')) e.getName().endsWith(.class) !e.getName().contains($)) { String className = e.getName().replace(/, .).substring(0, e.getName().length() - 6); System.out.println(className); classes.add(Class.forName(className)); } } } else directories.add(new File(URLDecoder.decode(res.getPath(), UTF-8))); } } catch (NullPointerException x) { throw new ClassNotFoundException(packageName + does not appear to be + a valid package (Null pointer exception)); } catch (UnsupportedEncodingException encex) { throw new
T5: how to catch the exceptions thrown by the event handler?
Hi there, Tapestry version: 5.3.3 How to catch the exceptions thrown by the event handler? e.g.: try { resources.triggerEvent(anEvent, new Object[]{}, null); } catch (Exception e) { logger.error(Error occurred., e); form.recordError(e.getMessage()); } But seems that the catch parts never get executed, T5 just redirects the request to the exception page. Thanks, Yunhua
Re: T5: how to catch the exceptions thrown by the event handler?
On Mon, 20 Aug 2012 12:09:25 -0300, Yunhua Sang yunhua.s...@gmail.com wrote: Hi there, Hi! Tapestry version: 5.3.3 How to catch the exceptions thrown by the event handler? e.g.: try { resources.triggerEvent(anEvent, new Object[]{}, null); } catch (Exception e) { logger.error(Error occurred., e); form.recordError(e.getMessage()); } triggerEvent() just triggers the event, it doesn't handle it. But seems that the catch parts never get executed, T5 just redirects the request to the exception page. You can use a global exception page. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: how to catch the exceptions thrown by the event handler?
Thanks Thiago. I am a bit confused from the API, it said: * @throws org.apache.tapestry5.runtime.ComponentEventException * if an event handler method throws a checked or unchecked exception but seems it did not go this way. On Mon, Aug 20, 2012 at 1:07 PM, Thiago H de Paula Figueiredo thiag...@gmail.com wrote: On Mon, 20 Aug 2012 12:09:25 -0300, Yunhua Sang yunhua.s...@gmail.com wrote: Hi there, Hi! Tapestry version: 5.3.3 How to catch the exceptions thrown by the event handler? e.g.: try { resources.triggerEvent(**anEvent, new Object[]{}, null); } catch (Exception e) { logger.error(Error occurred., e); form.recordError(e.getMessage(**)); } triggerEvent() just triggers the event, it doesn't handle it. But seems that the catch parts never get executed, T5 just redirects the request to the exception page. You can use a global exception page. -- Thiago H. de Paula Figueiredo --**--**- To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.orgusers-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: how to catch the exceptions thrown by the event handler?
On Mon, 20 Aug 2012 15:13:04 -0300, Yunhua Sang yunhua.s...@gmail.com wrote: Thanks Thiago. I am a bit confused from the API, it said: * @throws org.apache.tapestry5.runtime.ComponentEventException * if an event handler method throws a checked or unchecked exception but seems it did not go this way. Ouch, I'm sorry, I overlooked that. I don't know what's happening in your case. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: how to catch the exceptions thrown by the event handler?
Tynamo.org has an excellent tapestry-exceptionpage module just for this purpose as well. On Aug 20, 2012, at 10:09 AM, Yunhua Sang yunhua.s...@gmail.com wrote: Hi there, Tapestry version: 5.3.3 How to catch the exceptions thrown by the event handler? e.g.: try { resources.triggerEvent(anEvent, new Object[]{}, null); } catch (Exception e) { logger.error(Error occurred., e); form.recordError(e.getMessage()); } But seems that the catch parts never get executed, T5 just redirects the request to the exception page. Thanks, Yunhua - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: how to catch the exceptions thrown by the event handler?
Thanks Thiago and Lenny. It's my bad, I messed up the events chain. On Mon, Aug 20, 2012 at 3:18 PM, Lenny Primak lpri...@hope.nyc.ny.uswrote: Tynamo.org has an excellent tapestry-exceptionpage module just for this purpose as well. On Aug 20, 2012, at 10:09 AM, Yunhua Sang yunhua.s...@gmail.com wrote: Hi there, Tapestry version: 5.3.3 How to catch the exceptions thrown by the event handler? e.g.: try { resources.triggerEvent(anEvent, new Object[]{}, null); } catch (Exception e) { logger.error(Error occurred., e); form.recordError(e.getMessage()); } But seems that the catch parts never get executed, T5 just redirects the request to the exception page. Thanks, Yunhua - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Auto Binding of DAOs
Hi, correct me if I wrong, but you can't get instance of ClassNameLocator in module's bind method, right? Since the registry is not started yet. On Thu, Aug 16, 2012 at 2:43 AM, Thiago H de Paula Figueiredo thiag...@gmail.com wrote: On Wed, 15 Aug 2012 19:33:24 -0300, Norman Franke nor...@myasd.com wrote: Helper method borrowed from who-knows-where: public static ListClass? getClassesForPackage(String packageName) throws ClassNotFoundException { Have you taken a look at Tapestry's ClassNameLocator and ClassNameLocatorImpl? When I need something like that, that's what I've used. -- Thiago H. de Paula Figueiredo --**--**- To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.orgusers-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Dmitry Gusev AnjLab Team http://anjlab.com
Re: T5 Auto Binding of DAOs
Thanks for sharing, Norman! Here's mine implementation: public static void bind(ServiceBinder binder) throwsClassNotFoundException { autobindServices(binder, ProjectDAO.class.getPackage()); autobindServices(binder, ProjectManager.class.getPackage()); ... } @SuppressWarnings({unchecked, rawtypes}) private static void autobindServices(ServiceBinder binder, Package interfacesPackage) throws ClassNotFoundException { ListClass? interfaces = Utils.getClassesForPackage(interfacesPackage.getName()); for (Class intf : interfaces) { String className = interfacesPackage + .impl. + intf.getSimpleName() + Impl; try { Class impl = Class.forName(className); binder.bind(intf, impl); } catch (ClassNotFoundException e) { logger.warn(Class not found during autobinding: {}, className); } } } On Thu, Aug 16, 2012 at 2:33 AM, Norman Franke nor...@myasd.com wrote: Something similar was asked in another thread, but I figured others may find this helpful. I wanted to automatically bind my interfaces and implementations of my numerous DAOs in my AppModule. It's pretty easy, so here is what I idd. This is called from the bind static method. Obviously you'd need to change the package names. My naming convention is to put the implementation packages in a sub .impl package, e.g. com.myasd.db.dao.impl in my case. Classes then are suffixed with Impl to make Eclipse's package auto-complete suggestions work better. I've been using this for a few years, at lest. @SuppressWarnings({ unchecked, rawtypes }) static void bindDAOs(ServiceBinder binder) { try { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); ListClass? daos = PackageEnumerator.getClassesForPackage(com.myasd.db.dao); for (Class? dao : daos) { String pkg = dao.getPackage().getName(); String cls = dao.getSimpleName(); try { Class impl = contextClassLoader.loadClass(pkg+.impl.+cls+Impl); binder.bind(dao, impl).scope(ScopeConstants.PERTHREAD); } catch (ClassNotFoundException e) { // Ignore, we just won't bind that class. } } } catch (ClassNotFoundException e) { e.printStackTrace(); } } Helper method borrowed from who-knows-where: public static ListClass? getClassesForPackage(String packageName) throws ClassNotFoundException { // This will hold a list of directories matching the pckgname. // There may be more than one if a package is split over multiple // jars/paths ListClass? classes = new ArrayListClass?(); ArrayListFile directories = new ArrayListFile(); try { ClassLoader cld = Thread.currentThread().getContextClassLoader(); if (cld == null) { throw new ClassNotFoundException(Can't get class loader.); } // Ask for all resources for the path EnumerationURL resources = cld.getResources(packageName.replace('.', '/')); while (resources.hasMoreElements()) { URL res = resources.nextElement(); if (res.getProtocol().equalsIgnoreCase(jar)) { JarURLConnection conn = (JarURLConnection) res.openConnection(); JarFile jar = conn.getJarFile(); for (JarEntry e : Collections.list(jar.entries())) { if (e.getName().startsWith(packageName.replace('.', '/')) e.getName().endsWith(.class) !e.getName().contains($)) { String className = e.getName().replace(/, .).substring(0, e.getName().length() - 6); System.out.println(className); classes.add(Class.forName(className)); } } } else directories.add(new File(URLDecoder.decode(res.getPath(), UTF-8))); } } catch (NullPointerException x) { throw new ClassNotFoundException(packageName + does not appear to be + a valid package (Null pointer exception)); } catch (UnsupportedEncodingException encex) { throw new ClassNotFoundException(packageName + does not appear to be + a valid package (Unsupported encoding)); } catch (IOException ioex) { throw new ClassNotFoundException(IOException was thrown when trying + to get all resources for + packageName); } // For every
Re: T5 Auto Binding of DAOs
On Thu, 16 Aug 2012 03:48:17 -0300, Dmitry Gusev dmitry.gu...@gmail.com wrote: Hi, Hi! correct me if I wrong, but you can't get instance of ClassNameLocator in module's bind method, right? Since the registry is not started yet. Nope, but maybe Tapestry-IoC could provide it anyway. JIRA please? -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Auto Binding of DAOs
I remember tapestry that by searching for implementation classes in the same package by the same name but suffixed by Impl. Like MySvc as in interface and MySvcImpl as the implementation. 1. When I wan'ted to extract that piece of info from the docs I couldn't find it ! Is it deprecated ?! 2. The only advantage from the codes listed in this thread is placing the implementation classes in a sub-package called impl, correct ? On Thu, Aug 16, 2012 at 1:51 PM, Thiago H de Paula Figueiredo thiag...@gmail.com wrote: On Thu, 16 Aug 2012 03:48:17 -0300, Dmitry Gusev dmitry.gu...@gmail.com wrote: Hi, Hi! correct me if I wrong, but you can't get instance of ClassNameLocator in module's bind method, right? Since the registry is not started yet. Nope, but maybe Tapestry-IoC could provide it anyway. JIRA please? -- Thiago H. de Paula Figueiredo --**--**- To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.orgusers-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- *Regards,* *Muhammad Gelbana Java Developer*
Re: T5 Auto Binding of DAOs
I might.. yes. I don't necessarily need a lot of content, but a paragraph and a few code snippets for each service would be a fantastic jump-off point. One side effect of all Tapestry's injection, reflection-based config and event binding, and literate APIs, is that the explorability suffers a bit. I can't rely on my IDE auto-completing the relevant events on an interface, I've got to find some relevant documentation. It's a very powerful thing to know what all your choices are within the IDE. Michael On 15 August 2012 22:52, Thiago H de Paula Figueiredo thiag...@gmail.comwrote: On Wed, 15 Aug 2012 19:47:50 -0300, Michael Prescott michael.r.presc...@gmail.com wrote: That's very nifty, Norman. This is a simultaneously inspiring and depressing reminder that despite having used Tapestry since version 3, I still feel like a total noob. :-) I'd love to see a blog series on Services you never knew about and fun things to do with them! Would you guys buy a book with this kind of stuff? -- Thiago H. de Paula Figueiredo --**--**- To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.orgusers-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: override numeric validator message for specific field
On Wed, 15 Aug 2012 09:16:58 -0300, Dmitriy Vsekhvalnov dvsekhval...@gmail.com wrote: Hello, Hi! I have BigDecimal property named: hourlyRate, default validator message is: 'You must provide numeric value for Hourly Rate' how i can override it with page.properties? Neither number-format-exception nor hourlyRate-number-message keys work. Try this: http://tapestry.1045711.n5.nabble.com/Override-numericformat-error-message-td4755753.html -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5 Auto Binding of DAOs
Something similar was asked in another thread, but I figured others may find this helpful. I wanted to automatically bind my interfaces and implementations of my numerous DAOs in my AppModule. It's pretty easy, so here is what I idd. This is called from the bind static method. Obviously you'd need to change the package names. My naming convention is to put the implementation packages in a sub .impl package, e.g. com.myasd.db.dao.impl in my case. Classes then are suffixed with Impl to make Eclipse's package auto-complete suggestions work better. I've been using this for a few years, at lest. @SuppressWarnings({ unchecked, rawtypes }) static void bindDAOs(ServiceBinder binder) { try { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); ListClass? daos = PackageEnumerator.getClassesForPackage(com.myasd.db.dao); for (Class? dao : daos) { String pkg = dao.getPackage().getName(); String cls = dao.getSimpleName(); try { Class impl = contextClassLoader.loadClass(pkg+.impl.+cls+Impl); binder.bind(dao, impl).scope(ScopeConstants.PERTHREAD); } catch (ClassNotFoundException e) { // Ignore, we just won't bind that class. } } } catch (ClassNotFoundException e) { e.printStackTrace(); } } Helper method borrowed from who-knows-where: public static ListClass? getClassesForPackage(String packageName) throws ClassNotFoundException { // This will hold a list of directories matching the pckgname. // There may be more than one if a package is split over multiple // jars/paths ListClass? classes = new ArrayListClass?(); ArrayListFile directories = new ArrayListFile(); try { ClassLoader cld = Thread.currentThread().getContextClassLoader(); if (cld == null) { throw new ClassNotFoundException(Can't get class loader.); } // Ask for all resources for the path EnumerationURL resources = cld.getResources(packageName.replace('.', '/')); while (resources.hasMoreElements()) { URL res = resources.nextElement(); if (res.getProtocol().equalsIgnoreCase(jar)) { JarURLConnection conn = (JarURLConnection) res.openConnection(); JarFile jar = conn.getJarFile(); for (JarEntry e : Collections.list(jar.entries())) { if (e.getName().startsWith(packageName.replace('.', '/')) e.getName().endsWith(.class) !e.getName().contains($)) { String className = e.getName().replace(/, .).substring(0, e.getName().length() - 6); System.out.println(className); classes.add(Class.forName(className)); } } } else directories.add(new File(URLDecoder.decode(res.getPath(), UTF-8))); } } catch (NullPointerException x) { throw new ClassNotFoundException(packageName + does not appear to be + a valid package (Null pointer exception)); } catch (UnsupportedEncodingException encex) { throw new ClassNotFoundException(packageName + does not appear to be + a valid package (Unsupported encoding)); } catch (IOException ioex) { throw new ClassNotFoundException(IOException was thrown when trying + to get all resources for + packageName); } // For every directory identified capture all the .class files for (File directory : directories) { if (directory.exists()) { // Get the list of the files contained in the package String[] files = directory.list(); for (String file : files) { // we are only interested in .class files if (file.endsWith(.class)) { // removes the .class extension classes.add(Class.forName(packageName + '.' + file.substring(0, file.length() - 6))); } } } else { throw new ClassNotFoundException(packageName + ( + directory.getPath() + ) does not appear to be a valid package); } } return classes; } Norman Franke Answering Service for Directors, Inc. www.myasd.com
Re: T5 Auto Binding of DAOs
On Wed, 15 Aug 2012 19:33:24 -0300, Norman Franke nor...@myasd.com wrote: Helper method borrowed from who-knows-where: public static ListClass? getClassesForPackage(String packageName) throws ClassNotFoundException { Have you taken a look at Tapestry's ClassNameLocator and ClassNameLocatorImpl? When I need something like that, that's what I've used. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Auto Binding of DAOs
That's very nifty, Norman. This is a simultaneously inspiring and depressing reminder that despite having used Tapestry since version 3, I still feel like a total noob. :-) I'd love to see a blog series on Services you never knew about and fun things to do with them! Michael On 15 August 2012 18:33, Norman Franke nor...@myasd.com wrote: Something similar was asked in another thread, but I figured others may find this helpful. I wanted to automatically bind my interfaces and implementations of my numerous DAOs in my AppModule. It's pretty easy, so here is what I idd. This is called from the bind static method. Obviously you'd need to change the package names. My naming convention is to put the implementation packages in a sub .impl package, e.g. com.myasd.db.dao.impl in my case. Classes then are suffixed with Impl to make Eclipse's package auto-complete suggestions work better. I've been using this for a few years, at lest. @SuppressWarnings({ unchecked, rawtypes }) static void bindDAOs(ServiceBinder binder) { try { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); ListClass? daos = PackageEnumerator.getClassesForPackage(com.myasd.db.dao); for (Class? dao : daos) { String pkg = dao.getPackage().getName(); String cls = dao.getSimpleName(); try { Class impl = contextClassLoader.loadClass(pkg+.impl.+cls+Impl); binder.bind(dao, impl).scope(ScopeConstants.PERTHREAD); } catch (ClassNotFoundException e) { // Ignore, we just won't bind that class. } } } catch (ClassNotFoundException e) { e.printStackTrace(); } } Helper method borrowed from who-knows-where: public static ListClass? getClassesForPackage(String packageName) throws ClassNotFoundException { // This will hold a list of directories matching the pckgname. // There may be more than one if a package is split over multiple // jars/paths ListClass? classes = new ArrayListClass?(); ArrayListFile directories = new ArrayListFile(); try { ClassLoader cld = Thread.currentThread().getContextClassLoader(); if (cld == null) { throw new ClassNotFoundException(Can't get class loader.); } // Ask for all resources for the path EnumerationURL resources = cld.getResources(packageName.replace('.', '/')); while (resources.hasMoreElements()) { URL res = resources.nextElement(); if (res.getProtocol().equalsIgnoreCase(jar)) { JarURLConnection conn = (JarURLConnection) res.openConnection(); JarFile jar = conn.getJarFile(); for (JarEntry e : Collections.list(jar.entries())) { if (e.getName().startsWith(packageName.replace('.', '/')) e.getName().endsWith(.class) !e.getName().contains($)) { String className = e.getName().replace(/, .).substring(0, e.getName().length() - 6); System.out.println(className); classes.add(Class.forName(className)); } } } else directories.add(new File(URLDecoder.decode(res.getPath(), UTF-8))); } } catch (NullPointerException x) { throw new ClassNotFoundException(packageName + does not appear to be + a valid package (Null pointer exception)); } catch (UnsupportedEncodingException encex) { throw new ClassNotFoundException(packageName + does not appear to be + a valid package (Unsupported encoding)); } catch (IOException ioex) { throw new ClassNotFoundException(IOException was thrown when trying + to get all resources for + packageName); } // For every directory identified capture all the .class files for (File directory : directories) { if (directory.exists()) { // Get the list of the files contained in the package String[] files = directory.list(); for (String file : files) { // we are only interested in .class files if (file.endsWith(.class)) { // removes the .class extension classes.add(Class.forName(packageName + '.' + file.substring(0, file.length() - 6))); } } } else { throw new ClassNotFoundException(packageName + ( + directory.getPath() + )
Re: T5 Auto Binding of DAOs
It was an internal class when I first started, and I generally won't use classes in internal packages. I see it's been moved, so that may very well be a better idea. Norman Franke Answering Service for Directors, Inc. www.myasd.com On Aug 15, 2012, at 6:43 PM, Thiago H de Paula Figueiredo wrote: On Wed, 15 Aug 2012 19:33:24 -0300, Norman Franke nor...@myasd.com wrote: Helper method borrowed from who-knows-where: public static ListClass? getClassesForPackage(String packageName) throws ClassNotFoundException { Have you taken a look at Tapestry's ClassNameLocator and ClassNameLocatorImpl? When I need something like that, that's what I've used. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Auto Binding of DAOs
On Wed, 15 Aug 2012 19:47:50 -0300, Michael Prescott michael.r.presc...@gmail.com wrote: That's very nifty, Norman. This is a simultaneously inspiring and depressing reminder that despite having used Tapestry since version 3, I still feel like a total noob. :-) I'd love to see a blog series on Services you never knew about and fun things to do with them! Would you guys buy a book with this kind of stuff? -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: standard validator for decimal numbers with 2 digits?
Either contribute a Validator and/or write some javascript. On Tue, Aug 14, 2012 at 12:50 PM, Dmitriy Vsekhvalnov dvsekhval...@gmail.com wrote: Hi everybody, stupidly, but can't find it: Can i have input field for double values, which restricts up to 2 digits after point? Thanks.
Re: T5: How to custome the GridPager ?
Thank you antalk ,the problem has been done. I use this annotation @Component(parameters = { source=dataSource, rowsPerPage=rowsPerPage, currentPage=currentPage }) private GridPager eloqPager; to connect the my override pager to the grid. -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-How-to-custome-the-GridPager-tp5715219p5715376.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 custome the GridPager ?
Hi, Depends on what you want to change ? 1. Layout - colors - change the CSS 2. Structure and or behaviour - override the GridPager class -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-How-to-custome-the-GridPager-tp5715219p5715220.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