Re: T5:how to inject slf4j service?
I checked slf4j sourcecode,there has a Logger interface implement:org.slf4j.impl.Log4jLoggerAdapter but how to bind them together and make a inject? need improve AppModule's function? I don't know why tapestry hadn't done it for user? need help too... On Tue, Sep 22, 2009 at 11:16 AM, cleverpig greatclever...@gmail.com wrote: i always use log4j for a long time.and now i will change to new weapon--slf4j! i use @inject annotation to request this slf4j logging service: public class Start{ ... �...@inject private Logger log; ... } but got a expection: No service implements the interface org.slf4j.Logger ... i found some little words about slf4j:http://tapestry.apache.org/tapestry5.1/guide/logging.html Logging of Tapestry Components and Pages Tapestry makes extensive use of SLF4J to log details about the creation and operation of your page and component classes. The default configuration for logging uses Log4J as the logging toolkit, though this can be changed. but this can be changed page link is invalid. somebody help me?give me example to fire a light in my darkness. :) -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Add a column to beaneditform question
The tml is t:beaneditform submitlabel=Register object=user remove=page model=registerModel t:parameter name=account t:label for=Account/ t:textField t:id=account t:model=user t:value=user.account t:validate=required,regexp/ /t:parameter t:parameter name=name t:label for=Name/ t:textField t:id=name t:model=user t:value=user.name t:validate=required,minlength=5/ /t:parameter t:parameter name=password t:label for=Password/ t:passwordField t:id=password t:model=user t:value=user.password t:validate=required,minlength=2/ /t:parameter t:parameter name=sex t:label for=Sex/ t:select t:id=sex t:model=genders t:value=user.sex t:blankOption=never/ /t:parameter /t:beaneditform and page object contains @Inject private ModelCreator displayer; @Property @Retain private BeanModel model; @Property private User user; ... public BeanModel getRegisterModel(){ // change to pass in from ui (let user choose from ui) String lang = Locale.ENGLISH.getDisplayLanguage(); String country = Locale.US.getDisplayCountry(); model = displayer.createBeanModel(User.class, lang, country); model.add(account, null).label(Account).sortable(false); return model; } public SelectModel getGenders(){ return displayer.createGender(); } in ModelCreator.java public BeanModel createBeanModel(Class clazz, String lang, String country){ if(null == source) throw new NullPointerException(No BeanModelSource configured!); if(null == cache.get(BeanModel.class)){ ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource(messages_en_US.properties); String path = url.getPath(); BeanModel model = null; try{ ResourceBundle bundle = new PropertyResourceBundle(new FileInputStream(path)); model = source.create( clazz, true, new MessagesImpl(new Locale(lang, country), bundle) ); }catch(IOException ioe){ ioe.printStackTrace(); } cache.put(BeanModel.class, model); } return (BeanModel)cache.get(BeanModel.class); } Thiago H. de Paula Figueiredo wrote: Please post your template. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor Consultor, desenvolvedor e instrutor em Java Coordenador e professor da Especialização em Engenharia de Software com Ênfase em Java da Faculdade Pitágoras http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- View this message in context: http://www.nabble.com/Add-a-column-to-beaneditform-question-tp25477600p25530611.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 Tapestry Website - Final review
I like the user guide to be updated out-of-the-cycle with marks like: introduced-in release=5.2.0.0 Tapestry can now automatigically frobnicate the groznard via the /introduced-in - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: New Tapestry Website - Final review
About the search - as I wrote above I think the search button should be on the every page. May be it would be good to have checkboxes include maillist and so on. The mail list is pretty important resource for T5, but a bit messy. May be it's ok to create this search based on the custom google search, as I suggested earlier. We need more opinions on that. Actually the first version can be put right now to make it more visual. We also need more opinions on what sources to include in our google custom search. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: On-site edition of messages (translation) ?
Hi Nicolas, GNU gettext may interest you if you have complex cases like a lot of plurals. It has nice tool support. Unfortunately you will loose Tapestry component-binded message bundles in this case. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: form that create an object
Hi Limonn, you need a public setter for your User object. Class com.limonn.pages.Form does not contain a property named 'name' (within property expression 'name'). Available properties: class, componentResources, user because in the class page I have private User user it is the object I want - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Accessing page context from a component
Chakra words reminds me of the interesting idea for components to have their independent activation context. That page is not aware of. In this case the component encapsulates the knowledge about specific url parameters that it needs. And can be reused on different pages without altering them. For example imagine a custom pager component that needs parameter pageNum. I use a somewhat similar solution using @Environmental inside Mixins that stores data in request parameters. (?pageNum=3anotherParam=3.333) On Mon, Sep 14, 2009 at 8:15 PM, Howard Lewis Ship hls...@gmail.com wrote: Otho is exactly right here. Each piece of Tapestry has its purpose, and pages act as a bridge between the client and the components within the page. On Mon, Sep 14, 2009 at 4:13 AM, Otho taa...@googlemail.com wrote: I wouldn't couple a component so tightly to a specific page. If you need to pass certain bits of information you can also use component parameters from within the page. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Add a column to beaneditform question
result in error: @Property(write=false) @Retain private BeanModel model; work version: @Property @Retain private BeanModel model; I sovle this problem. The problem comes from the above annotation where there is an attribute named `write' that should be removed (I thought it was removed but indeed it was not) so that the bean model can add new column. Thanks for the help. I appreciate it. -- View this message in context: http://www.nabble.com/Add-a-column-to-beaneditform-question-tp25477600p25530674.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: form that create an object
Em Tue, 22 Sep 2009 05:54:09 -0300, Sergey Didenko sergey.dide...@gmail.com escreveu: Hi Limonn, you need a public setter for your User object. Or annotate it with @Property. This only works in Tapestry pages, components and mixins. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
returning JSONObject always displays the js-code
Hi there. I'm using some links and a zone component. the EventHandler looks like this (only some playing around and learning): public Object onLeague(Object[] in) { ... JSONObject json = new JSONObject(); json.put(content,); json.put(script, alert('hi');); return json; } and I'm alwasy getting an zone-update which shows me the json-onject-literal and not the wished alertbox with 'hi'. What's wrong there? -- View this message in context: http://www.nabble.com/returning-JSONObject-always-displays-the-js-code-tp25530724p25530724.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: Resource access problem, alternative packaging
Thiago H. de Paula Figueiredo schrieb: Em Mon, 21 Sep 2009 06:33:29 -0300, Sebastian Hennebrueder use...@laliluna.de escreveu: Hello, Hi! while reading through the JSF 2 spec I found the packaging instruction of resources. JSF 2 will allow to pack any kind of resources in a dedicated directory 'resources'. META-INF/resources/resourceIdentifier If we would follow this approach, we could get rid of the access problem immediately without the need of a request filter. What do you think? It won't solve the problem, as files that need to go to the classpath (hibernate.cfg.xml, for example) will still be downloadable. I think it would. hibernate.cfg.xml is in the class path whereas all public resources are in META-INF/resources. Basically we stop serving directly from the classpath but instead deliver content using META-INF/resources as root. If you want to have something public available you put it in there. -- Best Regards / Viele Grüße Sebastian Hennebrueder - Software Developer and Trainer for Hibernate / Java Persistence http://www.laliluna.de - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Resource access problem, alternative packaging
Em Tue, 22 Sep 2009 10:45:58 -0300, Sebastian Hennebrueder use...@laliluna.de escreveu: I think it would. hibernate.cfg.xml is in the class path whereas all public resources are in META-INF/resources. Basically we stop serving directly from the classpath but instead deliver content using META-INF/resources as root. If hibernate.cfg.xml stays in the classpath, your proposed solution does not solve the problem. For public resources, putting them in the classpath isn't a problem at all and makes it very simple for packages to provide their resources (images, for example). If put in META-INF/resources, Tapestry would need to write new code to handle them and time is scarce for the committers. As it would not solve the original problem (configuration files being acessible in the internet), I don't think it's a good idea. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: returning JSONObject always displays the js-code
Em Tue, 22 Sep 2009 10:28:09 -0300, Lionell_Hutz dennisgerha...@gmx.de escreveu: Hi there. Hi! I'm using some links and a zone component. the EventHandler looks like this (only some playing around and learning): and I'm alwasy getting an zone-update which shows me the json-onject-literal and not the wished alertbox with 'hi'. What's wrong there? The use of JSON with Zones. :) JSONObject is meant to be used when you write your own JavaScript to request something in your page, component or mixin class, When using Zones, you shouldn't return JSONObjets, as they expect a Block or a component. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Avoiding recursion detection in ajax situations.
Ok, got it working. The end result was that I created the following in order to do this: 1) A custom service which I use to retrieve the block from the injected page. While retreiving the block, I have to tell this service what the real form component should be, essentially. 2) An outbound url rewriter, that uses that custom service to convert form links pointing to the injected page to the page doing the ajax. 3) A mixin which setupRender/cleanupRender wraps AbstractField. WHat I do is I slip in my own FormSupport into environment for any AbstractField (the most base class of form fields), so that I can intercept the store() method, in which I return the ajax page's component instead of the injected pages component, so that t:formdata hidden field 'points' to the ajax page's form and not the injected one. Not alot of code, but a ton of work and investigation. ownedthx wrote: I tried url rewriting the outbound action attribute to match the component form, instead of the form from the injected page. It causes the event to raise now in the right form... but all the form field data are sent to the form in the injected page, because that big nasty hidden input field that tapestry injects in ever form, once decoded, tells Tapestry to send the form field data to that other form. I always wondered what that hidden data was doing. I guess, in this circumstance, I can not use the field in my own form (which is null) but instead decode the hidden field data in my component using ClientDataEncoder, retrieve the form from the injected page by ID, and then grab it's values... Seth Robert Zeigler wrote: The problem is that even though there is no recursion in the / rendering/, per se, there is recursion in the structure. All recursive routines (and even having A = B = A is a recursive structure) have to have a stop condition; the problem is that the stop condition for rendering is only known when rendering, and tapestry can't know it when building the /structure/ of the page. Ergo, the strict structure requirements. I think you were on the right track with the injected page trick, although I would probably have taken a slightly different track, using component source to retrieve the page and corresponding component. Also, if there's a Form in A, and your including A = B = A, does that mean you have a nested form?? With a bit more information about the specific details of what you're trying to accomplish, the list might be able to propose a solution that will work for you. Cheers, Robert On Sep 20, 2009, at 9/205:01 PM , ownedthx wrote: Tried using a mixin on the zone returned. I wanted to see if I could just return my component on BeforeRenderTemplate. I guess, though, that the zone has to have my component defined (which however would cause the recursion detection to fire), because I get an error on initial page load, complaining that the zone does not define the component. At this point, I think this is a bug in Tapestry, because the recursion detection logic shouldn't necessarily use what's in t:block. I understand the whole reason it's there is to avoid infinite loops, but at the same time I should be able to do this, since I'm not actually doing recursion. It's like I want a: t:block recursion=ignore ownedthx wrote: The injected page 'trick' probably is not going to work. the action attribute of the form, unsuprisingly, points back to the path of that injected page; not where the form is in the page actually using this block from the injected page. Understandable. Maybe I can return the component as the response to a render phase method. That should also avoid recursion detection. Just have to try I guess. Seth ownedthx wrote: Hi all, Tapestry doesn't allow nested components. Ok, no problem. However, there is a situation where, say in component A's template, that I want to define a block which has a reference to component A--but I'll only call that component in a Zone update via Ajax. In other words, there isn't actually recursion going on, because in a full page refresh, the block isn't rendered, and when the zone is updated with Ajax, the component is rendered but that's OK because it's parent isn't being rendered. Regardless, Tapestry get's mad, warning me about recursion if I put that block in the page. Ok, fine, so I try to get around that. I have an approach that works ... almost: I made a 'worker' page, which has nothing but a block defined--the block with the component A. I then inject that page into my component, (using @InjectPage) and then on Ajax request to my component, I use a public getter to retrieve the block from this injected page, and return that. I'm having some sort of issue though; if that block from the injected page contains a form, and I then submit that form, tapestry throws
Obtaining a reference to the component tree of a page while Dispatching
Hi, I am looking for a way to get a hold of all components Class'es on a page while in a dispatcher. I want to know if any of the components on the page are annotated with my custom @SecuredContent annotation but have no clue how to figure out what components are loaded on a page when I only have access to the page. through the ComponentClassResolver I can find my Class of the page but here I don't have access to the Components. Should I use the PagePool to have a look? I'm not quite sure what implications this might have if I do this on every request to a page. Looking forward to some tricks and tips. Cheers, Joost - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5.1 How to support non English characters in url
Hello Everyone, In our application we were supporting other non English characters in url in Tapestry 5.0.5. At that time it was working fine without any problem but now after upgrading to 5.1 we are getting an exception as below - java.lang.IllegalArgumentException : Input string 'niño' is not valid; the character 'ñ' at position 3 is not valid. # org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143) # $URLEncoder_123e2454158.decode($URLEncoder_123e2454158.java) # org.apache.tapestry5.internal.services.ContextPathEncoderImpl.decodePath(ContextPathEncoderImpl.java:86) # $ContextPathEncoder_123e2454150.decodePath($ContextPathEncoder_123e2454150.java) # org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.checkIfPage(ComponentEventLinkEncoderImpl.java:333) # org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.decodePageRenderRequest(ComponentEventLinkEncoderImpl.java:313) # $ComponentEventLinkEncoder_123e245414e.decodePageRenderRequest($ComponentEventLinkEncoder_123e245414e.java) # org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:41) # $Dispatcher_123e245414f.dispatch($Dispatcher_123e245414f.java) # $Dispatcher_123e2454144.dispatch($Dispatcher_123e2454144.java) # org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:245) # org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26) # $RequestHandler_123e2454145.service($RequestHandler_123e2454145.java) # org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:778) # $RequestHandler_123e2454145.service($RequestHandler_123e2454145.java) # org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:767) # $RequestHandler_123e2454145.service($RequestHandler_123e2454145.java) # org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85) # $RequestHandler_123e2454145.service($RequestHandler_123e2454145.java) # org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90) # org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:81) # org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85) # org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103) # $RequestHandler_123e2454145.service($RequestHandler_123e2454145.java) # $RequestHandler_123e245413b.service($RequestHandler_123e245413b.java) # org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:197) # org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53) # $HttpServletRequestHandler_123e245413d.service($HttpServletRequestHandler_123e245413d.java) # org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44) # $HttpServletRequestHandler_123e245413d.service($HttpServletRequestHandler_123e245413d.java) # org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62) # $HttpServletRequestFilter_123e245413a.service($HttpServletRequestFilter_123e245413a.java) # $HttpServletRequestHandler_123e245413d.service($HttpServletRequestHandler_123e245413d.java) # org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:726) # $HttpServletRequestHandler_123e245413d.service($HttpServletRequestHandler_123e245413d.java) # $HttpServletRequestHandler_123e2454137.service($HttpServletRequestHandler_123e2454137.java) # org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:127) Is there any configuration I am missing to support non English characters in url? I have also set the url encoding for request as UTF-8 in filter, still it is not working. I am trying to find solution for this from couple hours now, if any one have solution for this it will be great help. :-) Thanks in advance. From, Ritesh -- View this message in context: http://www.nabble.com/T5.1-How-to-support-non-English-characters-in-url-tp25530831p25530831.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
[Tapestry Central] No Fluff Just Stuff Seattle Roundup
It was a huge pleasure to be speaking at a No Fluff Just Stuff conference again, it's been much too long. This was a good show with a lot of folks coming down from Vancouver, BC to attend. This was an odd show for me, as we didn't do any Tapestry talks at all. However, all three of my talks (an introduction to Cappuccino, and two talks on Clojure) were well attended, with good questions and some fun discussions between sessions. I'm looking forward to doing these same sessions, with a number of improvements, in the Spring when NFJS starts back up. Interestingly, I was busy writing Clojure code almost continuously in the back row of other speaker's sessions ... but this didn't stop me from appreciating Scott Davis's great talks on Grails, and on deconstructing Web 2.0. Also, I had a lot of interaction with Brian Goetz (are all web application's broken). As usual, as soon as you mix Java with concurrency, it's a bit sobering. Tapestry helps here, but is not a complete panacea against some of the nightmare scenarios that may become more commonplace as the number of CPU cores increases. I'm getting more adept at advanced Clojure; I've been busy adapting the concept of parameter destructuring to pulling data out of the request path and query parameters. (defaction increment-count {:path count/increment} [env] [count :int] ; destructure the value after /increment as an integer (send-redirect env (link env show-counter [(inc count)]))) This defines a Cascade action, mapped to the count/increment path. A number is expected to follow (i.e., /count/increment/4) and the job of this action is to increment that value and redirect the user to the show-counter view. Cascade actions are still functions, thus the [env] (Cascade actions always take a single parameter, a map called the environment that provides access to Cascade values as well as Servlet API objects). The path destructuring follows: [count :int] which destructures the first extra path value as an integer. There's a number of built-in parsers referenced by keywords such as :int, or you can supply a function that takes a string and returns a value. If another pair of values is given, that applies to the next value in the path. I'm finding this a pretty elegant way to express this secondary aspect of mapping URLs to view and actions; there's additional syntax for destructuring query parameters instead of path values. I may extend this further, to handle default values for missing terms in the path. I try to capture some of this in my Clojure talks; the idea of growing the language up, adding the new features you need. From one perspective, this is just a domain specific language, but in the Lisp world, that concept is so deeply entrenched that there isn't even a word for it beyond programming. This is one part of the overall Clojure picture that gets me very excited, and I'm continuing to struggle with how to express this to people for whom even the Lisp syntax is alien and off-putting. -- Posted By Howard to Tapestry Central at 9/22/2009 10:18:00 AM
Re: Obtaining a reference to the component tree of a page while Dispatching
Em Tue, 22 Sep 2009 12:09:12 -0300, Joost Schouten (ml) joost...@jsportal.com escreveu: Hi, Hi! I am looking for a way to get a hold of all components Class'es on a page while in a dispatcher. I want to know if any of the components on the page are annotated with my custom @SecuredContent annotation but have no clue how to figure out what components are loaded on a page when I only have access to the page. I don't know how you would get the component tree. But, if the annotation was in a page, I would implement a ComponentClassTransformer. This is an example that I hope it gives you a clue: public class TapestrySecurityWorker implements ComponentClassTransformWorker { public void transform(ClassTransformation transformation, MutableComponentModel model) { if (transformation.getAnnotation(NeedsLoggedInUser.class) != null) { model.setMeta(TapestrySecurityConstants.NEEDS_LOGGED_IN_USER_METADATA_KEY, true); } } } The important trick here is the MutableComponentModel.setMeta() method. Then, in a dispatcher, I can check the meta information: String pageName = extractPageName(request); if (pageName != null) { final ComponentModel pageModel = componentModelSource.getPageModel(pageName); final String loggedInMetaValue = pageModel.getMeta(TapestrySecurityConstants.NEEDS_LOGGED_IN_USER_METADATA_KEY); ... } private String extractPageName(Request request) { String pageName = null; final ComponentEventRequestParameters componentEventParameters = linkEncoder.decodeComponentEventRequest(request); if (componentEventParameters != null) { pageName = componentEventParameters.getContainingPageName(); } if (pageName == null) { final PageRenderRequestParameters pageRenderParameters = linkEncoder.decodePageRenderRequest(request); if (pageRenderParameters != null) { pageName = pageRenderParameters.getLogicalPageName(); } } return pageName; } linkEncoder is an instance of the ComponentEventLinkEncoder service. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5.1 How to support non English characters in url
Em Tue, 22 Sep 2009 14:13:44 -0300, Ritesh_121 rites...@avibha.com escreveu: Hello Everyone, Hi! In our application we were supporting other non English characters in url in Tapestry 5.0.5. At that time it was working fine without any problem but now after upgrading to 5.1 we are getting an exception as below - You'll need to override the URLEncoder service with one of your own. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5:how to inject slf4j service?
You need an implementation of slf4j, there are a lot. I use slf4j-log4j12.1.5.2 (it's a bridge between slf4j and log4j) Check this blog: http://fernandoribeiro.eti.br/2006/05/24/how-to-use-slf4j-with-log4j/ On Tue, Sep 22, 2009 at 4:36 AM, cleverpig greatclever...@gmail.com wrote: I checked slf4j sourcecode,there has a Logger interface implement:org.slf4j.impl.Log4jLoggerAdapter but how to bind them together and make a inject? need improve AppModule's function? I don't know why tapestry hadn't done it for user? need help too... On Tue, Sep 22, 2009 at 11:16 AM, cleverpig greatclever...@gmail.com wrote: i always use log4j for a long time.and now i will change to new weapon--slf4j! i use @inject annotation to request this slf4j logging service: public class Start{ ... �...@inject private Logger log; ... } but got a expection: No service implements the interface org.slf4j.Logger ... i found some little words about slf4j:http://tapestry.apache.org/tapestry5.1/guide/logging.html Logging of Tapestry Components and Pages Tapestry makes extensive use of SLF4J to log details about the creation and operation of your page and component classes. The default configuration for logging uses Log4J as the logging toolkit, though this can be changed. but this can be changed page link is invalid. somebody help me?give me example to fire a light in my darkness. :) -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 - 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: Obtaining a reference to the component tree of a page while Dispatching
Thiago, Thanks for your quick response. Security checking on the page level is all fine and works great. It is good to see that my implementation overlaps yours a lot. (Difference is that I don't use the setMeta, but check for the annotation in the Dispatcher itself) I was hoping to be able to actually annotate a component and reject page access based on the most restricting annotated component on the page. I'll keep trying. any further pointers would be appreciated. Thanks, Joost Thiago H. de Paula Figueiredo wrote: Em Tue, 22 Sep 2009 12:09:12 -0300, Joost Schouten (ml) joost...@jsportal.com escreveu: Hi, Hi! I am looking for a way to get a hold of all components Class'es on a page while in a dispatcher. I want to know if any of the components on the page are annotated with my custom @SecuredContent annotation but have no clue how to figure out what components are loaded on a page when I only have access to the page. I don't know how you would get the component tree. But, if the annotation was in a page, I would implement a ComponentClassTransformer. This is an example that I hope it gives you a clue: public class TapestrySecurityWorker implements ComponentClassTransformWorker { public void transform(ClassTransformation transformation, MutableComponentModel model) { if (transformation.getAnnotation(NeedsLoggedInUser.class) != null) { model.setMeta(TapestrySecurityConstants.NEEDS_LOGGED_IN_USER_METADATA_KEY, true); } } } The important trick here is the MutableComponentModel.setMeta() method. Then, in a dispatcher, I can check the meta information: String pageName = extractPageName(request); if (pageName != null) { final ComponentModel pageModel = componentModelSource.getPageModel(pageName); final String loggedInMetaValue = pageModel.getMeta(TapestrySecurityConstants.NEEDS_LOGGED_IN_USER_METADATA_KEY); ... } private String extractPageName(Request request) { String pageName = null; final ComponentEventRequestParameters componentEventParameters = linkEncoder.decodeComponentEventRequest(request); if (componentEventParameters != null) { pageName = componentEventParameters.getContainingPageName(); } if (pageName == null) { final PageRenderRequestParameters pageRenderParameters = linkEncoder.decodePageRenderRequest(request); if (pageRenderParameters != null) { pageName = pageRenderParameters.getLogicalPageName(); } } return pageName; } linkEncoder is an instance of the ComponentEventLinkEncoder service. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Obtaining a reference to the component tree of a page while Dispatching
Em Tue, 22 Sep 2009 14:38:35 -0300, Joost Schouten (ml) joost...@jsportal.com escreveu: Thiago, Hi! Thanks for your quick response. I had working code to show, so it was easy to be quick. :P Security checking on the page level is all fine and works great. It is good to see that my implementation overlaps yours a lot. (Difference is that I don't use the setMeta, but check for the annotation in the Dispatcher itself) The advantage of using the approach I proposed is that changes in the annotations reflect immediately (live class reloading), while checking directly in the class would make page annotation changes to be in effect just after a restart. I was hoping to be able to actually annotate a component and reject page access based on the most restricting annotated component on the page. I guess you would need to forget about dispatchers and implement a ComponentClassTransformWorker that adds a method to the annotated component that does the checks you need and throw an exception if needed. Your error page would handle this situation and probably show some message to your users. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [ANNOUNCE] ChenilleKit 1.2.0 RELEASE
Hi Massimo, I have a question : how to download that release? without maven Thank you in advance for your time. I browsed the site but I cannot see any download section nor instructions. Cheers, Deian -- View this message in context: http://www.nabble.com/-ANNOUNCE--ChenilleKit-1.2.0-RELEASE-tp25511012p25530890.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 Tapestry Website - Final review
I find that dynamic menus that slide down (or in any direction) slow me down. You need to wait a part of a second or maybe even one whole second til it slides, while with a static menu I would already be inside the page I wanted. But this is true only if everything can be easily fitted on one page, so that's why I would recomment to have an automatically updated sitemap. For me, sitemaps are a nice solution for fast way of navigation. You need one click to open it and after a short glance you will see what you need and in which context it is located. On 21.09.2009 17:22, Ivano Luberti wrote: Don't know I finfd myself so oftent as part of a minority, but I like dinamic menu with only one submenu expanded at time , like now. Sergey Didenko ha scritto: Well, after more thinking I'm more for multiple open menus. IMHO they stress doc structure better. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org smime.p7s Description: S/MIME Cryptographic Signature
Concerned about the future of Tapestry
Hi Howard, All The following sound bites seem to paint a pretty bleak future for Tapestry. 1) Interestingly, I was busy writing Clojure code almost continuously in the back row of other speaker's sessions .I've been busy adapting the concept of parameter destructuring to pulling data out of the request path and query parameters. - HLS, today. Writing what sounds like the groundwork for a new web application framework, presumably better than Tapestry. 2) I'm using my improved freedom to pursue other important technologies * beyond* Tapestry, such as Clojure, Cappuccino, and CouchDB - HLS, August 27 Despite what appears to be a healthy community, a solid code base and set of hard working committers I am still inclined to believe that the driving force behind the innovation in Tapestry is still you Howard. In my mind your move to different technologies signifies a loss of faith in Java and implies a sense of frustration with the limits of what is possible with T5. Can anyone set my mind at ease with some real facts about the future of Tapestry? I have invested a year or more in learning the framework and applying what I know to creating a web application with it but as a developer I need to know that my code won't just be another rewrite waiting to happen. The alternative, JSF, may be clunky but at least I can be certain that it will be around and evolving in 5 years time. Regards Steve
Re: Concerned about the future of Tapestry
On Tue, Sep 22, 2009 at 2:28 PM, Steve Cowx steve.c...@gmail.com wrote: Hi Howard, All The following sound bites seem to paint a pretty bleak future for Tapestry. Anything but! 1) Interestingly, I was busy writing Clojure code almost continuously in the back row of other speaker's sessions .I've been busy adapting the concept of parameter destructuring to pulling data out of the request path and query parameters. - HLS, today. Writing what sounds like the groundwork for a new web application framework, presumably better than Tapestry. 2) I'm using my improved freedom to pursue other important technologies * beyond* Tapestry, such as Clojure, Cappuccino, and CouchDB - HLS, August 27 Despite what appears to be a healthy community, a solid code base and set of hard working committers I am still inclined to believe that the driving force behind the innovation in Tapestry is still you Howard. In my mind your move to different technologies signifies a loss of faith in Java and implies a sense of frustration with the limits of what is possible with T5. Can anyone set my mind at ease with some real facts about the future of Tapestry? I have invested a year or more in learning the framework and applying what I know to creating a web application with it but as a developer I need to know that my code won't just be another rewrite waiting to happen. Several years ago I posted something about Ruby and there was a flurry of posts: Is Howard abandoning Java? Guess what ... I didn't. I'm committed to Tapestry even beyond what it represents as a revenue stream. I expect to see more releases like 5.1 ... compatible, with new features that seamlessly plug into existing applications. More importantly, I want to make the documentation better (in book form, and online). In fact, if I never committed another line of code to Tapestry but JUST wrote a definitive book on it, that would do more to extend the life and acceptance of Tapestry than anything else I could possibly do! The alternative, JSF, may be clunky but at least I can be certain that it will be around and evolving in 5 years time. Yes, they may have gotten through one round of improvement by then :-) Regards Steve Steve, I'm afraid you misunderstand how innovation occurs ... it doesn't happen by locking someone in a basement so they can focus on only one thing. Innovation comes from learning different ideas, different languages, different technologies and expanding your mind around them. The Pragmatic Programmers emphasize learning a new language every year and I like to learn a new technology more often than that. Many of the innovations you see in Tapestry are ideas that came from other areas, in other guises. So don't worry, I'm going to have my fingers in a few different pies ... and I'm going to learn new things and adapt them back into Tapestry. That's how I've been working for 20+ years now. -- 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: Concerned about the future of Tapestry
Em Tue, 22 Sep 2009 18:28:05 -0300, Steve Cowx steve.c...@gmail.com escreveu: Hi Howard, All Hi! Can anyone set my mind at ease with some real facts about the future of Tapestry? Please englighten us about what these real facts could be. You've just stated some real facts about why you shouldn't be worried by the future of Tapestry 5. :) The alternative, JSF, may be clunky but at least I can be certain that it will be around and evolving in 5 years time. They haven't got JSF right until now, 5 years after the first release, and won't get so soon, as its overengineered nature will severely hurt any attempt to improve it whithout backward-incompatible changes. -- Thiago H. de Paula Figueiredo http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5:how to inject slf4j service?
oh,thanks for your reply,Alfonso! just now,i get know i need a slf4j implementation.i found a implementation class from slf4j.jar:org.slf4j.impl.Log4jLoggerAdapter. but how to declare the binding of them? what's need to add in the AppModule? you get work with slf4j tapestry5?please show me some example... :) On Wed, Sep 23, 2009 at 1:31 AM, Alfonso Quiroga alfonsose...@gmail.com wrote: You need an implementation of slf4j, there are a lot. I use slf4j-log4j12.1.5.2 (it's a bridge between slf4j and log4j) Check this blog: http://fernandoribeiro.eti.br/2006/05/24/how-to-use-slf4j-with-log4j/ On Tue, Sep 22, 2009 at 4:36 AM, cleverpig greatclever...@gmail.com wrote: I checked slf4j sourcecode,there has a Logger interface implement:org.slf4j.impl.Log4jLoggerAdapter but how to bind them together and make a inject? need improve AppModule's function? I don't know why tapestry hadn't done it for user? need help too... On Tue, Sep 22, 2009 at 11:16 AM, cleverpig greatclever...@gmail.com wrote: i always use log4j for a long time.and now i will change to new weapon--slf4j! i use @inject annotation to request this slf4j logging service: public class Start{ ... @Inject private Logger log; ... } but got a expection: No service implements the interface org.slf4j.Logger ... i found some little words about slf4j:http://tapestry.apache.org/tapestry5.1/guide/logging.html Logging of Tapestry Components and Pages Tapestry makes extensive use of SLF4J to log details about the creation and operation of your page and component classes. The default configuration for logging uses Log4J as the logging toolkit, though this can be changed. but this can be changed page link is invalid. somebody help me?give me example to fire a light in my darkness. :) -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 - 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 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5:how to inject slf4j service?
Em Tue, 22 Sep 2009 21:55:44 -0300, cleverpig greatclever...@gmail.com escreveu: oh,thanks for your reply,Alfonso! just now,i get know i need a slf4j implementation.i found a implementation class from slf4j.jar:org.slf4j.impl.Log4jLoggerAdapter. but how to declare the binding of them? what's need to add in the AppModule? Take a look at http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5:how to inject slf4j service?
yes,i'd read it..but i can't get the door to answer... On Wed, Sep 23, 2009 at 9:57 AM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: Em Tue, 22 Sep 2009 21:55:44 -0300, cleverpig greatclever...@gmail.com escreveu: oh,thanks for your reply,Alfonso! just now,i get know i need a slf4j implementation.i found a implementation class from slf4j.jar:org.slf4j.impl.Log4jLoggerAdapter. but how to declare the binding of them? what's need to add in the AppModule? Take a look at http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5:how to inject slf4j service?
so,after add the buildLogger function,we can use these code to inject Logger service: Class Start{ ... @Inject private Logger log; ... } On Wed, Sep 23, 2009 at 12:29 PM, cleverpig greatclever...@gmail.com wrote: I got the answer! It's so easy...thank all of my helpers and opensource! my problem's solution:add this function in AppModule class: public Logger buildLogger(final Logger log){ return log; } I'd read this article:http://java.dzone.com/news/tapestry-5-ioc-binding-and-bui,and learned what's the secret key in there: ---Service Builder Methods--- Sometimes just instantiating a class is not enough; there may be additional configuration needed as part of instantiating the class. Tapestry 5 IoC's predecessor, HiveMind, accomplished such goals with complex service-building services. It ended up being a lot of XML. T5 IoC accomplishes the same, and more, using service builder methods; module methods that construct a service. A typical case is when a service implementation needs to listen to events from some other service: public static TranslatorSource buildTranslatorSource(ComponentInstantiatorSource componentInstantiatorSource, ServiceResources resources) { TranslatorSourceImpl service = resources.autobuild(TranslatorSourceImpl.class); componentInstantiatorSource.addInvalidationListener(service); return service; } Module methods prefixed with build are service builder methods. The service interface is defined from the return value (TranslatorSource). The service id is explicitly TranslatorSource (that is, everything after build in the method name). Here, Tapestry has injected into the service builder method. ComponentInstantiatorSource is a service that fires events. ServiceResources is something else: it is a bundle of resources related to the service being constructed ... including the ability to instantiate an object including dependencies. What's great here is that buildTranslatorSource() doesn't need to know what the dependencies of TranslatorSourceImpl are, it can instantiate the class with dependencies using the autobuild() method. The service builder then adds the new service as a listener of the ComponentInstantiatorSource, before returning it. 2009/9/23 cleverpig greatclever...@gmail.com: yes,i'd read it..but i can't get the door to answer... On Wed, Sep 23, 2009 at 9:57 AM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: Em Tue, 22 Sep 2009 21:55:44 -0300, cleverpig greatclever...@gmail.com escreveu: oh,thanks for your reply,Alfonso! just now,i get know i need a slf4j implementation.i found a implementation class from slf4j.jar:org.slf4j.impl.Log4jLoggerAdapter. but how to declare the binding of them? what's need to add in the AppModule? Take a look at http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5:how to inject slf4j service?
Is your logging working now? I didn't do anything in AppModule, just drop the jars and logging works, if you still have problems, I can show you my project configuration, good luck 2009/9/23 cleverpig greatclever...@gmail.com: so,after add the buildLogger function,we can use these code to inject Logger service: Class Start{ ... @Inject private Logger log; ... } On Wed, Sep 23, 2009 at 12:29 PM, cleverpig greatclever...@gmail.com wrote: I got the answer! It's so easy...thank all of my helpers and opensource! my problem's solution:add this function in AppModule class: public Logger buildLogger(final Logger log){ return log; } I'd read this article:http://java.dzone.com/news/tapestry-5-ioc-binding-and-bui,and learned what's the secret key in there: ---Service Builder Methods--- Sometimes just instantiating a class is not enough; there may be additional configuration needed as part of instantiating the class. Tapestry 5 IoC's predecessor, HiveMind, accomplished such goals with complex service-building services. It ended up being a lot of XML. T5 IoC accomplishes the same, and more, using service builder methods; module methods that construct a service. A typical case is when a service implementation needs to listen to events from some other service: public static TranslatorSource buildTranslatorSource(ComponentInstantiatorSource componentInstantiatorSource, ServiceResources resources) { TranslatorSourceImpl service = resources.autobuild(TranslatorSourceImpl.class); componentInstantiatorSource.addInvalidationListener(service); return service; } Module methods prefixed with build are service builder methods. The service interface is defined from the return value (TranslatorSource). The service id is explicitly TranslatorSource (that is, everything after build in the method name). Here, Tapestry has injected into the service builder method. ComponentInstantiatorSource is a service that fires events. ServiceResources is something else: it is a bundle of resources related to the service being constructed ... including the ability to instantiate an object including dependencies. What's great here is that buildTranslatorSource() doesn't need to know what the dependencies of TranslatorSourceImpl are, it can instantiate the class with dependencies using the autobuild() method. The service builder then adds the new service as a listener of the ComponentInstantiatorSource, before returning it. 2009/9/23 cleverpig greatclever...@gmail.com: yes,i'd read it..but i can't get the door to answer... On Wed, Sep 23, 2009 at 9:57 AM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: Em Tue, 22 Sep 2009 21:55:44 -0300, cleverpig greatclever...@gmail.com escreveu: oh,thanks for your reply,Alfonso! just now,i get know i need a slf4j implementation.i found a implementation class from slf4j.jar:org.slf4j.impl.Log4jLoggerAdapter. but how to declare the binding of them? what's need to add in the AppModule? Take a look at http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5:how to inject slf4j service?
I got the answer! It's so easy...thank all of my helpers and opensource! my problem's solution:add this function in AppModule class: public Logger buildLogger(final Logger log){ return log; } I'd read this article:http://java.dzone.com/news/tapestry-5-ioc-binding-and-bui,and learned what's the secret key in there: ---Service Builder Methods--- Sometimes just instantiating a class is not enough; there may be additional configuration needed as part of instantiating the class. Tapestry 5 IoC's predecessor, HiveMind, accomplished such goals with complex service-building services. It ended up being a lot of XML. T5 IoC accomplishes the same, and more, using service builder methods; module methods that construct a service. A typical case is when a service implementation needs to listen to events from some other service: public static TranslatorSource buildTranslatorSource(ComponentInstantiatorSource componentInstantiatorSource, ServiceResources resources) { TranslatorSourceImpl service = resources.autobuild(TranslatorSourceImpl.class); componentInstantiatorSource.addInvalidationListener(service); return service; } Module methods prefixed with build are service builder methods. The service interface is defined from the return value (TranslatorSource). The service id is explicitly TranslatorSource (that is, everything after build in the method name). Here, Tapestry has injected into the service builder method. ComponentInstantiatorSource is a service that fires events. ServiceResources is something else: it is a bundle of resources related to the service being constructed ... including the ability to instantiate an object including dependencies. What's great here is that buildTranslatorSource() doesn't need to know what the dependencies of TranslatorSourceImpl are, it can instantiate the class with dependencies using the autobuild() method. The service builder then adds the new service as a listener of the ComponentInstantiatorSource, before returning it. 2009/9/23 cleverpig greatclever...@gmail.com: yes,i'd read it..but i can't get the door to answer... On Wed, Sep 23, 2009 at 9:57 AM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: Em Tue, 22 Sep 2009 21:55:44 -0300, cleverpig greatclever...@gmail.com escreveu: oh,thanks for your reply,Alfonso! just now,i get know i need a slf4j implementation.i found a implementation class from slf4j.jar:org.slf4j.impl.Log4jLoggerAdapter. but how to declare the binding of them? what's need to add in the AppModule? Take a look at http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 -- cleverpig(Dan) Location: Beijing Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China Zipcode: 100031 MSN: great_liu...@hotmail.com QQ: 149291732 Skype: cleverpigatmatrix Facebook ID:cleverpig Blog: www.cleverpig.name Tags: del.icio.us/cleverpig Twitter: twitter.com/cleverpig 新浪微博: t.sina.com.cn/cleverpig Organization: www.beijing-open-party.org or...@facebook: http://www.facebook.com/group.php?gid=8159558294 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org