Re: T5 - Service injection and ioc
Thanks! I read the doc 2 or 3 times completely, but sometimes my english make the thing difficult to understand well, especially when first example start with MyModule... I focused on this and didn't pay attention enought to the SubModule part. I hope this thread will help other like me ;) 2007/6/1, Howard Lewis Ship [EMAIL PROTECTED]: Actually, Howard doesn't have to confirm this as the code confirms this, and the comments, capturing Howard's thoughts, confirm this. On 6/1/07, Blackwings [EMAIL PROTECTED] wrote: /cry... Does Howard confirm this? 2007/6/1, Joshua Jackson [EMAIL PROTECTED]: I think you can only have one Module loaded by Filter (CMIIW). Last time I tried I only can load AppModule, and the other Module entries are ignored. On 6/1/07, Blackwings [EMAIL PROTECTED] wrote: So, I created my own Module in the same package than AppModule, following the naming convention : public final class UserModule { public UserService buildUserService() { return new UserServiceImpl(); } } And I still have the error, the same others have, No service implements the interface papo.ioc.services.UserService. So, how can I declare the Module? :) 2007/6/1, Joshua Jackson [EMAIL PROTECTED]: Of course you can create your own Module, but AppModule it the ones automatically loaded because it is configured in your web.xml On 6/1/07, Blackwings [EMAIL PROTECTED] wrote: Still the same question... Are we force to use only the AppModule? Can we create our own module? This is the question. I think we know how to implement, inject and create a Service. I achieved to make it works only when finally I declared my service builder in AppModule but we still don't know how to create our own hand made Module. -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com -- Michael Bernagou Java Developper
Re: T5 - Service injection and ioc
Try simply @Inject private UserAuthenticator _authenticator; Also use the bind method instead of the buildUserAuthenticator. I did it and explained it in this thread if you read it completely ;) It's not more documented because it's an alpha project, as explained Howard Lewis Ship in his last message. 2007/6/1, vidrilon [EMAIL PROTECTED]: Joshua Jackson-3 wrote: On 6/1/07, vidrilon [EMAIL PROTECTED] wrote: Did i understood well?? Could you make it work? I'm also having the same problem, i have created another module, UserAuthenticatorModule for validating a login form, but have the same message: No service implements the interface org.clinica.bd.pages.UserAuthenticator Did you bind UserAuthenticator to an implementation in your AppModule? -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yes, i have tried all that has been written here, like this.. public final class UserModule { public static UserAuthenticator buildUserAuthenticator() { return new UserAuthenticatorImpl(); } } @SubModule({UserModule.class}) public class AppModule @Inject @Service(UserAuthenticator) private UserAuthenticator _authenticator; But, it doesnt seems to work, im angry also, why isn't more documentation, with more examples and explanations?. Thanks in advance -- View this message in context: http://www.nabble.com/T5---Service-injection-and-ioc-tf3834669.html#a10920353 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper
Re: T5 - Service injection and ioc
Still the same question... Are we force to use only the AppModule? Can we create our own module? This is the question. I think we know how to implement, inject and create a Service. I achieved to make it works only when finally I declared my service builder in AppModule but we still don't know how to create our own hand made Module. 2007/6/1, Joshua Jackson [EMAIL PROTECTED]: On 6/1/07, vidrilon [EMAIL PROTECTED] wrote: Did i understood well?? Could you make it work? I'm also having the same problem, i have created another module, UserAuthenticatorModule for validating a login form, but have the same message: No service implements the interface org.clinica.bd.pages.UserAuthenticator Did you bind UserAuthenticator to an implementation in your AppModule? -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper
Re: T5 - Service injection and ioc
/cry... Does Howard confirm this? 2007/6/1, Joshua Jackson [EMAIL PROTECTED]: I think you can only have one Module loaded by Filter (CMIIW). Last time I tried I only can load AppModule, and the other Module entries are ignored. On 6/1/07, Blackwings [EMAIL PROTECTED] wrote: So, I created my own Module in the same package than AppModule, following the naming convention : public final class UserModule { public UserService buildUserService() { return new UserServiceImpl(); } } And I still have the error, the same others have, No service implements the interface papo.ioc.services.UserService. So, how can I declare the Module? :) 2007/6/1, Joshua Jackson [EMAIL PROTECTED]: Of course you can create your own Module, but AppModule it the ones automatically loaded because it is configured in your web.xml On 6/1/07, Blackwings [EMAIL PROTECTED] wrote: Still the same question... Are we force to use only the AppModule? Can we create our own module? This is the question. I think we know how to implement, inject and create a Service. I achieved to make it works only when finally I declared my service builder in AppModule but we still don't know how to create our own hand made Module. -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper
Re: T5 - Service injection and ioc
So, I created my own Module in the same package than AppModule, following the naming convention : public final class UserModule { public UserService buildUserService() { return new UserServiceImpl(); } } And I still have the error, the same others have, No service implements the interface papo.ioc.services.UserService. So, how can I declare the Module? :) 2007/6/1, Joshua Jackson [EMAIL PROTECTED]: Of course you can create your own Module, but AppModule it the ones automatically loaded because it is configured in your web.xml On 6/1/07, Blackwings [EMAIL PROTECTED] wrote: Still the same question... Are we force to use only the AppModule? Can we create our own module? This is the question. I think we know how to implement, inject and create a Service. I achieved to make it works only when finally I declared my service builder in AppModule but we still don't know how to create our own hand made Module. -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper
Re: T5 - Service injection and ioc
I didn't think about SubModule... so I just added the line before AppModule class declaration this : @SubModule({UserModule.*class*}) *public* *class* *AppModule* { And that's it, my UserModule is loaded and the build is normally called. Thanks a lot! 2007/6/1, Kristian Marinkovic [EMAIL PROTECTED]: if you look at the code in TapestryAppInitializer you'll see that only ONE module is loaded automatically. Tapestry guesses the module class by using the filter name as a prefix and Module as a postfix public TapestryAppInitializer(SymbolProvider appProvider, String appName, String aliasMode) ... String className = _appPackage + .services. + InternalUtils.capitalize(_appName) + Module; ... Class moduleClass = Thread.currentThread().getContextClassLoader().loadClass(className); _builder.add(moduleClass); Kristian Marinkovic [EMAIL PROTECTED] 01.06.2007 11:26 Bitte antworten an Tapestry users users@tapestry.apache.org An Tapestry users users@tapestry.apache.org Kopie Thema Re: T5 - Service injection and ioc i assume you have used the tapestry archetype :) with the SubModule annotation you can have other module classes loaded with the AppModule without putting them into the manifest. as an alternative you can put your module into your manifest as well (comma separated) plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-jar-plugin/artifactId configuration archive manifestEntries Tapestry-Module-Classes com.poi.tapestry5.ioc.test.module.AppModule, com.poi.tapestry5.ioc.test.module.MyModule /Tapestry-Module-Classes /manifestEntries /archive /configuration /plugin Tapestry-Module-Classes: com.poi.tapestry5.ioc.test.module.AppModule, com.poi.tapestry5.ioc.test.module.MyModule Blackwings [EMAIL PROTECTED] 01.06.2007 11:14 Bitte antworten an Tapestry users users@tapestry.apache.org An Tapestry users users@tapestry.apache.org Kopie Thema Re: T5 - Service injection and ioc /cry... Does Howard confirm this? 2007/6/1, Joshua Jackson [EMAIL PROTECTED]: I think you can only have one Module loaded by Filter (CMIIW). Last time I tried I only can load AppModule, and the other Module entries are ignored. On 6/1/07, Blackwings [EMAIL PROTECTED] wrote: So, I created my own Module in the same package than AppModule, following the naming convention : public final class UserModule { public UserService buildUserService() { return new UserServiceImpl(); } } And I still have the error, the same others have, No service implements the interface papo.ioc.services.UserService . So, how can I declare the Module? :) 2007/6/1, Joshua Jackson [EMAIL PROTECTED]: Of course you can create your own Module, but AppModule it the ones automatically loaded because it is configured in your web.xml On 6/1/07, Blackwings [EMAIL PROTECTED] wrote: Still the same question... Are we force to use only the AppModule? Can we create our own module? This is the question. I think we know how to implement, inject and create a Service. I achieved to make it works only when finally I declared my service builder in AppModule but we still don't know how to create our own hand made Module. -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper -- Michael Bernagou Java Developper
Re: T5 - Service injection and ioc
The only error I have is : # java.lang.ClassNotFoundException caught an exception while obtaining a class file for papo.pages.Start exception java.lang.RuntimeException: Error obtaining injected value for field papo.pages.Start._userService: No service implements the interface papo.ioc.services.UserService. I tried to happen in AppModule the following lines and discard the UserModule class : public static void bind(ServiceBinder binder) { binder.bind(UserService.class, UserServiceImpl.class); } to use the autobuilding services, but I still have the same error. What about package names? In my web.xml I declared : context-param !-- The only significant configuration for Tapestry 5, this informs Tapestry of where to look for pages, components and mixins. -- param-nametapestry.app-package/param-name param-valuepapo/param-value /context-param but maybe I have to put my services/modules classes in a specific package rather than my papo.ioc.services ? 2007/5/30, Davor Hrg [EMAIL PROTECTED]: I tried @Inject Session session; but it didn't work. you probably have an error in log from tapestry demanding for the field to be private... try: @Inject private Session session; Davor Hrg On 5/30/07, Joshua Jackson [EMAIL PROTECTED] wrote: I found that the @Service annotation is not available anymore in tapestry-core-5.0.4 So how do I inject a service that was created by the AppModule into my web Page/Component ? Let's say the Session service created by the tapestry-hibernate module. I tried @Inject Session session; but it didn't work. Have I missed on something? Thanks in advance. On 5/30/07, Howard Lewis Ship [EMAIL PROTECTED] wrote: You don't need the MANIFEST.MF. You do need to name your module correctly, it should be AppModule. The documention is *very clear* on the naming for that. Also, you should consider letting Tapestry IoC inject the Log ( org.apache.commons.logging.Log) for your service; cleans up a lot of code that way. This will be -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 - Service injection and ioc
Ok I found the problem and it was not my code but the packages!! Services and modules have to be in papo.services, if I declared in web.xml tapestry.app-package with papo. But I was able to declare my builder in AppModule but I still doesn't achieve to create my own module, in the same package, whatever I create a builder or use the binder or declare the module in the manifest... When I copied the builder or binder from my module to AppModule, it works. package papo.services; public final class UserModule { public UserService buildUserService() { return new UserServiceImpl(); } } 2007/5/30, Blackwings [EMAIL PROTECTED]: The only error I have is : # java.lang.ClassNotFoundException caught an exception while obtaining a class file for papo.pages.Start exception java.lang.RuntimeException: Error obtaining injected value for field papo.pages.Start._userService: No service implements the interface papo.ioc.services.UserService. I tried to happen in AppModule the following lines and discard the UserModule class : public static void bind(ServiceBinder binder) { binder.bind(UserService.class, UserServiceImpl.class); } to use the autobuilding services, but I still have the same error. What about package names? In my web.xml I declared : context-param !-- The only significant configuration for Tapestry 5, this informs Tapestry of where to look for pages, components and mixins. -- param-nametapestry.app-package/param-name param-valuepapo/param-value /context-param but maybe I have to put my services/modules classes in a specific package rather than my papo.ioc.services ? 2007/5/30, Davor Hrg [EMAIL PROTECTED]: I tried @Inject Session session; but it didn't work. you probably have an error in log from tapestry demanding for the field to be private... try: @Inject private Session session; Davor Hrg On 5/30/07, Joshua Jackson [EMAIL PROTECTED] wrote: I found that the @Service annotation is not available anymore in tapestry-core-5.0.4 So how do I inject a service that was created by the AppModule into my web Page/Component ? Let's say the Session service created by the tapestry-hibernate module. I tried @Inject Session session; but it didn't work. Have I missed on something? Thanks in advance. On 5/30/07, Howard Lewis Ship [EMAIL PROTECTED] wrote: You don't need the MANIFEST.MF. You do need to name your module correctly, it should be AppModule. The documention is *very clear* on the naming for that. Also, you should consider letting Tapestry IoC inject the Log ( org.apache.commons.logging.Log) for your service; cleans up a lot of code that way. This will be -- YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael Bernagou Java Developper -- Michael Bernagou Java Developper
T5 - Service injection and ioc
Hi, I think I'm not using correctly the tapestry-ioc since my page call itself my module to get the service implementation instance (as service): UserModule public class UserModule { public static UserService buildUserService() { return new UserServiceImpl(); } } UserService public interface UserService { public User getAuthenticatedUser(String login, String password) throws PapoException; } UserServiceImpl public class UserServiceImpl implements UserService { public User getAuthenticatedUser(String login, String password) throws PapoException { [code] return user; } } Start [code] private UserService _userService; String onSuccess() { [code here] _userService = UserModule.buildUserService(); _user = _userService.getAuthenticatedUser(_login.getLogin(), _login.getPassword()); ** My page call itself the build method... so my page is hardly linked to the ioc but this is wrong. I thought about something like : [code] @InjectService(UserService) private UserService _userService; String onSuccess() { [code here] _user = _userService.getAuthenticatedUser(_login.getLogin(), _login.getPassword()); But it doesn't compile and the notation found in the documentaiton : @Inject @Service(UserService) doesn't exist anymore in the tapestry-core... Any idea?
Re: T5 - Service injection and ioc
I was using the 5.03. I just changed for the 5.04 then I tried your proposition : No service implements the interface papo.ioc.services.UserService. But my implementation, UserServiceImpl is in the same package than its interface UserService and implements it. The module UserModule that contains the buildUserService method and return the UserService is also in this package... What did I miss?? 2007/5/29, Davor Hrg [EMAIL PROTECTED]: try: @Inject private UserService _userService; you haven't mentioned the version code above is for 5.0.4, I'm not sure for older versions Davor Hrg On 5/29/07, Blackwings [EMAIL PROTECTED] wrote: Hi, I think I'm not using correctly the tapestry-ioc since my page call itself my module to get the service implementation instance (as service): UserModule public class UserModule { public static UserService buildUserService() { return new UserServiceImpl(); } } UserService public interface UserService { public User getAuthenticatedUser(String login, String password) throws PapoException; } UserServiceImpl public class UserServiceImpl implements UserService { public User getAuthenticatedUser(String login, String password) throws PapoException { [code] return user; } } Start [code] private UserService _userService; String onSuccess() { [code here] _userService = UserModule.buildUserService(); _user = _userService.getAuthenticatedUser(_login.getLogin(), _login.getPassword()); ** My page call itself the build method... so my page is hardly linked to the ioc but this is wrong. I thought about something like : [code] @InjectService(UserService) private UserService _userService; String onSuccess() { [code here] _user = _userService.getAuthenticatedUser(_login.getLogin(), _login.getPassword()); But it doesn't compile and the notation found in the documentaiton : @Inject @Service(UserService) doesn't exist anymore in the tapestry-core... Any idea?
Re: T5 IoC for WebServices (jax-ws)
Does it means that today, the best should be to learn Axis if we need WebServices? 2007/5/29, Howard Lewis Ship [EMAIL PROTECTED]: Further, the magic injection right into private variables is a function of Tapestry's class transformation system; it's limited to Tapestry pages and components, which exist within specific packages. A more seamless solution for exposing Tapestry IoC services as web services is possible, but not in scope. I'm so busy now that breathing is barely in scope. On 5/29/07, Howard Lewis Ship [EMAIL PROTECTED] wrote: The Tapestry filter puts the Registry into the ServletContext. You should be able to write a small wrapper implementation of your web service that obtains the real implementation from the Registry and delegates all methods to it. Your Tapestry IoC implementation can use all the standard means of injection. On 5/29/07, David Avenante [EMAIL PROTECTED] wrote: Hi ;) I need to expose some services with webservices (beurkkk). The probleme is the that the servlet for the web services is not processed by my tapestry filter. context-param param-name tapestry.app-package/param-name param-valuecom.me.indexer/param-value /context-param filter filter-nameapp/filter-name filter-class org.apache.tapestry.TapestryFilter/filter-class /filter filter-mapping filter-nameapp/filter-name url-pattern/*/url-pattern /filter-mapping listener listener-class com.sun.xml.ws.transport.http.servlet.WSServletContextListener /listener-class /listener servlet servlet-nameSearchWS/servlet-name servlet-classcom.sun.xml.ws.transport.http.servlet.WSServlet /servlet-class load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameSearchWS/servlet-name url-pattern/SearchWS/url-pattern /servlet-mapping So i can't write something like this : @WebService public class Searcher { private static final String START_DOC = result\n; private static final String END_DOC = \nresult; @Inject @Service(Indexer) private Indexer indexer; } How can I do to use tapestry 5 IoC in this contexte ? Thank's -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 - Service injection and ioc
So, I'm now on 5.04 and I re-read the documentation about ioc to be sure I didn't do a mistake when I declared my service. The module is final and follow the naming convention: package papo.ioc.services; public final class UserModule { public UserService build() { return new UserServiceImpl(); } } And I declared it in the MANIFEST.MF under webroot/META-INF : Manifest-Version: 1.0 Tapestry-Module-Classes: papo.ioc.services.UserModule The service interface seems ok: package papo.ioc.services; import papo.exception.PapoException; import papo.model.User; public interface UserService { public User getAuthenticatedUser(String login, String password) throws PapoException; } The implementation looks normal: package papo.ioc.services; import org.apache.log4j.Logger; import papo.dao.UserDao; import papo.exception.PapoException; import papo.model.User; public class UserServiceImpl implements UserService { /** Obtain a suitable logger */ private static Logger logger = Logger.getLogger(UserServiceImpl.class.getName()); public User getAuthenticatedUser(String login, String password) throws PapoException { UserDao dao = new UserDao(); User user = null; try { user = dao.searchUser(login, password); } catch (PapoException pe) { logger.error(The authentication has failed !!, pe); throw new PapoException(The authentication has failed !!); } return user; } } and the I use it in my Start page: @Inject @Service(UserService) private UserService _userService; String onSuccess() { String success = Home; String failure = Start; try { _user = _userService.getAuthenticatedUser(_login.getLogin(), _login.getPassword()); } catch (PapoException pe) { _message = La procedure d'identification a rencontré un probleme !!; return failure; } return success; } But I still have the error : java.lang.ClassNotFoundException caught an exception while obtaining a class file for papo.pages.Start exception java.lang.RuntimeException: Error obtaining injected value for field papo.pages.Start._userService: No service implements the interface papo.ioc.services.UserService. What can I try now? 2007/5/29, Blackwings [EMAIL PROTECTED]: I was using the 5.03. I just changed for the 5.04 then I tried your proposition : No service implements the interface papo.ioc.services.UserService. But my implementation, UserServiceImpl is in the same package than its interface UserService and implements it. The module UserModule that contains the buildUserService method and return the UserService is also in this package... What did I miss?? 2007/5/29, Davor Hrg [EMAIL PROTECTED]: try: @Inject private UserService _userService; you haven't mentioned the version code above is for 5.0.4, I'm not sure for older versions Davor Hrg On 5/29/07, Blackwings [EMAIL PROTECTED] wrote: Hi, I think I'm not using correctly the tapestry-ioc since my page call itself my module to get the service implementation instance (as service): UserModule public class UserModule { public static UserService buildUserService() { return new UserServiceImpl(); } } UserService public interface UserService { public User getAuthenticatedUser(String login, String password) throws PapoException; } UserServiceImpl public class UserServiceImpl implements UserService { public User getAuthenticatedUser(String login, String password) throws PapoException { [code] return user; } } Start [code] private UserService _userService; String onSuccess() { [code here] _userService = UserModule.buildUserService (); _user = _userService.getAuthenticatedUser(_login.getLogin(), _login.getPassword()); ** My page call itself the build method... so my page is hardly linked to the ioc but this is wrong. I thought about something like : [code] @InjectService(UserService) private UserService _userService; String onSuccess() { [code here] _user = _userService.getAuthenticatedUser(_login.getLogin(), _login.getPassword()); But it doesn't compile and the notation found in the documentaiton : @Inject @Service(UserService) doesn't exist anymore in the tapestry-core... Any idea? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: How to modify page without having to restart tomcat
I noticed with jetty it doesn't reload the context when, for example, you modify a template. But it's needed with Tomcat even if I configured Tomcat to not redeploy the context at each modification. How can I do the same with Tomcat than Jetty? Thanks, Michael
Re: Tapestry 5: Default Locale
I tried the same (with fr) at the same place, and I was able to get the 'fr' labels as default translation, but I was not able to write such of code in html template : a title=Créer un compte t:type=PageLink page=Register because 'é' is a 'fr' char and Tapestry return an exception, whatever I put as encoding in the HTML description itself : org.apache.tapestry.ioc.internal.util.TapestryException Failure parsing template context:WEB-INF/Start.html: Invalid byte 2 of 3-byte UTF-8 sequence. 2007/5/14, Juan Maya [EMAIL PROTECTED]: Hi all, Do u know how could i change the default locale for a tapestry 5 app. I already tried: configuration.add(tapestry.supported-locales, es) in my AppModule but it doesn't seem to help. Thanks for u help
Re: Tapestry 5: Default Locale
Hum, are we forced to encode in UTF-8?? How can we, also, change the default locale? 2007/5/14, Nick Westgate [EMAIL PROTECTED]: org.apache.tapestry.ioc.internal.util.TapestryException Failure parsing template context:WEB-INF/Start.html: Invalid byte 2 of 3-byte UTF-8 sequence. This probably means your template is not UTF-8 encoded. Cheers, Nick. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Calling URL without pages
I can't use filter. In fact, I have a swing application implemented with HttpClient that try to authenticate a user by calling my Tapestry5 web application. The server will receive my request and should return an xml response with the user information or any other response. Filter are used to change/adapt/... the request/response content before the treatment, but I don't need that. I need a treatment and a direct answer. I developped the authentication mecanism using the tapestry-ioc via a module with a buildUserHandler method creates an instance of UserHandlerImpl which implements UserHandler interface and return it to the caller. I want to reuse that mecanism. I think I need to implement a web service mecanism (Axis?) unless there is another solution using T5. Thanks Michael 2007/5/8, Robert Zeigler [EMAIL PROTECTED]: How about doing this with a request filter? Robert On May 8, 2007, at 5/89:47 AM , Blackwings wrote: Hi everybody! I'm developping a simple login/registration web site with T5. It works normally, no problems... but what I want to do is to bypass the use of the formular using a url like http://www.myloginsite.com/start? login=myloginpassword=mypasswordfromoutside=yes. I'd like to call directly the onSuccess method after having automatically fill the fromOutside field. In the onSuccess, it reacts differently regarding the existence of fromOutside (return an xml instead of a page). Anyway, I didn't manage to call the onSuccess method in the page. I understand that such URL call a page and not a servlet, so I was almost sure it wouldn't work... Any idea how I could manage that? Thanks, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Form and Select
Hi, It should be a simple problem but I tried to solve it without success. So, mainly, I have javabean used to fill and store a form. The form consist on 2 Select box and 3 String fields. Home.html td select jwcid=[EMAIL PROTECTED] name=searchCriteria.requester size=1 tabindex=1 class=comboBox9pt span jwcid=@Foreach source=ognl:requesters value=ognl:requester option jwcid=@Option label=ognl:requester.display selected=ognl: searchCriteria.requester / /span /select /td tdinput jwcid=[EMAIL PROTECTED] value=ognl:searchCriteria.year name= searchCriteria.year maxlength=4 tstyle=width:40px; //td tdinput jwcid=[EMAIL PROTECTED] value=ognl:searchCriteria.number name=searchCriteria.number maxlength=5 style=width:50px; //td tdinput jwcid=[EMAIL PROTECTED] value=ognl:searchCriteria.version name=searchCriteria.version maxlength=2style=width:35px; //td tdinput jwcid=[EMAIL PROTECTED] value=ognl:searchCriteria.part name= searchCriteria.part maxlength=2style=width:35px; //td td select jwcid=[EMAIL PROTECTED] name=searchCriteria.language size=1 tabindex=6 class=comboBox9pt span jwcid=@Foreach source=ognl:languages value=ognl:language option jwcid=@Option label=ognl:searchCriteria.language.label selected=ognl:searchCriteria.language / /span /select /td Why do I need to create an object to store the current value? I want to store the current value in searchCriteria.requester/searchCriteria.language. If I replace span jwcid=@Foreach source=ognl:requesters value=ognl:requester option jwcid=@Option label=ognl:requester.display selected=ognl: searchCriteria.requester / /span by span jwcid=@Foreach source=ognl:requesters value=ognl:searchCriteriaRequester option jwcid=@Option label=ognl:searchCriteria.requester.display selected=ognl:searchCriteria.requester / /span I don't have the error but the searchCriteria.requester is null when I submit!! What is the best way to use this @Select @Option component? Home.java /** The AppSettings */ public abstract ApplicationSettings getAppSettings(); public abstract void setAppSettings(ApplicationSettings appSettings); /** The search criterias */ public abstract SearchCriteria getSearchCriteria(); public abstract void setSearchCriteria(SearchCriteria searchCriteria); /** List of the requesters */ public abstract List getRequesters(); public abstract void setRequesters(List requesters); /** List of the languages */ public abstract List getLanguages(); public abstract void setLanguages(List languages); /** * Initialized appSettings at the loading process, beginning of the render [EMAIL PROTECTED] event The Tapestry loading page event */ public void pageBeginRender(PageEvent event) { ApplicationSettings appSettings = getAppSettings(); setRequesters(appSettings.getRequesters()); setLanguages(appSettings.getLanguages()); SearchCriteria searchCriteria = getSearchCriteria(); if (searchCriteria == null) { searchCriteria = new SearchCriteria(); searchCriteria.setRequester((Requester)getRequesters().get(0)); searchCriteria.setYear(2006); searchCriteria.setNumber(1); searchCriteria.setVersion(**); searchCriteria.setPart(**); searchCriteria.setLanguage((Language)getLanguages().get(0)); } setSearchCriteria(searchCriteria); } SearchCriteria.java private Requester requester = null; public Requester getRequester() { return requester; } public void setRequester(Requester requester) { this.requester = requester; } private String year = null; public String getYear() { return year; } public void setYear(String year) { this.year = year; } private String number = null; public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } private String version = null; public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } private String part = null; public String getPart() { return part; } public void setPart(String part) { this.part = part; } private Language language = null; public Language getLanguage() { return language; } public void setLanguage(Language language) { this.language = language; }
Re: Context path
From the Tapestry main Servlet (ApplicationServlet or directly from GenricServlet) you can call getServletContext().getRealPath(/); 2006/7/25, Rodnei Couto [EMAIL PROTECTED]: Hi list, I'm creating a service. I need to know the context path to get an image used in my service. How can I discover this? Thanks, Rodnei Couto - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ASO and hivemind.xml
Hi, I found in the document what is the line to add into hivemind.xml file to create an ASO since getGlobal is deprecated. But I didn't find a standard hivemind.xml file and I have no idea what is mandatory to put in. I just want to declare my ASO object to be able to inject it in my page. So, where can I find a standard hivemind.xml or what do I have to put in to still have my application working normally? Thanks BW
Re: ASO and hivemind.xml
Thanks a lot, but I have a question again: To what, the id in the module tag, refer? Is it the name of my context? is it app? is it the package where something (what?) is store? Same question for the version. Thanks anyway BW 2006/7/20, Geoff Callender [EMAIL PROTECTED]: BW, No need to touch hivemind.xml. Add a file called hivemodule.xml to WEB-INF, with content similar to this: ?xml version=1.0? module id=jumpstart version=1.0.0 package=jumpstart.web !-- ServiceLocator and Visit -- contribution configuration-id=tapestry.state.ApplicationObjects state-object name=serviceLocator scope=application create-instance class= jumpstart.web.base.ServiceLocator/ /state-object /contribution contribution configuration-id=tapestry.state.ApplicationObjects state-object name=visit scope=session create-instance class=jumpstart.web.base.Visit / /state-object /contribution /module In that example, ServiceLocator performs a similar function to the typical Global. Visit is just like the old Visit. Note that the scope of ServiceLocator is application and the scope of Visit is session. Here's an example of them being referenced in a page: @InjectState(serviceLocator) public abstract ServiceLocator getServiceLocator(); @InjectState(visit) // Can't call it getVisit() because it conflicts with a deprecated IPage method public abstract Visit getMyVisit(); Hope this helps. Geoff http://tapestry.apache.org/tapestry4.1/QuickStart/contributed.html On 20/07/2006, at 7:58 PM, Blackwings wrote: Hi, I found in the document what is the line to add into hivemind.xml file to create an ASO since getGlobal is deprecated. But I didn't find a standard hivemind.xml file and I have no idea what is mandatory to put in. I just want to declare my ASO object to be able to inject it in my page. So, where can I find a standard hivemind.xml or what do I have to put in to still have my application working normally? Thanks BW - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ASO and hivemind.xml
The situation is : I create class that extends ApplicationServlet and I specify it as the tapestry main servlet in web.xml. In this class I call a class that initialise some application objects such as list of element common to everybody from the database. My class also set a bean member and implement the get/set method. I also specified this class as an ASO as you told me to do Geoff and I put the inject tag in my Home.page. At the loading of the application, my application object is loaded normally and contains all the list. When I call the Home.page, the inject seems to work and the pageBeginRender is called normally. I call getMyASO() I declared abstract, but when I try to get the application object it is null!! I think Tapestry recreate an instance of MyASO instead of directly get the first loaded : web.xml ... servlet servlet-namedm/servlet-name display-nameDM Initialization servlet/display-name servlet-classdgt.dm.controller.DossierManagerApplication /servlet-class load-on-startup0/load-on-startup /servlet ... hivemodule.xml ?xml version=1.0 encoding=UTF-8? module id=dgt.dm.controller version=06.02.01 package=dgt.dm.controller contribution configuration-id=tapestry.state.ApplicationObjects state-object name=dossierManagerApplication scope=application create-instance class=dgt.dm.controller.DossierManagerApplication/ /state-object /contribution /module DossierManagerApplication.java public class DossierManagerApplication extends ApplicationServlet { private ApplicationSettings appSettings = null; public ApplicationSettings getAppSettings() { return appSettings; } public void setAppSettings(ApplicationSettings appSettings) { this.appSettings = appSettings; } private InitServlet is = null; public void init(ServletConfig arg0) throws ServletException { super.init(arg0); String webRootPath = getServletContext().getRealPath(/); is = new InitServlet(); is.init(webRootPath); appSettings = is.getAppSettings(); // NOT NULL WHEN I DEBUG } ... HomePage.page ... page-specification class=dgt.dm.pages.HomePage inject property=dossierManagerApplication type=state object=dossierManagerApplication/ /page-specification HomePage.java public abstract DossierManagerApplication getDossierManagerApplication(); public abstract void setDossierManagerApplication(DossierManagerApplication dossierManagerApplication); public void pageBeginRender(PageEvent event) { DossierManagerApplication dossierManagerApplication = getDossierManagerApplication(); ApplicationSettings appSettings = dossierManagerApplication.getAppSettings(); // IS NULL setRequesters(appSettings.getRequesters()); setLanguages(appSettings.getLanguages()); } Thanks for help... BW 2006/7/20, Blackwings [EMAIL PROTECTED]: Thanks a lot, but I have a question again: To what, the id in the module tag, refer? Is it the name of my context? is it app? is it the package where something (what?) is store? Same question for the version. Thanks anyway BW 2006/7/20, Geoff Callender [EMAIL PROTECTED]: BW, No need to touch hivemind.xml. Add a file called hivemodule.xml to WEB-INF, with content similar to this: ?xml version=1.0? module id=jumpstart version= 1.0.0 package=jumpstart.web !-- ServiceLocator and Visit -- contribution configuration-id= tapestry.state.ApplicationObjects state-object name=serviceLocator scope=application create-instance class= jumpstart.web.base.ServiceLocator/ /state-object /contribution contribution configuration-id= tapestry.state.ApplicationObjects state-object name=visit scope=session create-instance class=jumpstart.web.base.Visit/ /state-object /contribution /module In that example, ServiceLocator performs a similar function to the typical Global. Visit is just like the old Visit. Note that the scope of ServiceLocator is application and the scope of Visit is session. Here's an example of them being referenced in a page: @InjectState(serviceLocator) public abstract ServiceLocator getServiceLocator(); @InjectState(visit) // Can't call it getVisit() because it conflicts with a deprecated IPage method public abstract Visit getMyVisit(); Hope this helps. Geoff http://tapestry.apache.org/tapestry4.1/QuickStart/contributed.html On 20/07/2006, at 7:58 PM, Blackwings wrote: Hi, I found in the document what is the line to add into hivemind.xml file to create an ASO since getGlobal is deprecated. But I didn't find a standard hivemind.xml file and I have no idea what is mandatory to put in. I just want to declare my ASO object to be able to inject it in my page. So, where can I find a standard hivemind.xml or what do I have to put in to still have my application working normally
Re: ASO and hivemind.xml
Howard, thanks for the advice. I have to use JDK1.4 so I cannot use annotations. My real problem is to understand how I can instanciate an object at the context load, in the ApplicationServlet via inheritance and to make this object available to my pages. As I already explained, getGlobal is Deprecated so I have to use the ASO and the inject tag. My question is to understand how ;o) I was able to instanciate my object (appSettings in the code I wrote in my previous post), I was able to setup hivemodule.xml to create an instance of an object but i was not able to inject the right instance of the object. Can you help me on this part please? Thanks anyway BW 2006/7/20, Howard Lewis Ship [EMAIL PROTECTED]: On 7/20/06, Geoff Callender [EMAIL PROTECTED] wrote: Others might chime in because I'm no expert on this, but this what I believe to be true... - The module id and version can be arbitrary. However, to avoid name clashes you can use the id as a qualifier, eg. @InjectState(jumpstart: serviceLocator) Sorry, this isn't true. As ASOs are typically defined by the application and rarely if every defined by a library, the extra effort for segmenting the ASO namespace did not appear to be worthwhile (in fact, would be a negative, since it would subject users to pain without reward). Thus the ASO namespace is flat, and you'll see errors if you configure more than one ASO with the same name, regardless of module. By contract, the namespace for libraries is rich and nested ... and confusing, and ambiguous, and overkill (just as The Other Geoff). Blackwings would always inject @InjectState(serviceLocator), regardless of what id he gives his module. -- Howard M. Lewis Ship Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Jakarta HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unsubscribing
Hello, Look at the end of this email ;o) [quote] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] [/quote] Just send a n empty email at [EMAIL PROTECTED] .apache.org 2006/7/17, Nima B [EMAIL PROTECTED]: How do I unsubscribe from this mailing list? I've tried all of these addresses but the mails keep bouncing back. [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Keeping the original url after submit
I think there is another solution more simple and handle by Tapestry. I think you can declare a page version as accessible directly from outside using a static URL and Tapestry serialize the page as a static page. Check this page : http://tapestry.apache.org/tapestry4/tapestry/ComponentReference/ExternalLink.html 2006/7/17, Firas A. [EMAIL PROTECTED]: I got it! But the solution is rather low-level. First, I had to modify my form listener to return an ILink: public ILink onSubmit() Then, I had to create the ILink using LinkFactoryImpl: @InjectObject(service:tapestry.globals.WebRequest) public abstract WebRequest getWebRequest(); @InjectObject(engine-service:direct) public abstract IEngineService getService(); // Somewhere in the page class: MapString, Object params = new HashMapString, Object(1); params.put(ServiceConstants.PARAMETER, getRequestCycle().getListenerParameters()); LinkFactoryImpl linkFactory = new LinkFactoryImpl(); DataSqueezerImpl dataSqueezer = new DataSqueezerImpl(); dataSqueezer.register(new StringAdaptor()); linkFactory.setDataSqueezer(dataSqueezer); linkFactory.setContributions(Collections.EMPTY_LIST); linkFactory.setContextPath(getWebRequest().getContextPath()); ErrorLog errorLog = new ErrorLogImpl(new DefaultErrorHandler(), LogFactory .getLog(MyPageClass.class)); linkFactory.setErrorLog(errorLog); linkFactory.setRequest(getWebRequest()); linkFactory.setRequestCycle(getRequestCycle()); linkFactory.setServletPath(getWebRequest().getActivationPath()); linkFactory.initializeService(); ILink iLink = linkFactory.constructLink(getService(), false, params, false); That was a lot of code don't you think? But here's a question: how do you make sure this 'original' ILink is not lost/overridden betwing requests, especially if your page uses validators? I found a solution for that too. If you need help with this, drop me a line and I'll gladly help. Regards!
Re: Template header DOCTYPE
Ok for the select ;-) But what about the tr in a table? table tr tdHeader 1/td tdHeader 2/td tdHeader 3/td /tr span jwcid=@My2TrJwc tr tdsomething/td tdto put/td tdsomewhere here/td /tr tr tdData info 1/td tdData info M/td tdData info 3X/td /tr /span tr td colspan=3Footer/td /tr /table 2006/7/17, Murray Collingwood [EMAIL PROTECTED]: For a select control use SelectionModel to pass the options to your component. Then you don't need any @For loop in your html. In your table component you could code your Tapestry on the tr statement. eg table... tr jwcid=xx Cheers mc On 17 Jul 2006 at 11:13, Blackwings wrote: Hi, I noticed something interresting about DOCTYPE. In fact, if a designer give me a XHTML1.0 transitional compliant html template, when I mark the tag and add some tags span the html is not anymore compliant : select jwcid=[EMAIL PROTECTED] id=searchCriteria.requester name= searchCriteria.requester size=1 tabindex=6 class=comboBox9pt span jwcid=@Foreach source=ognl:requesters value=ognl: searchCriteria.requester option value=1 jwcid=@Option label=ognl: requesters.requesterCode elem1/option option value=2 jwcid=$remove$elem2/option option value=3 jwcid=$remove$elem3/option option value=4 jwcid=$remove$elem4/option /span /select The span cannot be place after a select and this is warned. I have the same problem when I want to mark a bloc of tr, not all, in a table. I have to put a span tag between to a /tr and a tr that is not permit by the DOCTYPE definition, normally. Is there another DOCTYPE that manage Tapestry template or do we have to let the warn like that? FOCUS Computing - web design Mob: 0415 24 26 24 [EMAIL PROTECTED] http://www.focus-computing.com.au -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.1/389 - Release Date: 14/07/2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Components inside component
Thanks, but do I have to create a HTML template for both CustomTr and CustomTd separetely? In fact, the web designer, who is not a java developper, should have to create herself the templates, shouldn't she? If yes, each time she will want to change a page, she will have to modify also the component template, won't she? What is the normal procedure between the web-designer and the java developper regarding component? BW 2006/7/16, Christian Mittendorf [EMAIL PROTECTED]: Hello! Go and check out the paramter element: http://tapestry.apache.org/tapestry4/UsersGuide/spec.html#spec.parameter You create your components by creating jwc and html files. And you add a parameter information to your CustomTd.jwc file: parameter name=value required=yes / Now you can access this parameter as a property using the same name in your CustomTd component: tdspan jwcid=@Insert value=ognl:value.foofoo/span/td And in your CustomTr you add your td like this: tr jwcid=[EMAIL PROTECTED] td jwcid=[EMAIL PROTECTED] value=ognl:foo.bar.../td /tr Christian Am 15.07.2006 um 20:55 schrieb Blackwings: Hello everybody, I'm new in Tapestry and, in fact, my boss asked me to try Tapestry to be able to compare with Struts in term of development time, efficiency, etc etc... yes, we are going to replace our old GUI web layer ;-) Anyway, I have a question maybe you will be able to answer : I would like to know how I could render a component, for example a list of custom td .../td inside a custom tr.../tr component. table tr jwcid=[EMAIL PROTECTED] ... td class=myTdClassSomething here/td td class=mySecondTdClass Something else here/td td jwcid=[EMAIL PROTECTED] ...Placeholder #1/td td jwcid=%remove% ...Placeholder #2/td td jwcid=%remove% ...Placeholder #3/td /tr /table So I want to be able to render something like that. CustomTr is aware it needs CustomTd and should pass some parameters to CustomTd. CustomTd is a component which need some parameters to be render. And I can imagine I could have another component CustomTr2 capable to nest the same CustomTd. My problem is the way to defined and declare them. Is it possible to create only one template, a page template to define this sort of nested component or do I have to ask the web-designer to create another template for the CustomTd component as well? I found how to create one component but not how to create a nested component and to pass parameters from the parent to the child. The main question is in fact, how to create nested component that need parameter from the parent? Thanks a lot BW - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Components inside component
Hello everybody, I'm new in Tapestry and, in fact, my boss asked me to try Tapestry to be able to compare with Struts in term of development time, efficiency, etc etc... yes, we are going to replace our old GUI web layer ;-) Anyway, I have a question maybe you will be able to answer : I would like to know how I could render a component, for example a list of custom td .../td inside a custom tr.../tr component. table tr jwcid=[EMAIL PROTECTED] ... td class=myTdClassSomething here/td td class=mySecondTdClass Something else here/td td jwcid=[EMAIL PROTECTED] ...Placeholder #1/td td jwcid=%remove% ...Placeholder #2/td td jwcid=%remove% ...Placeholder #3/td /tr /table So I want to be able to render something like that. CustomTr is aware it needs CustomTd and should pass some parameters to CustomTd. CustomTd is a component which need some parameters to be render. And I can imagine I could have another component CustomTr2 capable to nest the same CustomTd. My problem is the way to defined and declare them. Is it possible to create only one template, a page template to define this sort of nested component or do I have to ask the web-designer to create another template for the CustomTd component as well? I found how to create one component but not how to create a nested component and to pass parameters from the parent to the child. The main question is in fact, how to create nested component that need parameter from the parent? Thanks a lot BW