Re: ValueEncoder stopped working in 5.017
Hello, I have resolved by rebuilding the project using Maven, probably was a classpath issue, no sure, glad it works now :-) Karel yosemite wrote: > > Hello, > the attached code worked fine in 5.011 but in 5.017 it blows up saying: > Render queue error in BeforeRenderTemplate[Index:select]: Failure reading > parameter 'encoder' of component Index:select: Could not find a coercion > from type org.example.myapp.util.IntegerEncoder to type > org.apache.tapestry5.ValueEncoder. Maybe I missed in version 5.017 the > encoder works different? > Any help really appreciated > Karel > --- > index.tml: > http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> > myapp Start Page > > > myapp Start Page >This is the start page for this application, a good place to > start your modifications. > Just to prove this is live: >The current time is: ${currentTime}. > > [refresh] > >t:encoder="encoder" /> > > > > --- > package org.example.myapp.pages; > import java.util.Calendar; > import java.util.Date; > import org.apache.tapestry5.SelectModel; > import org.apache.tapestry5.ValueEncoder; > import org.apache.tapestry5.annotations.Component; > import org.apache.tapestry5.corelib.components.Form; > import org.example.myapp.util.IntegerEncoder; > import org.example.myapp.util.IntegerSelectModel; > public class Index { > @Component > private Form form; > private Calendar c = Calendar.getInstance(); > public Date getCurrentTime() { > return new Date(); > } > public int getYear() { > return c.get(Calendar.YEAR); > } > public SelectModel getYearModel() { > return (SelectModel) new IntegerSelectModel(1900, 2010); > } > public ValueEncoder getEncoder() { > return (ValueEncoder) new IntegerEncoder(); > } > } > --- > package org.example.myapp.services; > import java.io.IOException; > import org.apache.tapestry5.ioc.ServiceBinder; > import org.apache.tapestry5.services.Request; > import org.apache.tapestry5.services.RequestFilter; > import org.apache.tapestry5.services.RequestHandler; > import org.apache.tapestry5.services.Response; > import org.slf4j.Logger; > public class AppModule { > public static void bind(ServiceBinder binder) {} > public RequestFilter buildTimingFilter(final Logger log) { > return new RequestFilter() { > public boolean service(Request request, Response > response, > RequestHandler handler) throws > IOException { > long startTime = System.currentTimeMillis(); > try { > return handler.service(request, > response); > } finally { > long elapsed = > System.currentTimeMillis() - startTime; > log.info(String.format("Request time: > %d ms", elapsed)); > } > } > }; > } > } > --- > package org.example.myapp.util; > import org.apache.tapestry5.ValueEncoder; > public class IntegerEncoder implements ValueEncoder { > public String toClient(Object i) { > return i.toString(); > } > public Object toValue(String s) { > return new Integer(s); > } > } > --- > package org.example.myapp.util; > import java.util.Map; > import org.apache.tapestry5.OptionModel; > public class IntegerOptionModel implements OptionModel { > private Number number; > public IntegerOptionModel(Number num) { > number = num; > } > public Map getAttributes() { > return null; > } > public String getLabel() { > return "" + number; > } > public Object getValue() { > return number; > } > public boolean isDisabled() { > return false; > } > } > --- > package org.example.myapp.util; > import java.util.ArrayList; > import java.util.List; > import org.apache.tapestry5.OptionGroupModel; > import org.apache.tapestry5.OptionModel; > import org.apache.tapestry5.util.AbstractSelectModel; > public class IntegerSelectModel extends AbstractSelectModel { > private List options = new ArrayList(); > public IntegerSelectModel(int numFrom, int numTo) { > int increment
ValueEncoder stopped working in 5.017
Hello, the attached code worked fine in 5.011 but in 5.017 it blows up saying: Render queue error in BeforeRenderTemplate[Index:select]: Failure reading parameter 'encoder' of component Index:select: Could not find a coercion from type org.example.myapp.util.IntegerEncoder to type org.apache.tapestry5.ValueEncoder. Maybe I missed in version 5.017 the encoder works different? Any help really appreciated Karel --- index.tml: http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> myapp Start Page myapp Start Page This is the start page for this application, a good place to start your modifications. Just to prove this is live: The current time is: ${currentTime}. [refresh] --- package org.example.myapp.pages; import java.util.Calendar; import java.util.Date; import org.apache.tapestry5.SelectModel; import org.apache.tapestry5.ValueEncoder; import org.apache.tapestry5.annotations.Component; import org.apache.tapestry5.corelib.components.Form; import org.example.myapp.util.IntegerEncoder; import org.example.myapp.util.IntegerSelectModel; public class Index { @Component private Form form; private Calendar c = Calendar.getInstance(); public Date getCurrentTime() { return new Date(); } public int getYear() { return c.get(Calendar.YEAR); } public SelectModel getYearModel() { return (SelectModel) new IntegerSelectModel(1900, 2010); } public ValueEncoder getEncoder() { return (ValueEncoder) new IntegerEncoder(); } } --- package org.example.myapp.services; import java.io.IOException; import org.apache.tapestry5.ioc.ServiceBinder; import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.RequestFilter; import org.apache.tapestry5.services.RequestHandler; import org.apache.tapestry5.services.Response; import org.slf4j.Logger; public class AppModule { public static void bind(ServiceBinder binder) {} public RequestFilter buildTimingFilter(final Logger log) { return new RequestFilter() { public boolean service(Request request, Response response, RequestHandler handler) throws IOException { long startTime = System.currentTimeMillis(); try { return handler.service(request, response); } finally { long elapsed = System.currentTimeMillis() - startTime; log.info(String.format("Request time: %d ms", elapsed)); } } }; } } --- package org.example.myapp.util; import org.apache.tapestry5.ValueEncoder; public class IntegerEncoder implements ValueEncoder { public String toClient(Object i) { return i.toString(); } public Object toValue(String s) { return new Integer(s); } } --- package org.example.myapp.util; import java.util.Map; import org.apache.tapestry5.OptionModel; public class IntegerOptionModel implements OptionModel { private Number number; public IntegerOptionModel(Number num) { number = num; } public Map getAttributes() { return null; } public String getLabel() { return "" + number; } public Object getValue() { return number; } public boolean isDisabled() { return false; } } --- package org.example.myapp.util; import java.util.ArrayList; import java.util.List; import org.apache.tapestry5.OptionGroupModel; import org.apache.tapestry5.OptionModel; import org.apache.tapestry5.util.AbstractSelectModel; public class IntegerSelectModel extends AbstractSelectModel { private List options = new ArrayList(); public IntegerSelectModel(int numFrom, int numTo) { int increment = numTo > numFrom ? 1 : -1; for (int i = numFrom; i <= numTo; i += increment) { options.add(new IntegerOptionModel(i)); } } public List getOptionGroups() { return null; } public List getOptions() { return options; } } --- web.xml: http://java.sun.com/dtd/web-app_2_3.dtd";> myapp Tapestry 5 Application tapestry.app-package org.example.myapp app org.apache.tapestry5.TapestryFilter app /* -- View this message in context: http://www.nabble.com/ValueEncoder-stopped-working-in-5.017-tp20828992p20828992.html Sent from the Tapestry - User mailing list archive at Na
Re: Tapestry5 and WebSphere6.1
Hello Renat, thank you for your interest. This is what I got: http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";> TestWeb tapestry.app-package cz.test TapestryFilter TapestryFilter org.apache.tapestry.TapestryFilter TapestryFilter /* index.jsp My Start.html and Start.class are in \profiles\AppSrv01\installedApps\MyPCNode01Cell\TestApp.ear\TestWeb.war\WEB-INF\classes\cz\test\ then javassist.jar, tapestry-core-5.0.5.jar, tapestry-ioc-5.0.5.jar and testng-5.1-jdk15.jar are in \profiles\AppSrv01\installedApps\MyPCNode01Cell\TestApp.ear\TestWeb.war\WEB-INF\lib\ Because http://localhost:9080/TestWeb/start gives me HTTP 404 - File not found I have another \profiles\AppSrv01\installedApps\MyPCNode01Cell\TestApp.ear\TestWeb.war\WEB-INF\Start.html and \profiles\AppSrv01\installedApps\MyPCNode01Cell\TestApp.ear\TestWeb.war\Start.html but still HTTP 404. There is also \profiles\AppSrv01\installedApps\MyPCNode01Cell\TestApp.ear\TestWeb.war\index.jsp which works perfect and this guy gets the TapestryFilter invoked, each index.jsp invokation displays a message to console: org.apache.tapestry.services.TapestryModule.RequestGlobals - Invoking constructor org.apache.tapestry.internal.services.RequestGlobalsImpl() (at RequestGlobalsImpl.java:31). [24.7.07 11:38:05:921 SELČ] 0021 SystemOut O 1389031 [WebContainer : 3] DEBUG org.apache.tapestry.ioc.services.TapestryIOCModule.ThreadLocale - Invoking constructor org.apache.tapestry.ioc.internal.services.ThreadLocaleImpl() (at ThreadLocaleImpl.java:26). Thanks for any comment Karel ___ Renat Zubairov wrote: > > Hi > > Could you may be post your web.xml here because 404 means that > servelet mappings might be incorrect. Otherwise it's very strange. > > Renat > > On 23/07/07, yosemite <[EMAIL PROTECTED]> wrote: >> >> Hello, >> >> thanks. Security on WebSphere is turned off. I also tried to modify to >> was.policy with no success: >> >> grant codeBase "file:${application}" { >> permission java.security.AllPermission; >> }; >> >> Funny thing is that a default welcome jsp gets displayed OK and Tapestry >> filter seems to get invoked OK because >> http://localhost:9080/TestWeb/index.jsp displays: >> >> [WebContainer : 2] DEBUG >> org.apache.tapestry.ioc.services.TapestryIOCModule.ThreadLocale - >> Invoking >> constructor org.apache.tapestry.ioc.internal.services.ThreadLocaleImpl() >> (at >> ThreadLocaleImpl.java:26). >> >> in the console; while anything like http://localhost:9080/TestWeb/start >> says >> HTTP 404 - File not found. >> >> Maybe deployment descriptor mapping >> >> >> >> tapestry.app-package >> cz.test >> >> >> works different in WebSphere? I have packaged my Tapestry class and html >> into >> TestApp.ear\TestWeb.war\WEB-INF\classes\ and Tapestry cannot find it >> there? >> >> Karel >> >> >> >> Renat Zubairov wrote: >> > >> > Hi >> > >> > Is security on the WebSphere on? >> > >> > I had significant problems in WS 5 with Security ON because of >> > Javassist bug with classloaders. >> > >> > Renat >> > >> > On 20/07/07, yosemite <[EMAIL PROTECTED]> wrote: >> >> >> >> Hello everybody, >> >> >> >> I tried to deploy a T5 application that works fine on Jetty and Tomcat >> >> onto >> >> WebSphere 6.1.0.3, and although the app deploys OK, TapestryFilter >> does >> >> not >> >> get invoked on url-patterrn /* so I get HTTP 404. >> >> >> >> SystemOut.log contains lines like >> >> ... [WebContainer : 1] DEBUG >> >> org.apache.tapestry.ioc.services.TapestryIOCModule.ClassFactory - >> >> Creating >> >> class from ClassFab[ >> >> public class $ServletApplicationInitializer_113e33644e7 extends >> >> java.lang.Object >> >> implements >> org.apache.tapestry.services.ServletApplicationInitializer >> >> private final org.apache.tapestry.ioc.ObjectCreator _creator; >> >> public >> >> >> $ServletApplicationInitializer_113e33644
Re: Tapestry5 and WebSphere6.1
Hello, thanks. Security on WebSphere is turned off. I also tried to modify to was.policy with no success: grant codeBase "file:${application}" { permission java.security.AllPermission; }; Funny thing is that a default welcome jsp gets displayed OK and Tapestry filter seems to get invoked OK because http://localhost:9080/TestWeb/index.jsp displays: [WebContainer : 2] DEBUG org.apache.tapestry.ioc.services.TapestryIOCModule.ThreadLocale - Invoking constructor org.apache.tapestry.ioc.internal.services.ThreadLocaleImpl() (at ThreadLocaleImpl.java:26). in the console; while anything like http://localhost:9080/TestWeb/start says HTTP 404 - File not found. Maybe deployment descriptor mapping tapestry.app-package cz.test works different in WebSphere? I have packaged my Tapestry class and html into TestApp.ear\TestWeb.war\WEB-INF\classes\ and Tapestry cannot find it there? Karel Renat Zubairov wrote: > > Hi > > Is security on the WebSphere on? > > I had significant problems in WS 5 with Security ON because of > Javassist bug with classloaders. > > Renat > > On 20/07/07, yosemite <[EMAIL PROTECTED]> wrote: >> >> Hello everybody, >> >> I tried to deploy a T5 application that works fine on Jetty and Tomcat >> onto >> WebSphere 6.1.0.3, and although the app deploys OK, TapestryFilter does >> not >> get invoked on url-patterrn /* so I get HTTP 404. >> >> SystemOut.log contains lines like >> ... [WebContainer : 1] DEBUG >> org.apache.tapestry.ioc.services.TapestryIOCModule.ClassFactory - >> Creating >> class from ClassFab[ >> public class $ServletApplicationInitializer_113e33644e7 extends >> java.lang.Object >> implements org.apache.tapestry.services.ServletApplicationInitializer >> private final org.apache.tapestry.ioc.ObjectCreator _creator; >> public >> $ServletApplicationInitializer_113e33644e7(org.apache.tapestry.ioc.ObjectCreator >> $1) >> _creator = $1; >> ... so I guess WAS can load Tapestry OK. Is there something blocking >> Tapestry5 on WebSphere 6.1? >> >> Any ideas, please >> Thanks >> Karel >> -- >> View this message in context: >> http://www.nabble.com/Tapestry5-and-WebSphere6.1-tf4116345.html#a11705964 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > -- > Best regards, > Renat Zubairov > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Tapestry5-and-WebSphere6.1-tf4116345.html#a11742285 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tapestry5 and WebSphere6.1
Hello everybody, I tried to deploy a T5 application that works fine on Jetty and Tomcat onto WebSphere 6.1.0.3, and although the app deploys OK, TapestryFilter does not get invoked on url-patterrn /* so I get HTTP 404. SystemOut.log contains lines like ... [WebContainer : 1] DEBUG org.apache.tapestry.ioc.services.TapestryIOCModule.ClassFactory - Creating class from ClassFab[ public class $ServletApplicationInitializer_113e33644e7 extends java.lang.Object implements org.apache.tapestry.services.ServletApplicationInitializer private final org.apache.tapestry.ioc.ObjectCreator _creator; public $ServletApplicationInitializer_113e33644e7(org.apache.tapestry.ioc.ObjectCreator $1) _creator = $1; ... so I guess WAS can load Tapestry OK. Is there something blocking Tapestry5 on WebSphere 6.1? Any ideas, please Thanks Karel -- View this message in context: http://www.nabble.com/Tapestry5-and-WebSphere6.1-tf4116345.html#a11705964 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 - Changing Locale
Your code worked for me, except I replaced ThreadLocale by PersistentLocale @Inject @Service("PersistentLocale") private PersistentLocale persistentLocaleService; then it works using e.g. persistentLocaleService.set(new Locale("fr")); Karel petros wrote: > > tapestry version 5.0.4 > > I have the following code in the html template of my LayoutCmpnt > Greek > English > > and the following code in the LayoutCmpnt.java > @Inject > @Service("ThreadLocale") > private ThreadLocale threadLocaleService; > > @Inject > private Locale currentLocale; > > @OnEvent(value = "action", component = "greekLocaleLink") > Object onActionFromGreekLocaleLink() > { > threadLocaleService.setLocale(new Locale("el")); > return null; > } > > @OnEvent(value = "action", component = "englishLocaleLink") > Object onActionFromEnglishLocaleLink() > { > threadLocaleService.setLocale(new Locale("en")); > return null; > } > > When the Greek link is clicked the onActionFromGreekLocaleLink() method is > called as expected, but just before the method is returned the > currentLocale object is still set to the "en" Locale. Is this the right > way to change the Locale programmatically ? > > Petros > > > Howard Lewis Ship wrote: >> >> I think that comment is out of date. >> >> You should be able to inject the ThreadLocale service and change the >> locale there. Tapestry will pick up on that and write out an updated >> cookie, which will cause the subsequent render request to be in the >> new locale. >> >> On 3/9/07, Bogdan Calmac <[EMAIL PROTECTED]> wrote: >>> Thanks guys, I saw that, but there was no mention about the ability to >>> change the locale at application level. So I can assume that for my >>> use case I would inject a new service in my page and use it to change >>> the locale programatically? >>> >>> Thanks, >>> >>> Bogdan Calmac. >>> >>> On 3/9/07, Hugo Palma <[EMAIL PROTECTED]> wrote: >>> > Take a look at the bottom of this page >>> > >>> http://tapestry.apache.org/tapestry5/tapestry-core/guide/localization.html. >>> > >>> > /"Tapestry does not yet support changing the locale, but that will be >>> > available shortly."/ >>> > >>> > Bogdan Calmac wrote: >>> > > Is it possible in Tapestry 5 to programatically change the locale >>> for >>> > > a sesison similar to IEngine.setLocale() from Tapestry 4? >>> > > >>> > > In my case I want to set the locale after the login into the >>> > > application (locale is stored in the user profile) and not rely on >>> the >>> > > browser locale. >>> > > >>> > > Thank you, >>> > > >>> > > Bogdan Calmac. >>> > > >>> > > >>> - >>> > > To unsubscribe, e-mail: [EMAIL PROTECTED] >>> > > For additional commands, e-mail: [EMAIL PROTECTED] >>> > > >>> > > >>> > >>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> >> -- >> 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] >> >> >> > > -- View this message in context: http://www.nabble.com/T5---Changing-Locale-tf3376399.html#a11489178 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]