Re: Contributing a Symbol Provider
Hi Daniel, No, your method is fine. I needed my method as I needed some properties accessible before I could start up the Registry, so this killed two birds with one stone. If you don't need the properties until after building the Registry, then you will be fine with the documented method. Richard On 28 July 2015 at 19:19, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hi, I've implemented a working solution using the method on this page: http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile I implemented a SymbolProvider, a buildFileSymbolProvider method and a contributeSymbolSource method. How is your method different from that one? Should I prefer your method? What will happen when I use my method? Regards, Daniel P. -Ursprüngliche Nachricht- Von: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com] Gesendet: Dienstag, 28. Juli 2015 16:56 An: Tapestry users Betreff: Re: Contributing a Symbol Provider On Tue, 28 Jul 2015 10:31:55 -0300, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello, Hi! I want to provide additional configuration on startup to my Tapestry application. I want to store the additional configuration in a file containing lines key=value. I know I can contribute a symbol provider to load a file and access the symbols this way. But I can't find the documentation for - How to write a Symbol Provider Implement the SymbolProvider interface. It has a single method, String valueForSymbol(String symbolName). It should return a String if that implementation provides a value for that symbol name and null if not. - what method to write in the AppModule to contribute the Symbol Provider public static void contributeSymbolProvider(OrderedConfigurationSymbolProvider configuration) { configuration.add(MyProvider, new YourSymbolProviderImplementation(), before:*); } -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Richard Kirby, Technical Director CAPDM Limited Direct phone: 0131 477 8629 Email: r...@capdm.com Website: www.capdm.com Registered in Scotland: SC168970 VAT: 682 846 983 Registered address: 22 Forth Street, Edinburgh, EH1 3LH, UK
Re: Contributing a Symbol Provider
Hi Daniel, I use the following sort of code: SymbolProvider provider = new MySymbolProvider(File configFile); ContributionDef contribution = new org.apache.tapestry5.internal.SyntheticSymbolSourceContributionDef(MyConfig, provider, before:ApplicationDefaults); ... RegistryBuilder builder = new RegistryBuilder(); builder.add(new org.apache.tapestry5.internal.SyntheticModuleDef(contribution)); Note that I am using 2 internal package classes, so not guaranteed across Tapestry versions, but it does work for me. Richard On 28 July 2015 at 14:31, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello, I want to provide additional configuration on startup to my Tapestry application. I want to store the additional configuration in a file containing lines key=value. I know I can contribute a symbol provider to load a file and access the symbols this way. But I can't find the documentation for - what method to write in the AppModule to contribute the Symbol Provider - How to write a Symbol Provider Can anyone help? Regards, Daniel P. -- Richard Kirby, Technical Director CAPDM Limited Direct phone: 0131 477 8629 Email: r...@capdm.com Website: www.capdm.com Registered in Scotland: SC168970 VAT: 682 846 983 Registered address: 22 Forth Street, Edinburgh, EH1 3LH, UK
Re: tapestry 4 radio group
Hi, Can you say a little more exactly what you are trying to do as your HTML doesn't appear to be correct. The RadioGroup needs to wrap around the Radio buttons at the very least. Richard On 19 Jan 2011, at 19:29, sunray 2003 wrote: Hi, I am unable to get the tapestry 4 radio group working. My HTML tdspan jwcid=activeServerRadioGroup/span/td tdinput type=radio jwcid=activeServerRadio //td My .page property name=activeServer/ component id=activeServerRadioGroup type=RadioGroup binding name=selected value=activeServer.selected/ /component component id=activeServers type=For binding name=source value=activeServers/ binding name=keyExpression value=literal:id/ binding name=value value=activeServer/ binding name=element value=literal:tr/ /component component id=activeServerRadio type=Radio binding name=value value=activeServer.id/ /component In my .java file I have a method getActiveServers() that returns a list of custom class with selected, id attributes. The above structure is not working. Can somebody help? Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Render body of the component in some other component
Yes - that is exactly what @RenderBody does. Cheers Richard Marko Mrkus wrote: Sorry, formatting of the last message was awful... Here's the message again: Hi, all! Can you tell me is it possible to render body of a component in some other component which is wrapped by this first one in Tapestry 4.1? I have an example: Page html: div jwcid=@Component pThis is top level component's body/p /div Component.jwc: div jwcid=$content$ div Haeder /div div jwcid=@For source=ognl:somePropArray value=ognl:currentProp div jwcid=@InnerComponent !-- Inner Component presents the body of the top level component -- pThis is top level component's body/p div /div div Footer /div /div Maybe use of @RenderBody component for @InnerComponent? Thanks for your time, Marko - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Richard Kirby, Technical Director Email: r...@capdm.com Phone: 0131 477 8629 Fax: 0131 477 8621 Email: enquir...@capdm.com Website: www.capdm.com CAPDM Limited Registered in Scotland: SC168970 VAT: 682 846 983 Registered address: 22 Forth Street, Edinburgh, EH1 3LH, UK === - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: PersistentFieldStrategy and conversations
Due to the magic of tapestry IOC, just inject the Request object into your implementation of PersistentFieldStrategy and you have access - no need to change/extend the PersistentFieldStrategy interface! Richard. Kalle Korhonen wrote: I'd like to implement a custom PersistentFieldStrategy for conversations within the same page, but a PersistentFieldStrategy only knows the page name. Currently my conversation id is part of the activation context and I'd somehow need to pass the id on to my custom strategy. Is there a way to do this? If I could obtain the page instance, the request or a filter I could probably work it out. Also, PersistentFieldStrategy only has discardChanges(String pageName) (and Page has discardPersistentFieldChanges() ) which discards all changes, but I'd need it to discard changes for specific conversations only. Should I perhaps open an enhancement request for it? Howard, care to comment? Kalle - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] overriding persistence strategy of all fields to conversation strategy
If you allow for nested conversations, then the session could just be a default conversation that lasts for as long as the session. Inherently then, all subsequent conversations will be encapsulated by this default conversation at the very least - a bit like all objects in Java are java.lang.Object. Nested conversations are useful to allow for short diversions from a main conversation - for example popping up a dictionary dialog when filling in a form. The default session persistence strategy can then be simply replaced with the conversation strategy and assumed to be a default top level conversation. How does that sound? Richard Davor Hrg wrote: sound ok, looking forward to trying it :) Davor Hrg On Dec 21, 2007 10:25 AM, Kristian Marinkovic [EMAIL PROTECTED] wrote: its getting really interesting Josh+Davor: your're right flash should as well be part of the conversation context. a small summary of my implementation so far: if a conversation is started a ConversationContext is created and stored in a ConversationTracker and the created conversation id is appended to the URL. The ConversationTracker itself is then stored as an ASO using the ApplicationStateManager. In implicit mode every field with an @Persist annotation is stored in the ConversationContext (if a conversation is active). ASOs are not part of the conversation because they are considered global, application-wide data objects. I did not replace the Session because it seemed to invasive to me. What do you think about this approach? is it viable? Should some ASOs be marked as part of the conversation? I hope i can make my source available in 3 weeks when i get approval from my superior. btw. i could solve my originally stated question by providing a Decorator for the PersistentFieldManager that intercepts postChange method calls and rerout every persistent field to the ConversationFieldStrategy implementation. just a sidenote... my conversation implementation will then be used for pageflows :) Josh Canfield [EMAIL PROTECTED] Gesendet von: [EMAIL PROTECTED] 21.12.2007 00:43 Bitte antworten an Tapestry users users@tapestry.apache.org An Tapestry users users@tapestry.apache.org Kopie Thema Re: [T5] overriding persistence strategy of all fields to conversation strategy Yeah, I'm not convinced either. Also, ApplicationState for instance should probably be stored outside of the context of a conversation as well... Josh On Dec 20, 2007 2:03 PM, Davor Hrg [EMAIL PROTECTED] wrote: you are right, that is more usefull. instead introducing conversation to field level, it should be set at page/component level. flash is I suppose already session specific and should be also conversation specific, but I'm still not convinced that something should be done to those that explicitly state @Persist(session) Davor Hrg On Dec 20, 2007 7:03 PM, Josh Canfield [EMAIL PROTECTED] wrote: Hello, I think Flash persistence would also want to be in the context of the conversation, otherwise couldn't messages show up in the second window that were intended for the first (perhaps with a slow connection to the server?) Without having spent much time thinking about this (and never having used Seam), it feels like a promising direction would be to redefine what a session means for your application. Tapestry already wraps the javax.servlet.http.HttpSession when it's created in the Request object. Would it make sense to replace that implementation with a ConversationSession that implements the Session interface but compartmentalizes the session by whatever it is that you are using for context? So in http://tapestry.formos.com/nightly/tapestry5/apidocs/src-html/org/apache/tapestry/internal/services/SessionImpl.html http://tapestry.formos.com/nightly/tapestry5/apidocs/src-html/org/apache/tapestry/internal/services/SessionImpl.html#line.29 038public Object getAttribute(String name) 039{ 040return _session.getAttribute(name); 041} becomes 038public Object getAttribute(String name) 039{ 040return _session.getAttribute(_myContextId).get(name); 041} where _myContextId results in a map of context specific attributes... Admittedly I haven't coded anything around this idea so there could be some fatal flaws, I just thought I'd throw it out there. Josh On Dec 20, 2007 12:25 AM, Davor Hrg [EMAIL PROTECTED] wrote: It seems you are trying too hard to fix user mistakes, a developer using the conversation persistence strategy must be aware of it and code accordingly. Forcing a specific persistence strategy can also cause undesired behaviours (for example error messages that use @Persist(flash)) these are just my thoughts on the subject, I
Re: Request Filter with ApplicationStateManager
Hi Peter, My guess is that for a RequestFilter, you need to ensure that your filter is contributed after the default Tap5 filter that wires up the HttpServletRequest object to the Tap5 Request object (which is what is causing the NPE). However, I think on reading the RequestHandler pipeline section of http://tapestry.apache.org/tapestry5/tapestry-core/guide/request.html that this is probably done as the final step in the pipeline (ie the terminator) before passing onto the MasterDispatcher service that processes the Dispatcher pipeline. In other words, you can't do what you want to do. Not done any Tap5 coding yet so I may be wrong but hopefully I have given you a pointer. Cheers Richard Peter Stavrinides wrote: Hi, Perhaps I haven't phrased this question quite right since I didn't get a response... Let me try it again. What I have is two contributions, a RequestFilter and a Dispatcher (the code is just about identicle) both services have a dependancy on the ApplicationStateManager, so I wire it by injecting it via the constructor: //contribution public void contributeMasterDispatcher(OrderedConfigurationDispatcher configuration, @InjectService(AccessController) Dispatcher accessController) { configuration.add(AccessController, accessController, before:PageRender); } //constructor public AccessController(ApplicationStateManager asm){ this.asm_ = asm; } The Dispatcher seems to work perfectly, this simple test: if(asm_.exists(UserAsoObject.class)) returns true/false, my state manager is working, however for the RequestFilter, with virtually identical code, the same test returns a NPE instead. I just wan't to understand where I am going wrong. Thanks again, Peter Peter Stavrinides wrote: Hi All, I can get hold of the ApplicationStateManager using the Dispatcher interface without a problem, however the same code fails using the Tapestry RequestFilter interface? specifically *if(asm_.exists(**UserAsoObject.class)**)) *returns a NPE. Would this be a bug or shouldn't I be using it here in this way? public class AccessController implements RequestFilter { /* Our state manager. */ private ApplicationStateManager asm_; public AccessController(ApplicationStateManager asm){ this.asm_ = asm; } @Override public boolean service(Request request, Response response, RequestHandler handler) throws IOException { *if(asm_.exists(UserAsoObject.class)) {* UserAsoObject userObject = asm_.get(UserAsoObject.class); } return handler.service(request,response); } produced the following stack trace: java.lang.NullPointerException at $Request_116a49796f3.getContextPath($Request_116a49796f3.java) at $Request_116a49796d5.getContextPath($Request_116a49796d5.java) at org.apache.tapestry.internal.services.ClasspathAssetAliasManagerImpl.toClientURL(ClasspathAssetAliasManagerImpl.java:90) at $ClasspathAssetAliasManager_116a4979724.toClientURL($ClasspathAssetAliasManager_116a4979724.java) at org.apache.tapestry.internal.services.ClasspathAssetFactory.buildClientURL(ClasspathAssetFactory.java:84) at org.apache.tapestry.internal.services.ClasspathAssetFactory.clientURL(ClasspathAssetFactory.java:59) at org.apache.tapestry.internal.services.ClasspathAssetFactory.access$000(ClasspathAssetFactory.java:33) at org.apache.tapestry.internal.services.ClasspathAssetFactory$1.toClientURL(ClasspathAssetFactory.java:102) at org.apache.tapestry.internal.services.PageRenderSupportImpl.addStylesheetLink(PageRenderSupportImpl.java:109) at org.apache.tapestry.services.TapestryModule$17.renderMarkup(TapestryModule.java:1322) at $MarkupRenderer_116a4979727.renderMarkup($MarkupRenderer_116a4979727.java) at org.apache.tapestry.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:64) at $PageMarkupRenderer_116a497971d.renderPageMarkup($PageMarkupRenderer_116a497971d.java) at org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:56) at $PageResponseRenderer_116a49796f4.renderPageResponse($PageResponseRenderer_116a49796f4.java) at org.apache.tapestry.internal.services.DefaultRequestExceptionHandler.handleRequestException(DefaultRequestExceptionHandler.java:60) at $RequestExceptionHandler_116a49796e7.handleRequestException($RequestExceptionHandler_116a49796e7.java) at org.apache.tapestry.services.TapestryModule$2.service(TapestryModule.java:536) at $RequestHandler_116a49796ec.service($RequestHandler_116a49796ec.java) at org.apache.tapestry.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:79) at $RequestHandler_116a49796ec.service($RequestHandler_116a49796ec.java) at
Re: T3: session length
Hi James, As the others have said, there is no way with the servlet spec to use the servlet session mechanism in the fashion you want. So, one solution is for you to manage sessions yourself. At the end of the day, all you need to recognise a request from any given browser is a cookie. Long time since I did T3 stuff, but I would suggest you create your own cookie representing a session, and use that as a key to lookup any session data you need, and not use the standard Tapestry session mechanisms that are built ontop of the Java servlet session cookie. Richard James Sherwood wrote: So there is no way to have it last the length of the browser being open? I have seen tricks using JavaScript to contact images and such to keep sessions alive. --James - Original Message - From: Thiago HP [EMAIL PROTECTED] To: Tapestry users users@tapestry.apache.org Sent: Tuesday, December 04, 2007 11:57 AM Subject: Re: T3: session length On 12/4/07, James Sherwood [EMAIL PROTECTED] wrote: What is the downfall to this? Each user session will last forerever even when the user is not using the application, leading to an always increasing server memory usage. Of course you could release the session (session.invalidate()), but I don't think it's your case. Thiago __ NOD32 2701 (20071204) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Richard Kirby Email: [EMAIL PROTECTED] Phone: 0131 477 8629 Fax: 0131 477 8621 Email: [EMAIL PROTECTED] Website: www.capdm.com CAPDM Limited Registered in Scotland: SC168970 VAT: 682 846 983 Registered address: 22 Forth Street, Edinburgh, EH1 3LH, UK === - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T3: session length
Hi James, et al. Opps - I answered the wrong question. As Thiago writes, you would indeed need to use javascript to periodically fetch something from the server, and in particular something that the servlet engine processes, so that it knows to update the last accessed timestamp on its internal HttpSession object mapping to that browser. A simple AJAX call would do well here - just ping a dummy T3 page or something. Alternatively, use a Frame (perhaps a hidden size 0 Frame) with a body reload - which will work even if the browser doesn't support javascript. You can then leave the default servlet timeout for sessions, so that if the browser is closed, the session object will eventually timeout and be GCed. Cheers Richard Thiago HP wrote: On 12/4/07, James Sherwood [EMAIL PROTECTED] wrote: So there is no way to have it last the length of the browser being open? No way unless you use some Javascript hack that keeps requesting something to the server. You must remember the nature of HTTP. The browser connects to the server, receives the answer and the connection is closed. There is nothing like a browser closing event notification sent to the server. Thiago - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: For, Hidden fields, squeezers, etc! How do I use them?
Hi Neo, What you want is: input jwcid=@Hidden value=prop:reportPage / Cheers Richard neo anderson wrote: I plug a @Hidden component in the html page and it exactly produce the input type=hidden ... html tag. Now how can I get hidden value in Java code. The way how I do it is html: input jwcid=[EMAIL PROTECTED] value=true/ java: public abstract String getReportPage(); This doesn't work. I use System.out.println() the value of getReportPage to the console. It always shows 'null' value. What should I do if I want to get the hidden value in html? Thank you. James Carman wrote: It's not an annotation. It's a component. He's talking about using anonymous components: Hi Ted, unfortunately I can't help you with your problem but I have a question myself: | in pageB | i have a @Hidden with foo as value. I have this because I want the | various things in Foo to not be lost while doing stuff in page B. | Now, the set in the foo is used in a @For, and each element in foo is | mapped to a @TextField What is this @Hidden annotation used for/where can I find it? It doesn't seem to belong to Tapestry, does it? Thanks! Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] James Carman, President Carman Consulting, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Richard Kirby Email: [EMAIL PROTECTED] Phone: 0131 477 8629 Fax: 0131 477 8621 Email: [EMAIL PROTECTED] Website: www.capdm.com CAPDM Limited Registered in Scotland: SC168970 VAT: 682 846 983 Registered address: 22 Forth Street, Edinburgh, EH1 3LH, UK === - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Authentication Tapestry 5
Hi Chris, You wrote: manager to retrieve page members marked as state objects with the @ApplicationState annotation. Why? Because an instance of a page class may be accessed simultaneously by many different requests at the same time. In reality the annotation is just an indicator that a page I don't think this is actually correct. Definitely in Tap4 and a quick reading of the lifecycle page for Tap5 suggests that an instance of a page is locked to a request for the duration of that request. This also means it is on a single thread (ie the thread handling the request) for the duration of the request. This is why pages are pooled - because you may need more than one instance of a page to handle simultaneous requests. That is my understanding anyway Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: does T-4.1.* have a COUNT component?
Try condition=ognl:(index % 3) == 0 Richard. Ken nashua wrote: Can anyone explain why this code renders only the true case? It is as if the ELSE does not even work. span jwcid=[EMAIL PROTECTED] source=ognl:collection value=ognl:currentObject index=ognl:index span jwcid=@If condition=(ognl:index % 3)) == 0 tr tdtrue case/td /tr /span span jwcid=@Else tdfalse case/td /span /span If I have a list of elements 9 in length... I should get 3 rows in my table right? Can anyone check this out? Either there is a bug in ELSE component or the condition is bogus to render 3 rows. Thanks in advance. Best regards Ken in nashua From: [EMAIL PROTECTED] To: users@tapestry.apache.org Subject: does T-4.1.* have a COUNT component? Date: Mon, 8 Oct 2007 14:27:29 -0400 Ok I tried a custom Loop hybrid but that failed to do uncoordinated indices between collection and loop. All I want to do is increment a count within the template and act on it when it reaches a certain value and then reset it. IE. render TR tag every 3 iterations of my outer For loop. Does this exist in Tapestry? Best regards Ken in nashua Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. Play Now! _ Peek-a-boo FREE Tricks Treats for You! http://www.reallivemoms.com?ocid=TXT_TAGHMloc=us -- CAPDM Limited Registered in Scotland: SC168970 Registered address: 22 Forth Street, Edinburgh, EH1 3LH Phone: 0131 477 8620 Fax: 0131 477 8621 Email: [EMAIL PROTECTED] Website: www.capdm.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Recursion of components
As Howard has authored - it is Principle 1 of tapestry - see http://tapestry.apache.org/tapestry5/ towards the bottom of the page. Richard. Nick Westgate wrote: There's been plenty of discussion about this in the past, and using blocks from a template is the usual solution, eg: http://www.behindthesite.com/blog/C1931765677/E923478269/index.html I believe the static structure, dynamic behaviour mantra is for the sake of performance, and a fundamental framework design desicion. But if you think it's a bug, log a JIRA. At least one of the new devs might have an opinion about this, but they haven't been on the lists much recently. Cheers, Nick. [EMAIL PROTECTED] wrote: Interesting, I hit this same wall a while ago when trying to render a tree. It seems to be a common occurrence, so supporting it in the framework would be highly desirable. I ended up doing almost all the rendering in Java code, using the template only to hold blocks which I called to render from the Java code. This allowed me to at least specify some blocks of HTML in the template, rather than doing it all in code. Damien I couldn't believe it, so I made an example. And I had to discover that it is true: org.apache.tapestry.ioc.internal.util.TapestryException The template for component example.recursive.components.Node is recursive (contains another direct or indirect reference to component example.recursive.components.Node). This is not supported (components may not contain themselves). I consider this a bug that has to do with the alpha state of T5. Otherwise I have doubts on the usefulness of T5 at all. Todd Orr wrote: I'm also trying to perform this type of recursive structure. I don't agree that this makes anything simpler. Recursion is a powerful and concise tool for these situations. I will say that it is often abused, but this is a perfect use case. A recursive solution to this problem is far simpler and maybe more correct than this iterative approach. First off, the proposed solution requires complicated logic. Fine, it's not rocket science, but the recursive alternative (if there was one in tap) is far easier to read and understand. From a tech-management point of view the simplicity of the code is a major factor in its long term maintainability as well as its bugginess. Secondly, the proposed solution requires adding raw HTML output to code. This may be a more esoteric and arguable point, but Tapestry excels in having a clear and easy to use separation between the view/presentation and the logic components of the application's construction. Again, with regards to maintainability, it is twice as hard to maintain code if the concerns are spread throughout conceptually separate pieces of code. Third, this approach makes it impossible for any node in the tree to contain any non-trivial nested components. I see that you can create links...wow. Kinda limiting if you ask me. This limits the usefulness and extendability of the code. If more complex functionality is required (lets say by a major client or some other critical business need) within this pseudo-recursive implementation it might force the developers to completely switch out frameworks to one more suitable for the job. This is a huge risk from a business perspective. While I think these points are painful enough on their own, it does raise some questions about the framework's usefulness in specific situations. My main concern is in relation to CMS features. Many applications require support for some level of features that would be considered CMS functionality. This static structure imposed makes creating dynamic sites, well, painful. When you are attempting to build an application that must adapt to known types of runtime or user-configuration driven alterations that have many variants during runtime (eg. depth of a tree, etc.) the static structure is limiting. Tapestry is a great framework. However, the intention of the static structure, while clearly advantageous in many respects, limits the use case coverage for the framework at worst and makes certain otherwise easy tasks very difficult at best. Perhaps the rules for the static structure could be allowed to bend from time to time as a nod to those of us that do require greater flexibility. I'm sure this is easier suggested than done, but what are the options? On 7/17/07, Francois Armand [EMAIL PROTECTED] wrote: Dmitry Sidorenko wrote: Hi all. Hi, In my project I need to generate edit form for a class like this: class Section{ ListSection subSectionList; ListField fieldList; } [...] Probably I'm doing something wrong, maybe my task should be done in completely different manner.. Any ideas? Is there any way to develop visual editor for such a recursive classes? I don't know how T4 works, but if it's like in T5, their is no support of recursive template/class. So, for tree structure, you have to use a non-recursive algorithm (I think that in your example, you wish to use a
Re: [t4] How do I inject arbitrary services into a custom service encoder?
Hi Olle, Try encoder id=CurrentFooEncoder object=instance:CurrentFooEncoder,springContext=spring:springContext / Basically the instance: allows for properties to be set using comma separated property=value Hope that works for you Richard Olle Hallin wrote: Hi! I have written a simple (Tapestry4) custom service encoder (CurrentFooEncoder) which works ok for now. It inserts/removes /foo first in the encoding.getServletPath(). It is declared in hivemodule.xml like contribution configuration-id=tapestry.url.ServiceEncoders page-service-encoder id=page extension=html service=page / page-service-encoder id=external extension=ehtml service=external / direct-service-encoder id=direct stateless-extension=direct stateful-extension=sdirect / asset-encoder id=asset path=/assets / extension-encoder id=extension extension=svc after=* / encoder id=CurrentFooEncoder object=instance:CurrentFooEncoder before=* / /contribution Now I wan't my CurrentFooEncoder to do some useful work, for which it needs my Spring context. How do I achieve that? I have already have a HiveMind service-point called SpringContextFactory. I guess that I shall write something magic in the object attribute, but what? Regards, Olle Hallin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Create Shoutcast service in Tapestry.
Hi Hans, The status line is output by the servlet engine - not Tapestry, since it is a core part of the HTTP spec. What you may be able to do, is create a javax.servlet.Filter which reads the response from Tapestry into a stream, hopefully including the status line - and then just re-output but with your new status line. Don't know if that will work though. Richard. Hans Drexler wrote: We try to create a Tapestry-service that generates a Shoutcast stream. The problem is that the shoutcast response must have a status line that reads: ICY 200 OK Instead, the status line we get is always: HTTP/1.1 200 OK Many mediaplayers (WinAmp, Xmms, iTunes) accept the header with HTTP status line, but some do not. The ICY header is incorrect according to RFC 2616 and I have been unable to generate a response with this status line. Does somebody have a clue on how we could spit out a response with the ICY like status line in it? Any help is appreciated. The code we use now is basically like this: private WebResponse _response; [...] private OutputStream initOutputStream(boolean metadata) throws IOException { OutputStream out = _response.getOutputStream(new ContentType(audio/mpeg)); //Spit out Shoutcast-headers. _response.setHeader(icy-notice1,BRThis stream requires a href=\http://www.winamp.com/\;Winamp/aBR); _response.setHeader(icy-notice1,MusiController SHOUTcast-implementationBR); _response.setHeader(icy-name,MusiController); _response.setHeader(icy-genre,All sorts); _response.setHeader(icy-url,http://musicontroller.sourceforge.net;); _response.setHeader(icy-pub,1); _response.setHeader(icy-br,192); if (metadata) _response.setIntHeader(icy-metaint,BUFFER_SIZE); log.debug(Outputstream initialized); return out; } [...] public void setResponse(WebResponse response) { _response = response; } Hans Drexler - 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]
Re: [T4] Adding body of a sub-component w/o using a template
Hi Christian, Assuming your LinkSubmit subcomponent extends the org.apache.tapestry.form.LinkSubmit class, just override the public void renderBody(IMarkupWriter writer, IRequestCycle cycle) method and put in whatever code you like. Cheers Richard Christian Haselbach wrote: On Sun, Mar 04, 2007 at 03:29:04AM +0200, andyhot wrote: You can't dynamically change the component structure Well, I do not really want to change it dynamically, so this is not the problem. Now, i still can't understand your use case, so i can't offer any help there (what's the meaning of influence its body w/o using a template), but Let me refrase this: When using a template I can give a subcomponent a body. How can I do it w/o using a template? I have a LinkSubmit subcomponent, which I want to have render its content with a certain body. While I can define this body using a template, the template looks ugly (in this case, not in general). It is better understandable when written programmatically. perhaps you can build a custom component and pass parameters to it... Sure, but that would be mostly a rewriting of LinkSubmit. I rather hoped I could reuse LinkSubmit. The use case is pretty simple: A specialized LinkSubmit component. Regards, Christian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Trying to use StateObjectFactory...
Hi Alexander, You need to define a service that you then reference in the invoke-factory: service-point id=SecurityBeanFactory interface=org.apache.tapestry.engine.state.StateObjectFactory invoke-factory construct class=com.test.util.SecurityBeanFactory !-- Any config you need here... -- /construct /invoke-factory /service-point contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session. invoke-factory object=service:SecurityBeanFactory / /state-object /contribution Cheers Richard Kolesnikov, Alexander GNI wrote: Hello everyone, I am using Tapestry 4.0.2. I want to use an ASO with some security information in it. The information should be obtained from HttpRequest on the ASO's creation. I decided to use a StateObjectFactory to create such an ASO and configured it like this: contribution configuration-id=tapestry.state.ApplicationObjects state-object name=security scope=session invoke-factory object=com.test.util.SecurityBeanFactory/ /state-object /contribution Then I am trying to obtain the ASO in the page's code like this: @InjectState(security) public abstract SecurityBean getSecurity(); The code for the factory was more sensible, but to find a problem I left just this: public class SecureBeanFactory implements StateObjectFactory { public Object createStateObject() { SecurityBean sb = new SecurityBean(new TestUser(), new TestApplication()); return sb; } } However, I am getting an exception: org.apache.hivemind.ApplicationRuntimeException Unable to construct configuration tapestry.state.ApplicationObjects: Error: Object provider selector 'com.test.util.SecurityBeanFactory' is not properly formatted. What can be wrong here? Thanks, Alexander -- CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify the sender by e-mail at the address shown. This email transmission may contain confidential information. This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly. Please delete it from your files if you are not the intended recipient. Thank you for your compliance. Copyright 2007 CIGNA == - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ASO Injection Question
Hi Peter, One way of doing this is to access the HiveMind Registry object that Tapestry creates, from within your listener class, so that you can then access the ApplicationStateManager, and from that access your ASO. However, you have to use a little magic to access the Registry object: 1. From the sessionCreated/sessionDestroyed method you have access to the HttpSessionEvent object. 2. From the HttpSessionEvent object you have access to the HttpSession object. 3. From the HttpSession object you have access to the ServletContext 4. From the ServletContext object you can look up the HiveMind Registry using the getAttribute method with the key org.apache.tapestry.Registry:SERVLET_NAME where SERVLET_NAME is the name of the Tapestry application servlet you have specified in your web.xml (this is the magic bit since it requires knowing how Tapestry squirrels away the Registry object). 5. You can then get the ApplicationStateManager object from the Registry, and finally your ASO. Hope that helps Richard. Peter Stavrinides wrote: What is the best approach for the following scenario: I have a listener class that listens for session activity, its configured only in my web.xml (not for instance in hivemind) I have a state object that I need to inject into the listener class, but since I cannot make the listener class abstract how will I inject my state object? or what can I do otherwise? Thanks Peter - 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]
Re: ASO Injection Question
Hi Peter, State objects are not the same as HiveMind services. So reg.getService will return a service you have defined with service-point / in a hivemodule.xml. However these are typically equivalent to singletons and therefore shared across all sessions. A state object is managed by the ApplicationStateManager and can be either a global object (in many ways a HiveMind service is equivalent), or a session object which is per user web session. Note that you only need to get the ApplicationStateManager object once (use lazy initialization), as it will last for the lifetime of the web application, so something like: class MySessionListener implements HttpSessionListener { private ApplicationStateManager asm; public void sessionCreated(HttpSessionEvent event) { if (asm == null) { Registry reg = (Registry)event.getSession().getServletContext().getAttribute(org.apache.tapestry.Registry:IRM); asm = (ApplicationStateManager)reg.getService(ApplicationStateManager.class); } Visit visit = (Visit)asm.get(visit); // do stuff } } Cheers Richard Peter Stavrinides wrote: Thanks Richard, this is truly a bit of magic, one question though regarding the last step: Is there any reason why I would need to use the ApplicationStateManager object, can I rather access a service directly using getService() ? For instance, I get the registry like so: Registry reg = (Registry) event.getSession().getServletContext().getAttribute(org.apache.tapestry.Registry:IRM); //where IRM is the name of the servlet and then use something like: reg.getService(Visit.class); Thanks again, Peter Richard Kirby wrote: Hi Peter, One way of doing this is to access the HiveMind Registry object that Tapestry creates, from within your listener class, so that you can then access the ApplicationStateManager, and from that access your ASO. However, you have to use a little magic to access the Registry object: 1. From the sessionCreated/sessionDestroyed method you have access to the HttpSessionEvent object. 2. From the HttpSessionEvent object you have access to the HttpSession object. 3. From the HttpSession object you have access to the ServletContext 4. From the ServletContext object you can look up the HiveMind Registry using the getAttribute method with the key org.apache.tapestry.Registry:SERVLET_NAME where SERVLET_NAME is the name of the Tapestry application servlet you have specified in your web.xml (this is the magic bit since it requires knowing how Tapestry squirrels away the Registry object). 5. You can then get the ApplicationStateManager object from the Registry, and finally your ASO. Hope that helps Richard. Peter Stavrinides wrote: What is the best approach for the following scenario: I have a listener class that listens for session activity, its configured only in my web.xml (not for instance in hivemind) I have a state object that I need to inject into the listener class, but since I cannot make the listener class abstract how will I inject my state object? or what can I do otherwise? Thanks Peter - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Retrieving Tapestry 4 components from outside Tapestry
Hi Dan, Conceptually, component instances do not exist outside of pages. This is just how Tapestry works. If you want to access your component, you will need to place it on a dummy page and access it via that page as you suspect. Is there any particular reason why you don't want a dummy page? Cheers Richard Dan Williams wrote: Hi, Thanks for responding! That's true, but my component is not part of any page - just an isolated component. In my original post I used the example of a page (instead of a component) to highlight how easy it is to do this if your 'component' is a page. But if your component is an actual component - and not injected into any page - retrieving it in a non-tapestry class becomes problematic. I'm a little confused (and still convinced I'm missing something obvious!) since I have understood throughout using Tapestry that everything is a component (including pages), which makes it confusing why pages are so easy to retrieve this way (via the requestcycle as you pointed out), but Components are not. Regards, Dan - 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]
Re: Urgent! How to remove base href generation?
Add renderBaseTag=false to your @Shell component. Richard. Vjeran Marcinko wrote: Hello. I hate this kind of situations where I need urgently to do something that I haven't done before, and I cannot find documentation on how to do it either. Anyway, Tapestry 4.0.2 generates base href= as HTML headers, making me problems with accessing my application through some virtual host which has been mapped to my tomcat server containing Tapestry app. Generated base href forces all URLs having start with my internally known server name, and not by URL which was application accessed by. :-( How can I resolve this situation? I would like that all generated URLs are relative to the one that user entered in his browser, which is normal if there is no base href=... tag. Regards, Vjeran - 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]
Re: ASO class not instantiated
Hi Borut State objects are not instantiated until they are first accessed. You need an @InjectState(manager) in, for example, a page. Cheers Richard Borut Bolčina wrote: Why on earth is my ASO ?xml version=1.0? module id=com.mycompany.posting.application version=1.0.0 contribution configuration-id=tapestry.state.ApplicationObjects state-object name=manager scope=application create-instance class= com.mycompany.posting.application.Manager/ /state-object /contribution /module not instantiated? package com.mycompany.posting.application; import org.apache.log4j.Logger; public class Manager { /** * Logger for this class */ private static final Logger logger = Logger.getLogger(Manager.class); public Manager() { System.out.println(Manager); logger.info(Manager start); } } I tried putting hivemodule in several locations, restarting Tomcat each time. I use Eclipse 3.2, WTP 1.5, Tapestry 4.0.2, Hivemind 1.1.1. The web context content looks ok to me. I had this working several months ago with previous t4 web app, that is why I am a bit confused - I don't have many mileage on T4. Any suggestions where to look for any misconfiguration? Found no clue in archives and doc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Element type context-asset must be declared.
Hi Rui, Try asset name=next path=context:images/go-next.png / Cheers Richard. Rui Pacheco wrote: Hi all I am declaring two images as assets in my .page file. I am using Tapestry 4.0, but used the examples that come with Spindle to do this, as I couldn't find any other. While navigation my app, when I reach that page, I get the error: Element type context-asset must be declared. This is my .page file: ?xml version=1.0? !DOCTYPE page-specification PUBLIC -//Apache Software Foundation//Tapestry Specification 4.0//EN http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd; page-specification class= pt.textoeditores.universal.agc.pages.homepage.HomepageEdit context-asset name=next path=images/go-next.png/ context-asset name=previous path=images/go-previous.png/ /page-specification What could be causing this? I believe I am doing everything correctly. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Theoretical question: Differences and similarities between page and hivemind service.
Hi Aleksej, See http://wiki.apache.org/tapestry/Tapestry5Roadmap - this is coming in Tapestry 5, although that is definitely a ways off. Cheers Richard Aleksej wrote: Thats not only about services auto-wiring. Having page as a service allows to get rid of BasePage ( BaseComponent ) hierarchy. I am sure that there are lots of people ( including tapestry developers ) who wanted to see pages as a POJO's . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: New Window issue
Hi Rodrigo, What you will need to do is ensure that caching is disabled for the pages that use this key idea. Then CTRL-N or File | New Window should cause the browser to refresh from the server - they will request the same url as the original page, so that allows you to detect that a new key is needed. Search the mailing list/wiki for tips on turning off browser caching (basically a delegate to your Shell component that sends the appropriate headers to tell the browsers not to cache the page). For you example, the search page should basically always generate a new key, whilst the results page will just pass back the key. This should then mean that everytime a browser goes to the search page, because it is not cached it will poke the server which will then return a new search page with a new key, and you should then be sorted! Cheers Richard Rodrigo Barberá wrote: Hi Richard! Thank you for your reply. It sounds like a very good solution to my problem. However, I can't find out a way to generate a new key when the user hits CTRL-N or clicks 'File | New Window' and a new window is open. Any ideas? Thanks a lot in advance! Rodrigo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: New Window issue
Hi Rodrigo again, Umm, actually you should just need to generate a new key each time the search form is submitted for a new search. Cheers Richard Richard Kirby wrote: Hi Rodrigo, What you will need to do is ensure that caching is disabled for the pages that use this key idea. Then CTRL-N or File | New Window should cause the browser to refresh from the server - they will request the same url as the original page, so that allows you to detect that a new key is needed. Search the mailing list/wiki for tips on turning off browser caching (basically a delegate to your Shell component that sends the appropriate headers to tell the browsers not to cache the page). For you example, the search page should basically always generate a new key, whilst the results page will just pass back the key. This should then mean that everytime a browser goes to the search page, because it is not cached it will poke the server which will then return a new search page with a new key, and you should then be sorted! Cheers Richard Rodrigo Barberá wrote: Hi Richard! Thank you for your reply. It sounds like a very good solution to my problem. However, I can't find out a way to generate a new key when the user hits CTRL-N or clicks 'File | New Window' and a new window is open. Any ideas? Thanks a lot in advance! Rodrigo - 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]