Suggestion: Dispatcher interface should have return values as public constants
After writing yet another Dispatcher, I've come to think that the Dispatcher interface should have return values as public constants. The trouble is one of readability, and quite minor, but worse when there is a bunch of return statements, or when reviewing a long dispatcher (when you come to the end of the function, and have to reason... now, is true or false the correct return value?). Basically, I would change this: 028public interface Dispatcher 029{ 036boolean dispatch(Request request, Response response) throws IOException; 037} To this: public interface Dispatcher { boolean dispatch(Request request, Response response) throws IOException; public static final boolean HANDLED =true; public static final boolean CONTINUE=false; } Which would let someone write return HANDLED; because the constants come with the interface. It's easy enough to add these constants in every dispatcher, but unlike other (more errant) uses of interface constants that I've seen, this seems to me to be very relevant to the contract of the interface; and it could serve to make dispatchers more readable. I don't think that Java inlines final constants anymore, so there could be a trivial performance penalty. Just a thought... very low-impact on my side. -- Robert Hailey
Re: T5.3 - Localization is only partially implemented?
On 2014/05/20 (May), at 4:54 PM, Kalle Korhonen wrote: I don't know if there's an existing issue around this. Take a look and open a new one if no existing issues are found. Should be straightforward to get it fixed. Kalle Filed: https://issues.apache.org/jira/browse/TAP5-2346 -- Robert Hailey
Re: Suggestion: Dispatcher interface should have return values as public constants
On 2014/06/04 (Jun), at 12:51 PM, Thiago H de Paula Figueiredo wrote: I like this suggestion. :) Could you file a JIRA please? Filed: https://issues.apache.org/jira/browse/TAP5-2347 -- Robert Hailey - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5.3 - Localization is only partially implemented?
As far as I can tell from reading the code, there is what seems to be a pretty big hole in Tapestry's handling of localization. Suppose I have set these as my supported locales: en,fr,de ...and further suppose that a request comes in with this accept-language header klingon,de,fr The code seems to only operate on request.getLocale() [which is to say, klingon], which it does not support, and falls back to en (the only incorrect choice, in this case). This seems easy enough to fix, but quite strange... is this intentional? an oversight? is there some magic somewhere else that makes this actually work? RootPathDispatcher.java: localizationSetter.setNonPeristentLocaleFromLocaleName(request.getLocale().toString()); ComponentEventLinkEncoderImpl.java: Locale locale = request.getLocale(); localizationSetter.setNonPeristentLocaleFromLocaleName(locale.toString()); If this is a known issue, I would be very interested in any patches that have already been developed for this, or any relevant message thread links/titles (couldn't easily find any). -- Robert Hailey
T5.3 - Per-page custom localization axis
Greetings, I've been looking deep into Tapestry's localization mechanisms, especially with regards to skinning. What I'm looking for now, is an easier (automatic) way to set the selector per-request ahead of time via the passivate functions. Sorta like this: @LocaleAxis public enum MyAxis { alpha, beta } public class MyPage { @LocaleAxis private MyAxis myAxis; } Before I started digging coding, I thought I might ask if: (1) someone could verify that this is feasible, (2) someone could point out the classes needing to be modified, or even if (3) someone more familiar might want to tackle this? :) -- Robert Hailey smime.p7s Description: S/MIME cryptographic signature
T5.3 - What's the easiest way to detect the current request type?
Greetings, I've run into a case where I must be able to tell if the current request is a page-render request, or component-event request from within an onActivate() function. Is there a common/easy/concise way to do this? Something like: public class MyPage { @Inject private Request request; void onActivate() { prequel(); //NB: none of these work :) if (request instanceof PageRenderRequest) { doSomething(); } //NB: or maybe... if (request.isComponentEventRequest()) { doSomethingElse(); } sequel(); } } It would be a lot of work to reorganize the code around the setupRender() function, so I'd much rather a simple test. Does anyone know how this can be done? -- Robert Hailey
Re: Pro / Contra: Splitting The Project
The way it usually goes is a three-way split... A B (the logical split), and C (which A B both depend on). -- Robert Hailey On 2013/10/11 (Oct), at 2:44 PM, Jon Williams wrote: yes i do that. pretty standard i think. Cheers Jon On Fri, Oct 11, 2013 at 1:30 PM, Martin Kersten martin.kersten...@gmail.com wrote: Hi, I am sitting in front of 1.5 MB of sources and I think about splitting the project in half. One for the services + entities + utilities the rest for the web fun. It would also allow to test the core only with unit test and barely with integration tests. Where the web part might be all about integration + acceptance testing. But I am in doubt. the only gain I would have is half the packages at once, and some separation and shift in thinking. Does anyone split projects in core vs web? What is the point in doing so and why not? Cheers, Martin (Kersten), Köthen smime.p7s Description: S/MIME cryptographic signature
[T5.3] Completely Disabling Tapestry Sessions
Greetings, all! I've nearly completed a really small service, and (as far as I know and have written) it does not use session persistence in any way. Contrawise, I notice in testing that the JSESSIONID cookie is *still* being sent to the browser under normal operations. Is there some way (outside of the containers configuration) that I can disable sessions altogether? I notice, for example, that there is a ClusteredSessionImpl... can I easily swap-in a NullSessionImpl ??? Thanks in advance! -- Robert Hailey smime.p7s Description: S/MIME cryptographic signature
Re: [5.3.6] Services shutdown order
Have you tried something like this (attached)? -- Robert Hailey WARNING: Quick hack, totally untested, absolutely no warranty. OrderedShutdownHubImpl.java Description: Binary data On 2013/04/04 (Apr), at 5:01 PM, Muhammad Gelbana wrote: I've raised the question before but I've reached a point where I must resolve this. Since the RegistryShutdownHub doesn't offer ordering to call registered will-shutdown/shutdown listeners, has anyone managed to order the shutdown process of his application ? I need to shutdown my services before destroying the database connection. Thank you. smime.p7s Description: S/MIME cryptographic signature
Re: deployment of images
On 2013/02/20 (Feb), at 8:32 PM, Ken in Nashua wrote: In the component directory I also put my button images for the component. Ordinarily, the images would go along with the context path rather than the class/java/tml files. For example, if I am building a component here: src/main/java/my/package/name/components/Widget.java ...then it will probably have these paths for strings and template: src/main/resources/my/package/name/components/Widget.properties src/main/resources/my/package/name/components/Widget.tml ...but *images* would go here: src/main/webapp/images/widget_bit1.png ...and then I reference it like: ${context:images/widget_bit1.png} There is probably a way to use images from the same path as the template/properties path, but I use the scheme outlined above. kinda fooled since it all ran fine with jetty within eclipse development mode In development mode, jetty is reading the classes straight from the compilation target directory, so I can kinda see how the classpath would allow for the image to be referenced one way and not the other, but I think it would take some customizing of the maven build file to get where you are at now. Is there a canonical automatic way to efficiently handle component images without haveing to be hassled with configuring and copying ? I think you would be interested in this reference: http://tapestry.apache.org/assets.html I wish I could just run maven and everything be ok where it sits. That's what I do, so I know it's possible. -- Robert Hailey
T5.3: what's the correct usage of PerThreadValue
I've read the everyone out of the pool blog post, but have not been able to find an example of how to best use per-thread value on a page or service (seems like what's provided is an internal tapestry case). As a (lazy?) tapestry developer, my first thought is to try this: @Inject private PerThreadValueInteger widgetRenderCount; Which probably isn't the expected use-case, because it doesn't work: no service implements PerThreadValue interface (or thereabout) I then though I was probably looking one abstraction layer too deep (as the article does talk about transparent perthread access)... so then I thought of this: @Inject @PerThread private Integer widgetRenderCount; Which made a degree of sense because Persist is deprecated, but no such annotation exists. So then I thought I could create my own perthreadvalue-providing service (to realize the first example) like this: public void contributeMasterObjectProvider( OrderedConfigurationObjectProvider configuration, final PerthreadManager perthreadManager ) { configuration.add(PerThreadValue, new ObjectProvider() { public T T provide(ClassT tClass, AnnotationProvider annotationProvider, ObjectLocator objectLocator) { return (T)perthreadManager.createValue(); } }); } ... but that fails due to the MasterObjectProvider somehow depends on itself error message and what's probably a blindingly-obvious lack of knowledge on my part concerning how tapestry actually provides virtually interfaced objects. So now I have fallen back to patterns like this, that seem to work, but seem to be much clunkier than I would expect: @Inject private PerThreadManager perThreadManager; private static PerThreadValueInteger widgetRenderCount; void afterRender() { if (widgetRenderCount==null) { widgetRenderCount=perthreadManager.createValue(); } int count=widgetRenderCount.get(0); count++; log.debug({} widgets have now rendered in this request!, count); widgetRenderCount.set(count); } Am I missing something? If so, how is PerThreadValue intended to be used? -- Robert Hailey
Re: T5.3: what's the correct usage of PerThreadValue
Unless I'm mistaken (which is possible), tapestry will create two distinct components when building the component trees, and they will not have access to the same variable. So a template like: html ... t:widget/ t:widget/ t:widget/ /html Would yield three log messages of rendered 1 time. -- Robert Hailey On 2012/11/28 (Nov), at 5:08 PM, Josh Canfield wrote: Hi Robert. Are you looking for a reason to use PreThreadValue? Or do you just want to have a page/component level property that you can access for the life of the request? In a page or component you just declare the variable and let tapestry do it's magic in the background. private int widgetRenderCount = 0; void afterRender() { ++widgetRenderCount; log.debug({} widgets have now rendered in this request!, count); } If you want to use it in a singleton service then you need to do the plumbing. Josh On Wed, Nov 28, 2012 at 2:32 PM, Robert Hailey rhai...@allogy.com wrote: I've read the everyone out of the pool blog post, but have not been able to find an example of how to best use per-thread value on a page or service (seems like what's provided is an internal tapestry case). As a (lazy?) tapestry developer, my first thought is to try this: @Inject private PerThreadValueInteger widgetRenderCount; Which probably isn't the expected use-case, because it doesn't work: no service implements PerThreadValue interface (or thereabout) I then though I was probably looking one abstraction layer too deep (as the article does talk about transparent perthread access)... so then I thought of this: @Inject @PerThread private Integer widgetRenderCount; Which made a degree of sense because Persist is deprecated, but no such annotation exists. So then I thought I could create my own perthreadvalue-providing service (to realize the first example) like this: public void contributeMasterObjectProvider( OrderedConfigurationObjectProvider configuration, final PerthreadManager perthreadManager ) { configuration.add(PerThreadValue, new ObjectProvider() { public T T provide(ClassT tClass, AnnotationProvider annotationProvider, ObjectLocator objectLocator) { return (T)perthreadManager.createValue(); } }); } ... but that fails due to the MasterObjectProvider somehow depends on itself error message and what's probably a blindingly-obvious lack of knowledge on my part concerning how tapestry actually provides virtually interfaced objects. So now I have fallen back to patterns like this, that seem to work, but seem to be much clunkier than I would expect: @Inject private PerThreadManager perThreadManager; private static PerThreadValueInteger widgetRenderCount; void afterRender() { if (widgetRenderCount==null) { widgetRenderCount=perthreadManager.createValue(); } int count=widgetRenderCount.get(0); count++; log.debug({} widgets have now rendered in this request!, count); widgetRenderCount.set(count); } Am I missing something? If so, how is PerThreadValue intended to be used? -- Robert Hailey
T5.1: Construction of service 'Alias' has failed due to recursion
I've run into an odd problem which does not occur in my test environment. I think the tapestry-hibernate module is trying to take responsibility of the java.util.Collection injected parameter... Operations trace: [ 1] Realizing service ServletApplicationInitializer [ 2] Invoking org .apache .tapestry5 .services.TapestryModule.buildServletApplicationInitializer(Logger, List, ApplicationInitializer) (at TapestryModule.java:1247) [ 3] Constructing module class org.apache.tapestry5.services.TapestryModule [ 4] Determining injection value for parameter #1 (org.apache.tapestry5.ioc.services.PipelineBuilder) [ 5] Resolving object of type org.apache.tapestry5.ioc.services.PipelineBuilder using MasterObjectProvider [ 6] Realizing service Alias [ 7] Invoking org.apache.tapestry5.services.TapestryModule.buildAlias(Logger, String, AliasManager, Collection) (at TapestryModule.java:325) [ 8] Determining injection value for parameter #4 (java.util.Collection) [ 9] Collecting unordered configuration for service Alias [10] Invoking method org .apache .tapestry5.hibernate.HibernateModule.contributeAlias(Configuration, Session) (at HibernateModule.java:68). [11] Determining injection value for parameter #2 (org.hibernate.Session) [12] Resolving object of type org.hibernate.Session using MasterObjectProvider [13] Realizing service Alias java.lang.IllegalStateException: Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry5.services.TapestryModule.buildAlias(Logger, String, AliasManager, Collection) (at TapestryModule.java:325) for references to another service that is itself dependent on service 'Alias'. at org .apache .tapestry5 .ioc .internal .RecursiveServiceCreationCheckWrapper .createObject(RecursiveServiceCreationCheckWrapper.java:52) at org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator $1.invoke(OperationTrackingObjectCreator.java:45) at org .apache .tapestry5 .ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) tapestry-5.1.0.5 The tapestry-hibernate modules are specified via a system preference rather than the standard jar/manifest mechanism, but I don't see how that would effect the ioc initialization, any ideas? -- Robert Hailey
Re: BUG: T5.1/IOC: dropped exception
On Jun 18, 2010, at 5:27 PM, Thiago H. de Paula Figueiredo wrote: On Fri, 18 Jun 2010 19:11:02 -0300, Robert Hailey rob...@cmediacorp.com wrote: org.apache.tapestry5.ioc.RegistryBuilder.java around line #153 author intends to set exception as cause but feeds it into format arguments Please post it in JIRA, as it's the right place to file bugs. Ok, I'll try and remember to do it Monday. I was thinking that someone on the list would have commit access, and that creating a jira account ( posting a patch having someone get back to it, etc) is a lot of overhead for what amounts to moving a parenthesis. -- Robert Hailey - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5.1: No service implements the interface HibernateSessionManager
I'm running an experiment with classpaths classloaders. Although my conventional tapestry setup works well, I'm getting this exception in my test and would like to understand it's cause. java.lang.RuntimeException: No service implements the interface org.apache.tapestry5.hibernate.HibernateSessionManager. at org .apache .tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:560) at org .apache .tapestry5 .ioc.internal.ObjectLocatorImpl.getService(ObjectLocatorImpl.java:44) at org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl $1.invoke(MasterObjectProviderImpl.java:56) at org .apache .tapestry5 .ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68) ... 92 more From my own experience reading up on this exception on the lists, I gather that there is an issue with finding the tapestry-hibernate (or hibernate) classes at runtime because they have not registered themselves in the ioc registry. Is this correct? If so, how does a service technically get into the registry? b/c the initial startup appears to work (and lists application-specific services!). If not, what makes HibernateSessionManager different from tapestry's built-in services or those of the web-app? -- Robert Hailey
Re: T5.1: No service implements the interface HibernateSessionManager
I've been reading up a bit on tapestry-ioc... http://tapestry.apache.org/tapestry5/tapestry-ioc/run.html On Jun 18, 2010, at 2:29 PM, Thiago H. de Paula Figueiredo wrote: On Fri, 18 Jun 2010 16:13:49 -0300, Robert Hailey rob...@cmediacorp.com wrote: From my own experience reading up on this exception on the lists, I gather that there is an issue with finding the tapestry-hibernate (or hibernate) classes at runtime because they have not registered themselves in the ioc registry. Is this correct? I wouldn't put it that way. I'd say that, for some reason, the HibernateSessionManager service wasn't defined. Sounds right. If so, how does a service technically get into the registry? b/c the initial startup appears to work (and lists application-specific services!). If not, what makes HibernateSessionManager different from tapestry's built-in services or those of the web-app? It comes from a different source (another JAR), nothing beyond that. Really? Surely there is a difference somewhere! Here is my (basic) understanding so far: tapestry-filter: creates a ioc-registry (it already contains the base-ioc services) it adds the tapestry services it adds (or knows-the-path-to) the services from app.services.* it adds my AppModule () I suspect it is a jar-finding issue, quoting from ioc documentation... Building the Default Registry The default registry is available by invoking the static method IOCUtilities.buildDefaultRegistry(). This method builds a Registry using autoloading logic, where modules to load are identified via a JAR Manifest entry. In addition, the JVM system property tapestry.modules (if specified) is a list of additional module classes to load. This is often used in development, where tests may be executed against the local classes, not JARs, and so there no manifest to read. So is it the case that tapestry-hibernate-*.jar presence in the web- app folder is what ultimately prompts it's registration? -- Robert Hailey -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5.1: No service implements the interface HibernateSessionManager
On Jun 18, 2010, at 3:06 PM, Thiago H. de Paula Figueiredo wrote: On Fri, 18 Jun 2010 16:49:46 -0300, Robert Hailey rob...@cmediacorp.com wrote: So is it the case that tapestry-hibernate-*.jar presence in the web- app folder is what ultimately prompts it's registration? Yes. The same happens to any JAR in the classpath, as long as it has the correct entries in their manifest files. I see, and once a registry is built it is not possible to add to it. Is a way for one tapestry module to pragmatically require another (at registry-build-time) such as providing a class name/instance? -- Robert Hailey - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
BUG: T5.1/IOC: dropped exception
org.apache.tapestry5.ioc.RegistryBuilder.javaaround line #153author intends to set exception as cause but feeds it into format arguments--Robert Hailey dropped_exception.patch Description: Binary data
Re: Strategies for the initial page
On May 19, 2010, at 9:30 AM, oskar_a wrote: Hi, I'm developing an application with T5 (Tomcat, Hibernate+MySQl). And I'm looking for a solution for the initial page. The user shold see the initial page at the first start of the application. On this page he have to create an admin (of the web appication) and set default values. So this is a essential step for the running of the application but I need this only single time (after the application start), so it's not really make sense to implement this on my index page (and connect every time to the database and look if there is an admin defined). You are quite right. Most likely you will have the start page's activation logic detect a new install (e.g. no users defined?) and redirect to another page which has the initial setup procedure. By laying out (approximately) one high-level function per page, Tapestry lets you better organize your app. As an aside, a slightly better solution might be to have a default user which is in the initial database. Then a freshly setup app is less vulnerable to a random person/bot finding it before it can be properly setup. -- Robert Hailey - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5.1: Using templates to generate html email
I'd like to have my tapestry web-app generate emails on particular actions. I've seen various methods of using tapestry 3 4 to send an email, but have not found a good recipe for tapestry 5. Is there a way (for example) to deliver a different markup writer to a page's component, which can then be dumped into an email? -- Robert Hailey - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [Tapestry Central] Git Svn : Not Always A Match Made In Heaven
On Apr 19, 2010, at 8:57 AM, Howard wrote: Apache is stuck using Subversion ... Looks like you've already identified the root problem :) Committed r935569 W: 86533530aac8673a9e107e323de5201b7187270f and refs/remotes/origin/trunk differ, using rebase: :04 04 9c78596ee3f916f012c51d8927b4aa31d497f17b 8eb2b9b4f28e825e223c736eaa664bb53018258e M tapestry-core Current branch trunk is up to date. # of revisions changed before: 07b37e03cbc17012247d2221e795023c564d8228 0830b5f383dc94ae16088185efefac2e1358cf30 [...] 79dcfa32b291454bf9c652d635374d60638b8fb8 304d12f9d7d040f4dc231d213df663fcdf3863b6 0d626a7b0648735ab83bc7a2fd241390eb92e4e2 after: 86533530aac8673a9e107e323de5201b7187270f [...] 304d12f9d7d040f4dc231d213df663fcdf3863b6 0d626a7b0648735ab83bc7a2fd241390eb92e4e2 If you are attempting to commit merges, try running: git rebase --interactive --preserve-merges refs/remotes/origin/trunk Before dcommitting ~/work/t5-project $ Is the output really this garbled? It looks like it's dumping a list of commits when trying to simply get a count. At this point I would first check which version of git you are using. I did the right things; git co trunk followed by git svn rebase, then git rebase revised-assets-12apr2010. Without actually having used git with svn, I would bet that the order here is wrong. Whatever work git svn rebase has done to line up the git commits with the svn commits would be re-done by the second normal rebase. For the second command, perhaps try a 'merge' rather than a 'rebase'. It claimed to replay my branch changes on top of the trunk branch, but regardless, the dcommit failed. Doing some hunting around with Google, I found a partial explanation, that at least gives me a way forward. I'd still like to know how I got into this predicament. At this point I just keep blindly entering the command: git reset --hard 705ccfb1e27d303a9db62de755b2fcfcca9a02f6 ; git svn rebase; git svn dcommit and get one Git commit further each time (that's the Git hash code for my final change in my original branch). Joy. Well... I suppose at worst you could make a quick shell script to repeat that until the head matches the expected value. If you do not have a git branch visualizer (like gitx / gitk), I recommend you get one. You may find that the hash you are reseting to is not from the branch you expect (or that svn expects). -- Robert Hailey - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
How to change the clientId for AbstractField parent class
I'd like to pragmatically change the super-class's field 'clientId' so that I can get a good string value coming into processSubmission. However... AbstractField.getClientId() is final and cannot be overridden. Rather than re-writing (or copy/pasting) AbstractField to simply provide a setClientId() method or make getClientId() non-final, I thought I might try something a bit hackish. I've tried getting a propertyconduit (but it complains the field is readonly; as it is bound to 'componentResources.id'). I would like to try a ParameterAccess but I cannot seem to get a handle on one from inside the component (which currently extends AbstractField). Is this what createDefaultParameterBinding() is meant for? I can't seem to figure that one out. Is there a better way to do this? Tapestry can write to the field, so I know that it is possible in theory. -- Robert Hailey tapestry 5.1.0.5 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How to change the clientId for AbstractField parent class
On Apr 14, 2010, at 4:36 PM, Thiago H. de Paula Figueiredo wrote: On Wed, 14 Apr 2010 18:32:39 -0300, Robert Hailey rob...@cmediacorp.com wrote: I'd like to pragmatically change the super-class's field 'clientId' so that I can get a good string value coming into processSubmission. What exactly are you trying to implement? Well... it's a conglomerate field which is backed by a hibernate pojo and represents a date range (so it contains two dateFields). So I'd like to be able to render it as: t:dateRangeField value=dbPojo/ At present I just copied/modified AbstractField to get setClientId access, and it mostly works. It looks like tapestry now and then does not initialize one of the injected parameters during the processSubmission time, though. Since my client id is derived from the hibernate id, I can easily reload it (it's just a bit kludge-ish). -- Robert Hailey
Modifying the title in a layout component
I'm using 5.1.0.5 and thought I could do something like this... [Page.tml] html t:type=layout xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd head t:type=header titleMy Page Title/title /head body t:type=passthru h1My Page Content/h1 /body /html The 'passthru' component was easy to make, but apparently the t:extension-point works much more logically than I was expecting, re- rendering it's parent template. :) [Header.tml] t:extend xmlns:t=http://tapestry.apache.org/schema/ tapestry_5_1_0.xsd t:replace id=headerExtensionPoint t:body/ /t:replace /t:extend So my question is this, is there a component whose body can be swapped out based on the presence of another component in the tree? Is it possible to write one? It would be a shame to sacrifice the WYSIWYG elegance just for the page title... I suppose this is the way it is normally done: http://code.google.com/p/shams/wiki/Component -- Robert Hailey
Re: exception page debug
Perhaps you have injected a service before the exception handler/filter? -- Robert Hailey On Mar 15, 2010, at 11:17 AM, Yury Luneff wrote: I have already raised this question some time ago, but we still did not overcome our situation. It is frequent in our project that when a exception page should be shown, we have completely null response (no data at all). And often even no log messages in log4j with stacktrace. At a glance, I've thought this is a spring-security integration problem (and it seemed logical), but even turning off all its filters does not help. So now if I forget to put private for a field, I have null response and I should guess what is the problem. What can I do in my situation? I can provide any information about my environment and code. Please, god, send me a geek that likes puzzles :-) - 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
Cannot create 'form' component / NPE
Ok... I've got another question. I've copied/modified the code template for the login form to make a logout page, but when it tries to make the form object it throws a NullPointerException. The exception report simply highlights the definition of the form (which is the same as on the working page): form t:id=form -- Robert Hailey org.apache.tapestry5.ioc.internal.util.TapestryException: Failure creating embedded component 'form' of das.pages.Logout: java.lang.NullPointerException [at context:Logout.tml, line 8] at org .apache .tapestry5 .internal .pageload .ComponentAssemblerImpl .createEmbeddedAssembler(ComponentAssemblerImpl.java:315) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.startComponent(PageLoaderImpl.java: 749) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.component(PageLoaderImpl.java:614) at org .apache .tapestry5 .internal .pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:402) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.element(PageLoaderImpl.java:674) at org .apache .tapestry5 .internal .pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:397) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.element(PageLoaderImpl.java:674) at org .apache .tapestry5 .internal .pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:397) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.programAssembler(PageLoaderImpl.java: 234) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java: 207) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:183) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:157) at $PageLoader_12762d8a5e9.loadPage($PageLoader_12762d8a5e9.java) at org .apache .tapestry5.internal.services.PagePoolCache.checkout(PagePoolCache.java: 210) at org .apache .tapestry5.internal.services.PagePoolImpl.checkout(PagePoolImpl.java:99) at $PagePool_12762d8a5e8.checkout($PagePool_12762d8a5e8.java) at org .apache .tapestry5 .internal.services.RequestPageCacheImpl.get(RequestPageCacheImpl.java: 51) at $RequestPageCache_12762d8a5e7.get($RequestPageCache_12762d8a5e7.java) at $RequestPageCache_12762d8a5e0.get($RequestPageCache_12762d8a5e0.java) at org .apache .tapestry5 .internal .services .PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java: 52) at org.apache.tapestry5.services.TapestryModule $33.handle(TapestryModule.java:1943) at $ PageRenderRequestHandler_12762d8a5e3 .handle($PageRenderRequestHandler_12762d8a5e3.java) at $ PageRenderRequestHandler_12762d8a5d7 .handle($PageRenderRequestHandler_12762d8a5d7.java) at org .apache .tapestry5 .internal .services .ComponentRequestHandlerTerminator .handlePageRender(ComponentRequestHandlerTerminator.java:48) at das .security .SecurityLoginFilter.handlePageRender(SecurityLoginFilter.java:70) at $ ComponentRequestHandler_12762d8a62d .handlePageRender($ComponentRequestHandler_12762d8a62d.java) at $ ComponentRequestHandler_12762d8a5dc .handlePageRender($ComponentRequestHandler_12762d8a5dc.java) at org .apache .tapestry5 .internal .services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:45) at $Dispatcher_12762d8a5de.dispatch($Dispatcher_12762d8a5de.java) at $Dispatcher_12762d8a5d2.dispatch($Dispatcher_12762d8a5d2.java) at org.apache.tapestry5.services.TapestryModule $RequestHandlerTerminator.service(TapestryModule.java:245) at das.services.TimingFilter.service(TimingFilter.java:43) at $RequestHandler_12762d8a5d3.service($RequestHandler_12762d8a5d3.java) [...snip...] Caused by: java.lang.NullPointerException at javassist.Loader.loadClass(Loader.java:304) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at org .apache .tapestry5 .internal .services .ComponentInstantiatorSourceImpl .findClass(ComponentInstantiatorSourceImpl.java:296) at org .apache .tapestry5 .internal .services .ComponentInstantiatorSourceImpl .getInstantiator(ComponentInstantiatorSourceImpl.java:276) at $ ComponentInstantiatorSource_12762d8a5b7 .getInstantiator($ComponentInstantiatorSource_12762d8a5b7.java) at org .apache .tapestry5 .internal .pageload .EmbeddedComponentAssemblerImpl .getModel(EmbeddedComponentAssemblerImpl.java:173) at org .apache .tapestry5 .internal .pageload .EmbeddedComponentAssemblerImpl .init(EmbeddedComponentAssemblerImpl.java:82) at org .apache .tapestry5 .internal .pageload .ComponentAssemblerImpl .createEmbeddedAssembler(ComponentAssemblerImpl.java:266) ... 79 more
Re: Cannot create 'form' component / NPE
On Mar 15, 2010, at 2:02 PM, Ulrich Stärk wrote: You want t:form t:id=form or form t:type=form t:id=form Uli Thank you, that worked... now I am wondering why Login.tml works w/ the original form (?). On Mar 15, 2010, at 1:09 PM, Howard Lewis Ship wrote: What version of Tapestry? Come on, you know the drill, give us information to help you. It is version 5.1.0.5 -- Robert Hailey On 15.03.2010 18:43, Robert Hailey wrote: Ok... I've got another question. I've copied/modified the code template for the login form to make a logout page, but when it tries to make the form object it throws a NullPointerException. The exception report simply highlights the definition of the form (which is the same as on the working page): form t:id=form -- Robert Hailey org.apache.tapestry5.ioc.internal.util.TapestryException: Failure creating embedded component 'form' of das.pages.Logout: java.lang.NullPointerException [at context:Logout.tml, line 8] at org .apache .tapestry5 .internal .pageload .ComponentAssemblerImpl .createEmbeddedAssembler(ComponentAssemblerImpl.java:315) at org .apache .tapestry5 .internal .pageload.PageLoaderImpl.startComponent(PageLoaderImpl.java:749) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.component(PageLoaderImpl.java:614) at org .apache .tapestry5 .internal .pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java: 402) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.element(PageLoaderImpl.java:674) at org .apache .tapestry5 .internal .pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java: 397) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.element(PageLoaderImpl.java:674) at org .apache .tapestry5 .internal .pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java: 397) at org .apache .tapestry5 .internal .pageload.PageLoaderImpl.programAssembler(PageLoaderImpl.java:234) at org .apache .tapestry5 .internal .pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:207) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java: 183) at org .apache .tapestry5 .internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:157) at $PageLoader_12762d8a5e9.loadPage($PageLoader_12762d8a5e9.java) at org .apache .tapestry5 .internal.services.PagePoolCache.checkout(PagePoolCache.java:210) at org .apache .tapestry5 .internal.services.PagePoolImpl.checkout(PagePoolImpl.java:99) at $PagePool_12762d8a5e8.checkout($PagePool_12762d8a5e8.java) at org .apache .tapestry5 .internal .services.RequestPageCacheImpl.get(RequestPageCacheImpl.java:51) at $RequestPageCache_12762d8a5e7.get($RequestPageCache_12762d8a5e7.java) at $RequestPageCache_12762d8a5e0.get($RequestPageCache_12762d8a5e0.java) at org .apache .tapestry5 .internal .services .PageRenderRequestHandlerImpl .handle(PageRenderRequestHandlerImpl.java:52) at org.apache.tapestry5.services.TapestryModule $33.handle(TapestryModule.java:1943) at $ PageRenderRequestHandler_12762d8a5e3 .handle($PageRenderRequestHandler_12762d8a5e3.java) at $ PageRenderRequestHandler_12762d8a5d7 .handle($PageRenderRequestHandler_12762d8a5d7.java) at org .apache .tapestry5 .internal .services .ComponentRequestHandlerTerminator .handlePageRender(ComponentRequestHandlerTerminator.java:48) at das .security .SecurityLoginFilter.handlePageRender(SecurityLoginFilter.java:70) at $ ComponentRequestHandler_12762d8a62d .handlePageRender($ComponentRequestHandler_12762d8a62d.java) at $ ComponentRequestHandler_12762d8a5dc .handlePageRender($ComponentRequestHandler_12762d8a5dc.java) at org .apache .tapestry5 .internal .services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:45) at $Dispatcher_12762d8a5de.dispatch($Dispatcher_12762d8a5de.java) at $Dispatcher_12762d8a5d2.dispatch($Dispatcher_12762d8a5d2.java) at org.apache.tapestry5.services.TapestryModule $RequestHandlerTerminator.service(TapestryModule.java:245) at das.services.TimingFilter.service(TimingFilter.java:43) at $RequestHandler_12762d8a5d3.service($RequestHandler_12762d8a5d3.java) [...snip...] Caused by: java.lang.NullPointerException at javassist.Loader.loadClass(Loader.java:304) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at org .apache .tapestry5 .internal .services .ComponentInstantiatorSourceImpl .findClass(ComponentInstantiatorSourceImpl.java:296) at org .apache .tapestry5 .internal .services .ComponentInstantiatorSourceImpl .getInstantiator(ComponentInstantiatorSourceImpl.java:276) at $ ComponentInstantiatorSource_12762d8a5b7 .getInstantiator($ComponentInstantiatorSource_12762d8a5b7.java) at org .apache .tapestry5 .internal .pageload .EmbeddedComponentAssemblerImpl .getModel(EmbeddedComponentAssemblerImpl.java:173) at org .apache .tapestry5 .internal .pageload .EmbeddedComponentAssemblerImpl .init
Re: exception page debug
On Mar 15, 2010, at 2:10 PM, Yury Luneff wrote: Hi, Have you overrided the ExceptionReport or even ExceptionRequestHandler ? Regards, Christophe Cordenier. in security module from tapestry5.localhost.nu ()there is: @InjectService(SpringSecurityExceptionFilter) final SpringSecurityExceptionTranslationFilter springSecurityExceptionFilter) where public class SpringSecurityExceptionTranslationFilter extends SpringSecurityFilter as today i have turned off this module in a whole and the problem persists, it is probably not the source of problem. Even if it is, security there checks logged user if he can read logs and puts error message otherwise and i don't receive any error message, just null. In my project i haven't touched anything related to expectionreport and such by myself and if i had, it would be the first place i watch for fixes. Yury, I think that something is catching the exceptions and not rendering anything. Do you have any custom filters? My understanding is that this anti-pattern will break exception reporting in a filter: try { return handler.service(request, response); } catch (Exception e) { log.debug(i just silently broke something, e) //@bug: here, exception caught! } -- Robert Hailey
Re: exception page debug
On Mar 15, 2010, at 2:42 PM, Yury Luneff wrote: Yury, I think that something is catching the exceptions and not rendering anything. Do you have any custom filters? My understanding is that this anti-pattern will break exception reporting in a filter: try { return handler.service(request, response); } catch (Exception e) { log.debug(i just silently broke something, e) //@bug: here, exception caught! } i think i had exactly that (no servlet api knowledge, i'm stupid, i'm ok with it): public RequestFilter buildTimingFilter(final Logger logger) { return new RequestFilter() { public boolean service(Request request, Response response, RequestHandler handler) throws IOException { long startTime = System.currentTimeMillis(); boolean successful = true; try { // The responsibility of a filter is to invoke the corresponding method // in the handler. When you chain multiple filters together, each filter // received a handler that is a bridge to the next filter. successful = handler.service(request, response); } finally { long elapsed = System.currentTimeMillis() - startTime; if (!successful) { logger.error(String.format(%s not found, request.getPath())); } else { logger.info( String.format( Request time: %d ms for %s, elapsed, request.getPath())); } return successful; } } }; } Ok... having a return or throw statement in a 'finally' clause is bad java. I'm glad you found the issue, though! -- Robert Hailey
Re: Empty body?
On Mar 12, 2010, at 1:20 PM, Manuel Sugawara wrote: Hi I'm working in a menu component, similar to the one in the howtos. The menuItem template looks like: I am not able to find such a menu component in the howtos. Can you provide a link please? -- Robert Hailey - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Name of application module class too complicated?
On Mar 11, 2010, at 9:45 AM, Massimo Lusetti wrote: On Thu, Mar 11, 2010 at 2:11 AM, Howard Lewis Ship hls...@gmail.com wrote: On Wed, Mar 10, 2010 at 4:42 PM, Josh Canfield joshcanfi...@gmail.com wrote: I've always just used AppModule... How about: look for FilterNameModule look for AppModule Throw exception can't find FilterNameModule or AppModule That's making it more complicated, not less. What Josh propose is the best way for handling this, let users who read doc use what they learned and help lazy users start with T5. I agree. I think the only question is wither to throw the exception or simply log something. By my point of view this is a non-issue at all and could definitely be kept the way it's now, what should be avoided is breaking current and correct working code. But apparently it is an issue or else users of the framework would not be running into it. Specifically, the issue is that the filter-name parameter does not logically imply a connection to module-controller- name for beginners (-:like me:-). -- Robert Hailey -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Tapestry now silently ignores my AppModule class
Greetings all, I'm just now trying my hand at Tapestry, but have managed to mess something up and get really confused... I started with the tutorial code, added a few pages, added hibernate configuration, and started trying to make an login/authentication filter. I thought everything was going fine, but should have realized something was up with it stopped giving me the development-mode error reports. I have no idea what I've done?! The AppModule class is still in the same place it has always been. The webapp still runs, hibernate automatically picks up the config, it ~seems~ to work fine... except AppModule has no effect. Even removing the AppModule.class[es] altogether gives no exception... it's that extra- frustrating kinda silence. Any ideas on how can I start debugging this issue? or, where/how does tapestry hunt for the AppModule class? It might be really bad if some simple config/programming issue can make all the security filters drop from a webapp. -- Robert Hailey versions: jetty-6.1.22 (2009-12-06) hibernate-3.3.2.GA (2009-06-24) tapestry-5.1.0.5 (2009-04-29) P.S. Also is this too high/low a percent: 84.30% unrealized services (145/172). AppModule does not appear in the service list - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Name of application module class too complicated?
On Mar 10, 2010, at 5:47 PM, Howard Lewis Ship wrote: Seems like we keep hitting the error where people change web.xml, rename their filter, and are confused that their AppModule is no longer loaded. That is precisely my issue! IT WORKS! Thanks. I think the way that T5 locates the module class from the filter name is over-engineered. I think it should just be fixed as AppModule, in the services package, end of story. Thoughts? Is there utility in a multi-module tapestry app? The other possibility would be to fail to initialize if it does not find the *Module.class it expects? I would have caught on if there was an exception like cannot locate class: %{prefix}/services/ [MyKillerApp]Module, and whereas the vast majority of security measures would be dependent on the contents of the class being able to casually unlink it in a config file is a bit disconcerting. Thanks again! -- Robert Hailey -- Howard M. Lewis Ship - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org