Re: JSON issue when upgrading to 5.3.3 from 5.2.6
See below for more details: http://tapestry.apache.org/how-to-upgrade.html http://tapestry.apache.org/configuration.html#Configuration-tapestry.applicationversion http://tapestry.apache.org/templating-and-markup-faq.html#TemplatingandMarkupFAQ-WhydomyimagesandstylesheetsendupwithaweirdURLslike%7B%7B%2Fassets%2Feea17aee26bc0cae%2Fctx%2Flayout%2Flayout.css%7D%7D%3F http://tapestry.apache.org/assets.html#Assets-AssetURLs Steve. On 20 June 2012 06:20, Howard Lewis Ship hls...@gmail.com wrote: Change your application version number. On Tue, Jun 19, 2012 at 3:00 PM, Dongmei Cao dongmei@icann.org wrote: Hi, After upgrading the Tapestry to 5.3.3 from 5.2.6, we have been getting the following exceptions. I know that it is because the client has the old JavaScript in the browser cache. My question is whether there is an elegant way to force the browsers to reload the JavaScript before the exception happens. Thanks in advance! *org.apache.tapestry5.ioc.internal.OperationException: A JSONArray text must start with '[' at character 1 of goButton [] * * 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:1121) * Dongmei -- 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
AppModule: using injected service in ContributeWebSecurityManager
Hi i have the following problem. I have set the following code. public void contributeWebSecurityManager( final ConfigurationRealm configuration //, @InjectService(myDataSource)final DataSource dataSource ) { final JdbcRealm realm = new JdbcSaltedRealm(); realm.setDataSource(getJndiDataSource()); // realm.setDataSource(dataSource); -- does not work realm.setAuthenticationQuery(AppModule.AUTHENTICATION_QUERY); realm.setUserRolesQuery(AppModule.USER_ROLES_QUERY); realm.setPermissionsQuery(AppModule.PERMISSION_QUERY); realm.setPermissionsLookupEnabled(true); realm.setCredentialsMatcher(this.credentialsMatcher); configuration.add(realm); } In the same AppModule class I have this public static void bind(final ServiceBinder binder) { binder.bind(DataSource.class, AppModule.getJndiDataSource().getClass()) .withId(blog.dataSource); } When i run my app it seems the datasource is not injected. How am I able to inject the datasource binded into ContributeWebSecurityManager. This is error i am getting when using service injection instead of just manually getting the datasource. NFO: Cannot create JDBC driver of class '' for connect URL 'null' java.lang.NullPointerException at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:524) at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:493) at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307) at java.sql.DriverManager.getDriver(DriverManager.java:273) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at $DataSource_210503fddf1.getConnection(Unknown Source) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:729) at org.apache.shiro.realm.JdbcSaltedRealm.getPasswordForUser(JdbcSaltedRealm.java:242) at org.apache.shiro.realm.JdbcSaltedRealm.doGetAuthenticationInfo(JdbcSaltedRealm.java:170) at org.apache.shiro.realm.JdbcSaltedRealm.doGetAuthenticationInfo(JdbcSaltedRealm.java:61) -- View this message in context: http://tapestry.1045711.n5.nabble.com/AppModule-using-injected-service-in-ContributeWebSecurityManager-tp5713989.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: AppModule: using injected service in ContributeWebSecurityManager
Hi! I'm pretty sure your dataSource is being injected, otherwise you'd receive a different error and not an NPE. This looks wrong to me: binder.bind(DataSource.class, AppModule.getJndiDataSource().getClass()).withId(blog.dataSource); Specifically the: AppModule.getJndiDataSource().getClass() Do you not know what the class is at compile time? Rather than binding, you may want a use Builder method. Also, the binding gives an ID of blog.dataSource but you're injecting myDataSource...? As an aside, I usually inject services in my Module with this: public void contributeWebSecurityManager( final ConfigurationRealm configuration @Local DataSource dataSource) { ... } No need for @InjectService. The @Local tells T5-IoC to look for a service defined in *that* module class. Because DataSource is a popular interface, it could be defined in other modules. The annotation helps to dis-ambiguate between them. Steve. On 20 June 2012 20:47, cablepuff cablep...@gmail.com wrote: Hi i have the following problem. I have set the following code. public void contributeWebSecurityManager( final ConfigurationRealm configuration //, @InjectService(myDataSource)final DataSource dataSource ) { final JdbcRealm realm = new JdbcSaltedRealm(); realm.setDataSource(getJndiDataSource()); // realm.setDataSource(dataSource); -- does not work realm.setAuthenticationQuery(AppModule.AUTHENTICATION_QUERY); realm.setUserRolesQuery(AppModule.USER_ROLES_QUERY); realm.setPermissionsQuery(AppModule.PERMISSION_QUERY); realm.setPermissionsLookupEnabled(true); realm.setCredentialsMatcher(this.credentialsMatcher); configuration.add(realm); } In the same AppModule class I have this public static void bind(final ServiceBinder binder) { binder.bind(DataSource.class, AppModule.getJndiDataSource().getClass()) .withId(blog.dataSource); } When i run my app it seems the datasource is not injected. How am I able to inject the datasource binded into ContributeWebSecurityManager. This is error i am getting when using service injection instead of just manually getting the datasource. NFO: Cannot create JDBC driver of class '' for connect URL 'null' java.lang.NullPointerException at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:524) at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:493) at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307) at java.sql.DriverManager.getDriver(DriverManager.java:273) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1437) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at $DataSource_210503fddf1.getConnection(Unknown Source) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:573) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:637) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:666) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:674) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:729) at org.apache.shiro.realm.JdbcSaltedRealm.getPasswordForUser(JdbcSaltedRealm.java:242) at org.apache.shiro.realm.JdbcSaltedRealm.doGetAuthenticationInfo(JdbcSaltedRealm.java:170) at org.apache.shiro.realm.JdbcSaltedRealm.doGetAuthenticationInfo(JdbcSaltedRealm.java:61) -- View this message in context: http://tapestry.1045711.n5.nabble.com/AppModule-using-injected-service-in-ContributeWebSecurityManager-tp5713989.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
T.5.2.6 recordError on FormAjaxLoop
hi, is it possible to record an error to single field of FormAjaxLoop? The requirement is: i want to make a form with several email fields. Field one contains good data Field two contains bad data. So i have to mark field two as wrong. At the moment i validate the data in onAfterSubmit, on error case i call Form.recordError(String). How can i make it on more elegance way? greetings resign -- View this message in context: http://tapestry.1045711.n5.nabble.com/T-5-2-6-recordError-on-FormAjaxLoop-tp5713991.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: T.5.2.6 recordError on FormAjaxLoop
I don't think it is. The default implementation of the ValidationTracker records errors against individual fields, of which in the loop there is only one. (Caveat: I've not looked at the FormAjaxLoop specifically.) In a standard loop, this implementation helps - you may be able to adjust for a FormAjaxLoop http://tapestry.1045711.n5.nabble.com/Validating-forms-inside-a-loop-td2426980.html Steve. On 20 June 2012 21:41, resign sergejb...@yahoo.de wrote: hi, is it possible to record an error to single field of FormAjaxLoop? The requirement is: i want to make a form with several email fields. Field one contains good data Field two contains bad data. So i have to mark field two as wrong. At the moment i validate the data in onAfterSubmit, on error case i call Form.recordError(String). How can i make it on more elegance way? greetings resign -- View this message in context: http://tapestry.1045711.n5.nabble.com/T-5-2-6-recordError-on-FormAjaxLoop-tp5713991.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: QaModule / DevelopmentModule intended usage
http://tapestry.apache.org/configuration.html#Configuration-SettingExecutionModes On Tue, Jun 19, 2012 at 9:12 PM, Alex Kotchnev akoch...@gmail.com wrote: Ah, I forgot to add the more important question - if I wanted to have other custom environments, how would I go about defining one ? I understand that I'd need to add a new module for the given environment, but the more interesting question is how to configure it to become active if a given value is passed in the 'tapestry.execution-mode' is set to a given value . I really like this feature as it looks very much like the environments feature of Grails where one can define any per-environment values of any of the configuration points or services. In grails, adding a new environment is just a matter of adding a new closure in the config files ( http://grails.org/doc/latest/guide/conf.html#environments) . Cheers, Alex K On Tue, Jun 19, 2012 at 11:51 PM, Alex Kotchnev akoch...@gmail.com wrote: Not having used Tapestry for a while, I ran into the addition of the QaModule and Development module. I've been looking at the new Tapestry project setup and I noticed the new (at least 'new for me') QaModule and DevelopmentModule . Is there a special relationship between the regular AppModule and these other modules - e.g. does the QaModule replace the AppModule when the tapestry.execution-mode is set to 'qa', or is the intention that the QaModule will only override any services that should be overriden in QA ? Cheers, Alex K -- 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
Re: QaModule / DevelopmentModule intended usage
Howard, thanks for the reference, I somehow didn't find this page in my search. Very cool feature ! Cheers - Alex K On Wed, Jun 20, 2012 at 1:03 PM, Howard Lewis Ship hls...@gmail.com wrote: http://tapestry.apache.org/configuration.html#Configuration-SettingExecutionModes On Tue, Jun 19, 2012 at 9:12 PM, Alex Kotchnev akoch...@gmail.com wrote: Ah, I forgot to add the more important question - if I wanted to have other custom environments, how would I go about defining one ? I understand that I'd need to add a new module for the given environment, but the more interesting question is how to configure it to become active if a given value is passed in the 'tapestry.execution-mode' is set to a given value . I really like this feature as it looks very much like the environments feature of Grails where one can define any per-environment values of any of the configuration points or services. In grails, adding a new environment is just a matter of adding a new closure in the config files ( http://grails.org/doc/latest/guide/conf.html#environments) . Cheers, Alex K On Tue, Jun 19, 2012 at 11:51 PM, Alex Kotchnev akoch...@gmail.com wrote: Not having used Tapestry for a while, I ran into the addition of the QaModule and Development module. I've been looking at the new Tapestry project setup and I noticed the new (at least 'new for me') QaModule and DevelopmentModule . Is there a special relationship between the regular AppModule and these other modules - e.g. does the QaModule replace the AppModule when the tapestry.execution-mode is set to 'qa', or is the intention that the QaModule will only override any services that should be overriden in QA ? Cheers, Alex K -- 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
Re: Difference between renderSupport.addScript and JSON addInit(function, JSON Object)
It doesn't work for me. In java : @IncludeJavaScriptLibrary({ context:static/javascript/address.js }) @Environmental private RenderSupport renderSupport; @BeginRender void addJsLibs() { log.debug(BEGIN addJsLibs); JSONObject jsonObject = new JSONObject(); jsonObject.put(m1, messages.get(new_delivery_address)); jsonObject.put(m2, messages.get(js.error.address.empty)); jsonObject.put(m3, messages.get(js.error.receiving.person.empty)); jsonObject.put(m4, messages.get(js.error.street.empty)); jsonObject.put(m5, messages.get(js.error.house.empty)); jsonObject.put(m6, messages.get(js.error.postcode.empty)); jsonObject.put(m7, messages.get(js.error.postcode.wrong)); jsonObject.put(m8, messages.get(js.error.city.empty)); jsonObject.put(m9, messages.get(js.error.special.chars.not_accepted)); jsonObject.put(m10, messages.get(js.error.floor.empty)); jsonObject.put(m11, messages.get(js.error.floor.wrong)); jsonObject.put(m12, messages.get(js.error.elevator.empty)); renderSupport.addInit(loadAddresse, jsonObject); log.debug(END addJsLibs); } in address.js: Tapestry.Initializer.loadAddresse = function loadAddresse(jsonObject){ ... } loadAddresse(jsonObject); In browser console: loadAddresse is not defined and method in loadAddresse can never be called -- View this message in context: http://tapestry.1045711.n5.nabble.com/Difference-between-renderSupport-addScript-and-JSON-addInit-function-JSON-Object-tp5105620p5713987.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: Difference between renderSupport.addScript and JSON addInit(function, JSON Object)
in address.js remove the last call to loadAddresse. i.e. just have Tapestry.Initializer.loadAddresse = function loadAddresse(jsonObject){ ... } it is probably that last surplus : loadAddresse(jsonObject); that caused the JS error ('cos there is no global function called loadAddresse) which then disabled JavaScript for the rest of the page load. Steve. On 20 June 2012 15:56, baptiste baptiste.toll...@atos.net wrote: It doesn't work for me. In java : @IncludeJavaScriptLibrary({ context:static/javascript/address.js }) @Environmental private RenderSupport renderSupport; @BeginRender void addJsLibs() { log.debug(BEGIN addJsLibs); JSONObject jsonObject = new JSONObject(); jsonObject.put(m1, messages.get(new_delivery_address)); jsonObject.put(m2, messages.get(js.error.address.empty)); jsonObject.put(m3, messages.get(js.error.receiving.person.empty)); jsonObject.put(m4, messages.get(js.error.street.empty)); jsonObject.put(m5, messages.get(js.error.house.empty)); jsonObject.put(m6, messages.get(js.error.postcode.empty)); jsonObject.put(m7, messages.get(js.error.postcode.wrong)); jsonObject.put(m8, messages.get(js.error.city.empty)); jsonObject.put(m9, messages.get(js.error.special.chars.not_accepted)); jsonObject.put(m10, messages.get(js.error.floor.empty)); jsonObject.put(m11, messages.get(js.error.floor.wrong)); jsonObject.put(m12, messages.get(js.error.elevator.empty)); renderSupport.addInit(loadAddresse, jsonObject); log.debug(END addJsLibs); } in address.js: Tapestry.Initializer.loadAddresse = function loadAddresse(jsonObject){ ... } loadAddresse(jsonObject); In browser console: loadAddresse is not defined and method in loadAddresse can never be called -- View this message in context: http://tapestry.1045711.n5.nabble.com/Difference-between-renderSupport-addScript-and-JSON-addInit-function-JSON-Object-tp5105620p5713987.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: AppModule: using injected service in ContributeWebSecurityManager
Thanks. It works. I created public static DataSource buildMyDataSource() { // ... implemenation. } then inject the code using @Local @Service(myDataSource) DataSource dataSource like you suggested. -- View this message in context: http://tapestry.1045711.n5.nabble.com/AppModule-using-injected-service-in-ContributeWebSecurityManager-tp5713989p5714000.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