[T5] valid XHTML
Hi list, I've taken a look at T5 and followed the tutorial http://tapestry.apache.org/tapestry5/tutorial1/ I then added a doctype, following the instructions on http://tapestry.apache.org/tapestry5/tapestry-core/guide/ templates.html As a result, my template (Guess.tml) begins as follows: http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";> Guess A Number ... However, this renders to www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">rel="stylesheet" type="text/css">Gu which, due to "" instead of "" is not valid. Am I doing something wrong or is this a Tapestry issue? Thanks! Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session in ServiceEncoder's?
This seems to work: interface="org.apache.tapestry.engine.ServiceEncoder"> class="org.myorg.tapestry.myproject.serviceencoders.DBObjectServiceEncod er"> value="service:tapestry.state.ApplicationStateManager" /> and in the service encoder class: ... private ApplicationStateManager applicationStateManager; ... public void setApplicationStateManager(ApplicationStateManager applicationStateManager) { this.applicationStateManager = applicationStateManager; } ... ... = (...) this.applicationStateManager.get("whatever you need"); ... Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session in ServiceEncoder's?
On 21.01.2008, at 17:24, Kaspar Fischer wrote: Hi, Can I inject the current session into a service encoder? Any idea how I could achieve this? Many thanks! Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Session in ServiceEncoder's?
Hi, Can I inject the current session into a service encoder? Doing it with interface="org.apache.tapestry.engine.ServiceEncoder"> class="org.myorg.tapestry.myproject.serviceencoders.DBObjectServiceEncod er"> in hivemodule.xml does not work: the loginSession is only set once (to null), when the service encoder is created. The need for the session in the service encoder might seem strange, but I need it as I need to decide, depending on the object-id encoded in the URL and the user currently logged in, what page-class to use to display the object. Many thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T4.1.3/4.1.4] Get HTML output of request (for caching)?
On 19.01.2008, at 19:06, Andreas Andreou wrote: I've created & used http://tapfx.cvs.sourceforge.net/tapfx/tapfx-tapestry4/src/java/net/ sf/tapfx/components/cache/ It should work for 4.1.x & i'll probably need it some time soon, so, take a look Wow! Thanks a lot, that's great! Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T4.1.3/4.1.4] Get HTML output of request (for caching)?
Oops, I should have searched a little longer first: http://www.nabble.com/How-to-store-the-rendering-of-a-page-in-a- String-to10355949.html#a10390604 I'll take a look at this. Sorry, Kaspar On 19.01.2008, at 18:30, Kaspar Fischer wrote: Hi everybody, We have rather complex pages that take some time to render and I want to cache them as HTML files. For this, I need the output of a (HTML) request from the page service and store it on disk. When a next request comes, I want to return it directly. How can I get hold of the output of a request? Looking at the Tapestry source, it seems that I need to override DefaultResponseBuilder.java in some way. Or are there any hooks by which Tapestry could inform me when the HTML is rendered? And maybe a way to let me give it a stream to return directly? If not, could somebody outline, very roughly, what needs to be coded? That would make it much easier for me to get started and come up with more concrete questions. Of course, I'll share the result here on the list again. Many thanks! Kaspar -- Kaspar Fischer [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]
[T4.1.3/4.1.4] Get HTML output of request (for caching)?
Hi everybody, We have rather complex pages that take some time to render and I want to cache them as HTML files. For this, I need the output of a (HTML) request from the page service and store it on disk. When a next request comes, I want to return it directly. How can I get hold of the output of a request? Looking at the Tapestry source, it seems that I need to override DefaultResponseBuilder.java in some way. Or are there any hooks by which Tapestry could inform me when the HTML is rendered? And maybe a way to let me give it a stream to return directly? If not, could somebody outline, very roughly, what needs to be coded? That would make it much easier for me to get started and come up with more concrete questions. Of course, I'll share the result here on the list again. Many thanks! Kaspar -- Kaspar Fischer [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom service to provide files from DB: getOutputStream() has already been called for this response
A closer inspection showed that my exception is always preceeded by a ClientAbortException: Caused by: ClientAbortException: java.net.SocketException: Broken pipe at org.apache.catalina.connector.OutputBuffer.realWriteBytes (OutputBuffer.java:366) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer (ByteChunk.java:432) at org.apache.catalina.connector.OutputBuffer.doFlush (OutputBuffer.java:314) at org.apache.catalina.connector.OutputBuffer.flush (OutputBuffer.java:293) at org.apache.catalina.connector.CoyoteOutputStream.flush (CoyoteOutputStream.java:98) at org.icarbasel.tapestry.knowledgecenter.services.AlfrescoFileService.serv ice(AlfrescoFileService.java:115) ... 37 more So it's just the browser aborting the connection. My code now ignores the exception completely. P.S. A small issue with Tomcat made it hard to catch this exception, see http://forum.java.sun.com/thread.jspa? threadID=710086&messageID=4110420 Hope this helps others. On 18.01.2008, at 14:52, Kaspar Fischer wrote: Hi! I have a custom service that downloads images/files from a DB: public void service(IRequestCycle cycle) throws IOException { // extract node-ref String nodeUID = cycle.getParameter("node"); NodeRef nodeRef = new NodeRef(NODE_REF_PREFIX + nodeUID); try { // login to DB // ... content = ...; // get stream to content InputStream contentStream = content.getContent(); response.setContentType(content.getContentMimeType()); response.setContentLength(new Long(content.getContentSize ()).intValue()); ServletOutputStream out = response.getOutputStream(); // transmit final int SIZE = 10 * 1024; byte[] buffer = new byte[SIZE]; int i; while ((i = contentStream.read(buffer)) != -1) out.write(buffer, 0, i); contentStream.close(); out.close(); } catch (Exception e) { throw new ApplicationRuntimeException("Could not deliver file "+ nodeRef + ".", e); } } When I heavily load files (clicking reload many times in fast succession), I get ERROR http-80-Processor21 org.apache.catalina.core.ContainerBase. [Catalina].[localhost].[/kc].[kc] - Servlet.service() for servlet kc threw exception java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.Response.getWriter (Response.java:601) at org.apache.catalina.connector.ResponseFacade.getWriter (ResponseFacade.java:196) at org.apache.tapestry.web.ServletWebResponse.getPrintWriter (ServletWebResponse.java:116) at $WebResponse_1178d289d55.getPrintWriter ($WebResponse_1178d289d55.java) at $WebResponse_1178d289ccb.getPrintWriter ($WebResponse_1178d289ccb.java) at org.apache.tapestry.services.impl.DefaultResponseBuilder.renderRespons e(DefaultResponseBuilder.java:140) at org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse( ResponseRendererImpl.java:33) at $ResponseRenderer_1178d289ce3.renderResponse ($ResponseRenderer_1178d289ce3.java) at org.apache.tapestry.error.ExceptionPresenterImpl.presentException (ExceptionPresenterImpl.java:48) at $ExceptionPresenter_1178d289cd4.presentException ($ExceptionPresenter_1178d289cd4.java) at $ExceptionPresenter_1178d289cd3.presentException ($ExceptionPresenter_1178d289cd3.java) at org.apache.tapestry.engine.AbstractEngine.activateExceptionPage (AbstractEngine.java:117) at org.apache.tapestry.engine.AbstractEngine.service (AbstractEngine.java:269) at org.apache.tapestry.services.impl.InvokeEngineTerminator.service (InvokeEngineTerminator.java:54) at $WebRequestServicer_1178d289d2d.service ($WebRequestServicer_1178d289d2d.java) at $WebRequestServicer_1178d289d29.service ($WebRequestServicer_1178d289d29.java) at org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.ser vice(WebRequestServicerPipelineBridge.java:61) at $ServletRequestServicer_1178d289d0f.service ($ServletRequestServicer_1178d289d0f.java) at org.apache.tapestry.request.DecodedRequestInjector.service (DecodedRequestInjector.java:55) at $ServletRequestServicerFilter_1178d289d0b.service ($ServletRequestServicerFilter_1178d289d0b.java) at $ServletRequestServicer_1178d289d11.service ($ServletRequestServicer_1178d289d11.java) at org.apache.tapestry.multipart.MultipartDecoderFilter.service (MultipartDecoderFilter.java:52) at $ServletRequestServicerFilter_1178d289d09.service ($ServletRequestServicerFilter_1178d289d09.java) at $ServletRequestServicer_1178d289d11.service ($ServletRequestServicer_1178d289d11.java) at org.apache.tapestry.services.impl.SetupRequestEncoding.service (S
Re: [T4] AJAX: reender whole page or just send back the markup of the div
On 18.01.2008, at 13:51, Pai911 wrote: Why do you open the link in new window? The scenario should be: 1. You click on a link 2. The link invoke a listener (Asynchrounously) and update some attribute of the Page class 3. Some part of the page is re-rendered asynchronously with the new data. Sorry, I was not clear. I understand this scenario and tried your code. It works. Still, it seems that my whole page is rendered (and not just the component). At least, "rendered" in the sense that my void pageBeginRender(PageEvent event) listeners is exectued for my page (whether output is written I don't know). I came up with opening the link in a new window because it seemed to suggest that tapestry indeed renders the full page. But of course, if there is some JavaScript magic behind it, it will ask a different URL from the server when you click the link (instead of opening it in a new window, in which case the full page is rendered). Did you try the code sample I wrote?? Yes. Again, sorry, for not confirming this right away. If you do, but the refresh of the whole page occures, I think you may be using a certain old version of IE 6 cause I've run into such situation. No, it worked. With your comments, I understand it this way: a) When you click an AJAX link, JS asks the server to only render the compontent(s) that need update (updateComponents). This will run through the whole page building process and, in particular, trigger my pageBeginRender(), etc. listeners. But output is (?) only written for the components that need updating. b) However, when you open the AJAX link in a new window (that is, access the link without the onClick-JS), a different request is sent to the server: it just renders the full page. More or less correct? Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Custom service to provide files from DB: getOutputStream() has already been called for this response
Hi! I have a custom service that downloads images/files from a DB: public void service(IRequestCycle cycle) throws IOException { // extract node-ref String nodeUID = cycle.getParameter("node"); NodeRef nodeRef = new NodeRef(NODE_REF_PREFIX + nodeUID); try { // login to DB // ... content = ...; // get stream to content InputStream contentStream = content.getContent(); response.setContentType(content.getContentMimeType()); response.setContentLength(new Long(content.getContentSize ()).intValue()); ServletOutputStream out = response.getOutputStream(); // transmit final int SIZE = 10 * 1024; byte[] buffer = new byte[SIZE]; int i; while ((i = contentStream.read(buffer)) != -1) out.write(buffer, 0, i); contentStream.close(); out.close(); } catch (Exception e) { throw new ApplicationRuntimeException("Could not deliver file "+ nodeRef + ".", e); } } When I heavily load files (clicking reload many times in fast succession), I get ERROR http-80-Processor21 org.apache.catalina.core.ContainerBase. [Catalina].[localhost].[/kc].[kc] - Servlet.service() for servlet kc threw exception java.lang.IllegalStateException: getOutputStream() has already been called for this response at org.apache.catalina.connector.Response.getWriter (Response.java:601) at org.apache.catalina.connector.ResponseFacade.getWriter (ResponseFacade.java:196) at org.apache.tapestry.web.ServletWebResponse.getPrintWriter (ServletWebResponse.java:116) at $WebResponse_1178d289d55.getPrintWriter ($WebResponse_1178d289d55.java) at $WebResponse_1178d289ccb.getPrintWriter ($WebResponse_1178d289ccb.java) at org.apache.tapestry.services.impl.DefaultResponseBuilder.renderResponse( DefaultResponseBuilder.java:140) at org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse (ResponseRendererImpl.java:33) at $ResponseRenderer_1178d289ce3.renderResponse ($ResponseRenderer_1178d289ce3.java) at org.apache.tapestry.error.ExceptionPresenterImpl.presentException (ExceptionPresenterImpl.java:48) at $ExceptionPresenter_1178d289cd4.presentException ($ExceptionPresenter_1178d289cd4.java) at $ExceptionPresenter_1178d289cd3.presentException ($ExceptionPresenter_1178d289cd3.java) at org.apache.tapestry.engine.AbstractEngine.activateExceptionPage (AbstractEngine.java:117) at org.apache.tapestry.engine.AbstractEngine.service (AbstractEngine.java:269) at org.apache.tapestry.services.impl.InvokeEngineTerminator.service (InvokeEngineTerminator.java:54) at $WebRequestServicer_1178d289d2d.service ($WebRequestServicer_1178d289d2d.java) at $WebRequestServicer_1178d289d29.service ($WebRequestServicer_1178d289d29.java) at org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.servi ce(WebRequestServicerPipelineBridge.java:61) at $ServletRequestServicer_1178d289d0f.service ($ServletRequestServicer_1178d289d0f.java) at org.apache.tapestry.request.DecodedRequestInjector.service (DecodedRequestInjector.java:55) at $ServletRequestServicerFilter_1178d289d0b.service ($ServletRequestServicerFilter_1178d289d0b.java) at $ServletRequestServicer_1178d289d11.service ($ServletRequestServicer_1178d289d11.java) at org.apache.tapestry.multipart.MultipartDecoderFilter.service (MultipartDecoderFilter.java:52) at $ServletRequestServicerFilter_1178d289d09.service ($ServletRequestServicerFilter_1178d289d09.java) at $ServletRequestServicer_1178d289d11.service ($ServletRequestServicer_1178d289d11.java) at org.apache.tapestry.services.impl.SetupRequestEncoding.service (SetupRequestEncoding.java:53) at $ServletRequestServicerFilter_1178d289d0d.service ($ServletRequestServicerFilter_1178d289d0d.java) at $ServletRequestServicer_1178d289d11.service ($ServletRequestServicer_1178d289d11.java) at $ServletRequestServicer_1178d289d03.service ($ServletRequestServicer_1178d289d03.java) at org.apache.tapestry.ApplicationServlet.doService (ApplicationServlet.java:126) at org.apache.tapestry.ApplicationServlet.doGet (ApplicationServlet.java:103) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) Does anybody know what could be the reason for this? It does not occur when I do one request after the other with pauses in between. It seems to be something tapestry-specific as I am not calling getOutputStream() stream twice! Or is my service() called twice? But why? Many thanks in advance for any pointers! Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: org.apache.tapestry.page-pool-min-idle
On 12.01.2008, at 02:47, Kaspar Fischer wrote: How would I do this? value="4" /> Or do I have to use something like "InfrastructureOverrides"? The latter is used to override the exception settings, see http://tapestry.apache.org/tapestry4.1/developmentguide/ exceptionpages.html I've tried the former approach and it does not work: Caused by: org.apache.hivemind.ApplicationRuntimeException: Element default (at jar:file:...tomcat/wtpwebapps/KC/WEB-INF/lib/ tapestry-framework-4.1.3.jar!/META-INF/tapestry.page.xml, line 37, column 78) contains errors: Value for attribute 'symbol' ('org.apache.tapestry.page-pool-min-idle') duplicates a prior instance at context:/WEB-INF/hivemodule.xml, line 5, column 72. [jar:file...tomcat/wtpwebapps/KC/WEB-INF/lib/tapestry- framework-4.1.3.jar!/META-INF/tapestry.page.xml, line 37, column 78] at org.apache.hivemind.impl.SchemaElement.validateAttributes (SchemaElement.java:185) at org.apache.hivemind.impl.SchemaProcessorImpl.processElement (SchemaProcessorImpl.java:251) at org.apache.hivemind.impl.SchemaProcessorImpl.processRootElement (SchemaProcessorImpl.java:235) So I have tried the latter approach (again in hivemodule.xml): With this, no errors are reported. But maybe the configuration is just ignored? How can I verify the "page-pool-min-idle" property has been set? Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T4] AJAX: reender whole page or just send back the markup of the div
On 11.01.2008, at 05:02, Pai911 wrote: Hi! I don't think that Tapestry will render the whole page when a listener is in invoked Asynchronously. Hm, I think not: When I open the link in a new window, the whole page shows. So I think the whole page is actually rendered, returned to the client where the div(s) to update are extracted. Could this be true? Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Programmatically generating DirectLinks with updateComponents
For others running into a similar problem. I've solved it as follows. My markup contains: updateComponents="result" async="true" parameters="ognl: {page.parameter}"> At the place where I need to programmatically generate the link, I call my page's setLinkText() method (which I added as an abstract method) and similarly, setParameter(). Then I do Block block = (Block)this.getContainer().getComponent("block"); block.renderForComponent(writer, cycle, this); That worked for me. On 24.12.2007, at 10:39, Kaspar Fischer wrote: On 22.12.2007, at 23:30, Andreas Andreou wrote: Hi, what's the html template for ResultElement ? Can't you add the link there? ResultElement does not have a HTML but is an AbstractComponent rendering its content using the renderComponent(). The name "ResultElement" is a little missleading; in reality, ResultElement's renderComponent() method renders a tree-like structure and needs to emit lots of DirectLinks with update- Components: ... and from the code (ResultElement's renderComponent()) I try to render the link as follows: DirectLink link = (DirectLink)this.getContainer().getComponent ("link"); String url = link.getLink(cycle).getURL(); writer.begin("a"); writer.appendAttribute("href", url); writer.print(title); writer.end(); In the meantime I've taken a look at DefaultLinkRenderer.java and see how they output the onClick element. But this does not seem to anwser my original question: How can I programatically generate a DirectLink? Is the above way of doing it (using getComponent("link"), referring to an existing DirectLink component, that is) the "right" way? If so, how would I add a body to the component? I'd prefer to generate the link like this: DirectLink mylink = new DirectLink(...); // how to add the body of the link? How can I do this? Kaspar - 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: [Slightly OT] GZIP compression filter and java.lang.IllegalStateException: Cannot create a session...
For the sake of completeness: I've solved this by enabling Tomcat 5.5's GZIP compression in server.xml: disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" port="8080" redirectPort="8443" compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml" /> On 12.01.2008, at 03:44, Kaspar Fischer wrote: Hi, I've tried to install a compression filter and followed http://www.nabble.com/-slight-OT--GZip-compression-filter- td6901991.html for this. When I load my page, I get an exception (see below) about a OGNL expression that could not be parsed and "Cannot create a session after the response has been committed". (It works without the GZIP compression.) My configuration is: CompressingFilter class>com.planetj.servlet.filter.compression.CompressingFilterfilter-class> excludeContentTypes application/pdf excludePathPatterns .*\.pdf CompressingFilter /* REQUEST Does anybody know how I can fix this? Thanks in advance! Kaspar P.S. I post (see link above) also mentions code; I have not changed/ added any code. Should I have done? -- javax.servlet.ServletException: Unable to parse OGNL expression 'loginSession.isLoggedIn()': loginSession org.apache.hivemind.ApplicationRuntimeException: Unable to parse OGNL expression 'loginSession.isLoggedIn()': loginSession location: context:/WEB-INF/Border.html, line 121 org.apache.tapestry.BindingException: Unable to parse OGNL expression 'loginSession.isLoggedIn()': loginSession binding: ExpressionBinding[null loginSession.isLoggedIn()] location: context:/WEB-INF/Border.html, line 121 org.apache.hivemind.ApplicationRuntimeException: Unable to parse OGNL expression 'loginSession.isLoggedIn()': loginSession ognl.OgnlException: loginSession java.lang.IllegalStateException: Cannot create a session after the response has been committed org.apache.catalina.connector.Request.doGetSession(Request.java:2221) org.apache.catalina.connector.Request.getSession(Request.java:2031) org.apache.catalina.connector.RequestFacade.getSession (RequestFacade.java:832) org.apache.tapestry.web.ServletWebRequest.getSession (ServletWebRequest.java:81) ... - 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]
[Slightly OT] GZIP compression filter and java.lang.IllegalStateException: Cannot create a session...
Hi, I've tried to install a compression filter and followed http://www.nabble.com/-slight-OT--GZip-compression-filter- td6901991.html for this. When I load my page, I get an exception (see below) about a OGNL expression that could not be parsed and "Cannot create a session after the response has been committed". (It works without the GZIP compression.) My configuration is: CompressingFilter class>com.planetj.servlet.filter.compression.CompressingFilterfilter-class> excludeContentTypes application/pdf excludePathPatterns .*\.pdf CompressingFilter /* REQUEST Does anybody know how I can fix this? Thanks in advance! Kaspar P.S. I post (see link above) also mentions code; I have not changed/ added any code. Should I have done? -- javax.servlet.ServletException: Unable to parse OGNL expression 'loginSession.isLoggedIn()': loginSession org.apache.hivemind.ApplicationRuntimeException: Unable to parse OGNL expression 'loginSession.isLoggedIn()': loginSession location: context:/WEB-INF/Border.html, line 121 org.apache.tapestry.BindingException: Unable to parse OGNL expression 'loginSession.isLoggedIn()': loginSession binding: ExpressionBinding[null loginSession.isLoggedIn()] location: context:/WEB-INF/Border.html, line 121 org.apache.hivemind.ApplicationRuntimeException: Unable to parse OGNL expression 'loginSession.isLoggedIn()': loginSession ognl.OgnlException: loginSession java.lang.IllegalStateException: Cannot create a session after the response has been committed org.apache.catalina.connector.Request.doGetSession(Request.java:2221) org.apache.catalina.connector.Request.getSession(Request.java:2031) org.apache.catalina.connector.RequestFacade.getSession (RequestFacade.java:832) org.apache.tapestry.web.ServletWebRequest.getSession (ServletWebRequest.java:81) ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
org.apache.tapestry.page-pool-min-idle
Hi there, My website has, apart from a few seldomly accessed pages, one page, ArticlePage.html, which is used for *all* articles in our backend DB. That is, there are more than 500 different (friendly) URLs /app/ArticlePage.html?id=1000 /app/ArticlePage.html?id=1001 ... that all use the same page ArticlePage.html. I am wondering whether I should, in this situation, increase org.apache.tapestry.page-pool-min-idle in my hivemodule.xml? I guess I should set it to the "average" number of concurrent users, right? How would I do this? value="4" /> Or do I have to use something like "InfrastructureOverrides"? The latter is used to override the exception settings, see http://tapestry.apache.org/tapestry4.1/developmentguide/ exceptionpages.html Many thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T4] AJAX: reender whole page or just send back the markup of the div
Dear all, I have a very basic question about AJAX in Tapestry 4.1.3: IIUC, the "updateComponents" attribute provided by Tapestry components works by rendering the *whole* page, extracting the relevant components (via their ids) and sending them back to the client. I find this very elegant and it makes the pages easy to maintain. For very complex pages, however, the above approach can result in some overhead. I'd therefore like to just call a function that returns the replacement div (and does not render the whole page). Is there a simple example that shows how to do this? For instance: Given a div and a link, clicking the link will replace the div via AJAX without reloading the page. Thanks, Kaspar P.S. I have started reading about EventListeners but am not sure whether this is exactly what I need. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Temporary objects in OGNL
On 31.12.2007, at 09:07, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: Have a look at http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/varref.html I actually tried this before: only outputs "foo" once. Shouldn't it emit this string twice? I tend to use complex ognl for rapid view development (dynamic reload). After that, I move complex expressions into Java-code. Thanks a lot for this hint! Would almost have been my next question ;-) Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Temporary objects in OGNL
Hi! My Tapestry markup quite often contains repetitions like this: condition="ognl:components.table.tableRow.getProperty('title')! =null&&components.table.tableRow.getProperty('title').length()>0"> value="ognl:components.table.tableRow.getProperty('title')"> Is there an easy way to assign the result of a complicated (and potentially expensive) OGNL expression to a temporary object and reuse this later? Something like: value="ognl:components.table.tableRow.getProperty('title')" name="that"> ... Or is there another trick I've overseen? Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AjaxStatus not working when not using @Shell?
On 26.12.2007, at 18:18, Andreas Andreou wrote: It should work, but I can try and look it up a bit... what Tapestry version? That would be great. The version is 4.1.3. By the way, I have a very basic question: What is the relation between Tapestry 4.x and the current version of Tacos (4.1.1)? Is Tacos sort of a testbed of new features which eventually get embedded into Tapestry? More precisely, if I want to do AJAX intensively, will I have to choose *between* Tapestry's integrated AJAX features *or* Tacos? Or is the latter based on Tapestry internal AJAX? Thanks, Kaspar On Dec 26, 2007 5:22 PM, Kaspar Fischer <[EMAIL PROTECTED]> wrote: Dear list, I am trying to display a "please wait" text during an asynchronous AJAX request and went for Loading... which I cannot get to work. From AjaxStatus.script I see that a dojo.require("tapestry.fx"); should get output into my HTML file and this is where the problem seems to lie: I cannot find this in the generated HTML markup. I am not using @Shell but have a in all my pages. Could it be that this is not enough for Tapestry's AJAX features? Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - 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]
AjaxStatus not working when not using @Shell?
Dear list, I am trying to display a "please wait" text during an asynchronous AJAX request and went for style="display:none;color:white;background:red"> Loading... which I cannot get to work. From AjaxStatus.script I see that a dojo.require("tapestry.fx"); should get output into my HTML file and this is where the problem seems to lie: I cannot find this in the generated HTML markup. I am not using @Shell but have a in all my pages. Could it be that this is not enough for Tapestry's AJAX features? Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Programmatically generating DirectLinks with updateComponents
On 22.12.2007, at 23:30, Andreas Andreou wrote: Hi, what's the html template for ResultElement ? Can't you add the link there? ResultElement does not have a HTML but is an AbstractComponent rendering its content using the renderComponent(). The name "ResultElement" is a little missleading; in reality, ResultElement's renderComponent() method renders a tree-like structure and needs to emit lots of DirectLinks with update- Components: ... and from the code (ResultElement's renderComponent()) I try to render the link as follows: DirectLink link = (DirectLink)this.getContainer().getComponent ("link"); String url = link.getLink(cycle).getURL(); writer.begin("a"); writer.appendAttribute("href", url); writer.print(title); writer.end(); In the meantime I've taken a look at DefaultLinkRenderer.java and see how they output the onClick element. But this does not seem to anwser my original question: How can I programatically generate a DirectLink? Is the above way of doing it (using getComponent("link"), referring to an existing DirectLink component, that is) the "right" way? If so, how would I add a body to the component? I'd prefer to generate the link like this: DirectLink mylink = new DirectLink(...); // how to add the body of the link? How can I do this? Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Programmatically generating DirectLinks with updateComponents
On 21.12.2007, at 19:29, Kaspar Fischer wrote: Hi, My custom component needs to emit in its renderComponent() method several DirectLink with updateComponents information. That is, I need to output the same HTML as updateComponents="result"> generates non-programmatically, but from within renderComponent(). How can I do this? Thanks, Kaspar To give a concrete example: I tried to do it as follows: updateComponents="result"> div> ... and from the code (ResultElement's renderComponent()) I try to render the link as follows: DirectLink link = (DirectLink)this.getContainer().getComponent ("link"); String url = link.getLink(cycle).getURL(); writer.begin("a"); writer.appendAttribute("href", url); writer.print(title); writer.end(); Unfortunately, this only outputs an ordinary link, not an AJAX link! Any ideas how to output a AJAX link programmatically? Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)
On 21.12.2007, at 22:33, Marcus Schulte wrote: 2007/12/21, Kaspar Fischer <[EMAIL PROTECTED]>: On 20.12.2007, at 18:16, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: Does this mean that Tapestry will keep in its page pool an IExternalPage page for each article I have in the DB (once this page is visited)? Please refer to http://tapestry.apache.org/tapestry4.1/usersguide/state.html Tapestry will keep in its pool one instance for each *concurrent request* it is serving. Your persistent page-id will be stored in the session or on the client (configurable). When a request comes in, Tapestry will pick a page from the pool and provide it with the persistent property data, e.g. the reference to your db-data. I don't see how this solves my problem of emitting DirectLinks with parameters into the page. If I understand you correctly, you say that by using persisted properties, my DirectLinks do not need to contain the page's parameters, right? Suppose my article page contains a link to download the article. This link is implemented via a DirectLink. Suppose now the user opens two tabs, in this order: http://my.org/app?page=Article&id=1 http://my.org/app?page=Article&id=2 After this, the session holds "id=2". Now the user clicks the download link in the former page (id=1). As this DirectLink does not contain "id=1" the user will get article 2. That's not what the user expects. Do I misunderstand this? It seems to me that persistent properties do not solve the problem. I need a way to tell DirectLink to look up the current external page's parameter's and embed them in the link. Sounds like what you really want is client-side persistence. This will store your page-state in the URL - or in a hidden field, if your page uses forms. So, to be concrete, if you're having a non-null property annotated with @Persist("client"), or tagged appropriately in the .page xml-File, your direct Link will, magically, render as something like: http://localhost:8080/myapp/app? component=dl&page=Home&service=direct&state:Home=BrO0ABXcQAQAACXRy aWdnZXJlZHQAATE%3D The funny String making up the value of the parameter "state:Home" is actually the Base64 encoded version of your page-state. That way, a user opnening several instances of your page in multiple browser windows/ tabs will see what he expects (possibly ;)) ;-) Well, I think this was it! I've managed to get the state:... into my direct links and I think that's all I need. Unfortunately, the links (to sort) on my Contrib:Table on my page still look as follows http://localhost:8080/kc/ SectionPage,tableColumnComponent.linkColumn.sdirect?container=Contrib% 3ASimpleTableColumnPage&sp=ASectionPage%2C% 24SectionTagQueryListElement.% 24SortableNodeTable.table.tableView&sp=SnodeTableTitle No trace of a state:...! Do you happen to know how to achieve this? Or is it a missing feature of Contrib:Table? Btw., don't worry about asking basic questions, that's ok, of course. That's very encouraging! And I want to make a compliment: You help is very kind and I appreciate it a lot! Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)
On 20.12.2007, at 18:16, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: Does this mean that Tapestry will keep in its page pool an IExternalPage page for each article I have in the DB (once this page is visited)? Please refer to http://tapestry.apache.org/tapestry4.1/usersguide/state.html Tapestry will keep in its pool one instance for each *concurrent request* it is serving. Your persistent page-id will be stored in the session or on the client (configurable). When a request comes in, Tapestry will pick a page from the pool and provide it with the persistent property data, e.g. the reference to your db-data. I don't see how this solves my problem of emitting DirectLinks with parameters into the page. If I understand you correctly, you say that by using persisted properties, my DirectLinks do not need to contain the page's parameters, right? Suppose my article page contains a link to download the article. This link is implemented via a DirectLink. Suppose now the user opens two tabs, in this order: http://my.org/app?page=Article&id=1 http://my.org/app?page=Article&id=2 After this, the session holds "id=2". Now the user clicks the download link in the former page (id=1). As this DirectLink does not contain "id=1" the user will get article 2. That's not what the user expects. Do I misunderstand this? It seems to me that persistent properties do not solve the problem. I need a way to tell DirectLink to look up the current external page's parameter's and embed them in the link. Kaspar P.S. I understand that I can pass additional parameters to the DirectLink by setting its "parameters" parameter. Still, I am posting because I do not understand Tapestry's idea of handling page parameters: For instance, I want to use Contrib:Table on my page. It emits lots of links (links to sort the table). But if these links do not contain my page parameters, the page will not render when the user clicks to sort the table. That's why I ask how to do this with a simple DirectLink -- although my actual problem is Contrib:Table, and possibly other components. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Programmatically generating DirectLinks with updateComponents
Hi, My custom component needs to emit in its renderComponent() method several DirectLink with updateComponents information. That is, I need to output the same HTML as updateComponents="result"> generates non-programmatically, but from within renderComponent(). How can I do this? Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)
Dear Marcus, First of all, thanks a lot for your reply! I am not sure whether I understand what you say. I have a variable (and huge) number of actual pages. (In fact, each is coming from a DB entry.) Because the number is variable, I chose to implement a *single* Tapestry page class for the *many* pages I have. On 20.12.2007, at 09:55, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: I suppose your page implements IExternalPage? You mean that I create a single Tapestry class implementing IExternalPage, right? All my (variably many) pages use this class. Correct? If you seed you page/app with external parameters which you need later on, in subsequent requests, store them in page/component properties marked as @Persist-ent. Does this mean that Tapestry will keep in its page pool an IExternalPage page for each article I have in the DB (once this page is visited)? Is this a good idea? I have lots of pages and at some point, the memory might be full. Or is there some mechanism that purges pages from the cache? I am sorry if my questions are quite basic! The more I appreciate your help. Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)
Hi Andreas, On 20.12.2007, at 11:36, Andreas Pursian wrote: How can I use a DirectLink on a page that depends on a parameter, for instance of, on a page like this http://my.org/app?page=Article&id=27 So if i got the point, you just want to create a link that refers to a special article wich is identified by an id ... right? The tapestry manual gives an example on how to use DirectLink with listeners: http://tapestry.apache.org/tapestry4/QuickStart/directlink.html if you read a bit further there is a part "Passing data in the links" ... which should solve your problem. I have read this, and you are right: it solves the problem in this particular case where I only want to generate a link. However, if you look at my original post, then I do not see anymore how to solve the problem. The latter post is about generating links, too. But this time it is not me who is generating the links but Contrib:Table. (It generates links to sort a table.) Again, I run into the same problem: The links generated by Contrib:Table only identify the page class (Article) but *not* its id. So when you click on the link, the page does not know which article to show. In the DirectLink example, I can -- as you say -- pass parameters manually. But how would I do it with Contrib:Table? Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T4] OGNL bytecode compilation in Tapestry/status of tapestry-prop?
Dear list, I am confused about the status of OGNL that comes with Tapestry 4.1.3. I read on http://blog.opencomponentry.com/2007/01/14/new-ognl-release-on-the- horizon-its-faster that bytecode compilation has been implemented for OGNL and that this is in Tapestry 4.1.2 already. * Is this the case? * Do I have to enable OGNL bytecode compilation in some way? (We have quite high rendering times and I wonder whether OGNL is resonsible.) * Does this mean that tapestry-prop, http://howardlewisship.com/tapestry-javaforge/tapestry-prop/ which you cannot download currently, is not needed anymore? Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help needed with DirectLink and page parameters (Was: Contrib:Table and page parameters)
Dear list, In order to isolate the problem, I tried to do something much simpler: showing a DirectLink on one of my pages. The tapestry manual gives an example on how to use DirectLink with listeners: http://tapestry.apache.org/tapestry4/QuickStart/directlink.html http://tapestry.apache.org/tapestry4/UsersGuide/listenermethods.html However, these examples assume that the content of the page containing the DirectLink does not depend on page parameters. How can I use a DirectLink on a page that depends on a parameter, for instance of, on a page like this http://my.org/app?page=Article&id=27 The link generated by a DirectLink component is something like http://...Article,$MyComponent.$DirectLink.sdirect but does not mention the id. So the listener is executed but afterwards, the Article page does not know which item (namely id=27) it should show! I feel very much that I am on the wrong track and would be very glad to receive some help. Many thanks, Kaspar On 17.12.2007, at 20:50, Kaspar Fischer wrote: Hm, I think my question was not well formulated. Apologies. I'll try once more! Suppose you want to implement an index that shows all files starting with "A", "B", etc. My page would show A B C D ... X Y Z and you can click on a letter to show the files starting with this letter in a sortable Contrib:Table. How would I do this? Can somebody lead me on the right track? Thanks! Kaspar On 16.12.2007, at 17:08, Kaspar Fischer wrote: Hi list, How can I tell Contrib:Table to pass on page paremeters? When I click on a table column to sort it, the page that opens does not have the page parameters of the old page anymore! More precisely, my page "Page.html" uses a paremeter (nodeid) to know what content to display. So in Page.java's pageBeginRender() method I have String nodeIdParam = cycle.getParameter("nodeid"); and then I load the data from a database and display a few things in a Contrib:Table. Unfortunately, the link that the Contrib:Table generates in order to sort a column does not contain the value for parameter "nodeid": http://localhost:8080/kc/ Page,tableColumnComponent.linkColumn.sdirect?container=Contrib% 3ASimpleTableColumnPage&sp=APage%2C% 24SortableTable.table.tableView&sp=SnodeTableTitle So when I click the link, my node does not know what data to load from the database! I think I need to tell Contrib:Table to include the nodeid in the link, right? How can I do this? Many thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: about ognl and class changes detection
On 13.12.2007, at 09:54, #Cyrille37# wrote: Hello OGNL is very nice but I would like to know how to manage classes changes without testing every pages. Exemple : In pages we have some ognl expression like value="ognl:user.lastname" and we change the class's property getLastname() to getName(). Every page are broken, And I could not find a nice method to find thoses errors. How do you manage tis case with Tapestry ?? Thanks Cyrille I am just telling the obvious, I know, but maybe it's a start: - You could leave getLastname() in your code and make it call getName(). With this wrapper you will not have to change any OGNL expressions. - Make a textual search for "lastname" in all you files...? Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Component with mixed functionality?
Thanks, Matt, for your response. On 16.12.2007, at 02:13, Matt Brock wrote: The problem is that I don't think your even/odd requirement will work with any of the regular Tapestry components. Normally you iterate over a collection of values (the @For component, for example), and use an OGNL expression like class="ognl:(index % 2 == 0 ? 'even' : 'odd')" to determine whether the row is odd or even. But the problem is, not all of your rows are going to be rendered. So what happens when the first row's @If condition evaluates true, the second row's condition evaluates false, then the third evaluates true? You'll end up with two rows both marked "even". That's exactly what was happening in my case! The easiest way to do this would be to write your own renderComponent method. That way you get complete control over the output. This has the added advantage of bypassing the OGNL parser. You don't need a component definition file (.jwc) or an HTML file, either. Just a single java class. Something like this: MyComponent.java public abstract class MyComponent extends AbstractComponent { @Parameter public abstract MyObject getMyObject(); protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) { // You can also use the writer.begin/writer.attribute way of doing things, but this is faster. StringBuffer output = new StringBuffer(); output.append(""); int i = 0; if (getMyObject().getTitle() != null) { output.append("
"); i++; } if (getMyObject().getNextProperty() != null) { output.append(" ").append(getMyObject().getTitle()).append (" "); i++; } ...etc... output.append(" "); writer.print(output,true); } } I get it. -- I finally took Kristian's suggestion as it allowed me to keep my markup in a HTML-file (even though I don't know whether the latter is worth it). Thanks! Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ").append(getMyObject().getNextProperty ()).append("
Re: Component with mixed functionality?
On 11.12.2007, at 12:30, Kristian Marinkovic wrote: have you tried: Wow, so simple! Thanks a lot. I feel almost ashamed: of course, informal properties can be used and they have OGNL-power, too! Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Contrib:Table and page parameters
Hm, I think my question was not well formulated. Apologies. I'll try once more! Suppose you want to implement an index that shows all files starting with "A", "B", etc. My page would show A B C D ... X Y Z and you can click on a letter to show the files starting with this letter in a sortable Contrib:Table. How would I do this? Can somebody lead me on the right track? Thanks! Kaspar On 16.12.2007, at 17:08, Kaspar Fischer wrote: Hi list, How can I tell Contrib:Table to pass on page paremeters? When I click on a table column to sort it, the page that opens does not have the page parameters of the old page anymore! More precisely, my page "Page.html" uses a paremeter (nodeid) to know what content to display. So in Page.java's pageBeginRender() method I have String nodeIdParam = cycle.getParameter("nodeid"); and then I load the data from a database and display a few things in a Contrib:Table. Unfortunately, the link that the Contrib:Table generates in order to sort a column does not contain the value for parameter "nodeid": http://localhost:8080/kc/ Page,tableColumnComponent.linkColumn.sdirect?container=Contrib% 3ASimpleTableColumnPage&sp=APage%2C% 24SortableTable.table.tableView&sp=SnodeTableTitle So when I click the link, my node does not know what data to load from the database! I think I need to tell Contrib:Table to include the nodeid in the link, right? How can I do this? Many thanks, Kaspar - 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]
Contrib:Table and page parameters
Hi list, How can I tell Contrib:Table to pass on page paremeters? When I click on a table column to sort it, the page that opens does not have the page parameters of the old page anymore! More precisely, my page "Page.html" uses a paremeter (nodeid) to know what content to display. So in Page.java's pageBeginRender() method I have String nodeIdParam = cycle.getParameter("nodeid"); and then I load the data from a database and display a few things in a Contrib:Table. Unfortunately, the link that the Contrib:Table generates in order to sort a column does not contain the value for parameter "nodeid": http://localhost:8080/kc/ Page,tableColumnComponent.linkColumn.sdirect?container=Contrib% 3ASimpleTableColumnPage&sp=APage%2C% 24SortableTable.table.tableView&sp=SnodeTableTitle So when I click the link, my node does not know what data to load from the database! I think I need to tell Contrib:Table to include the nodeid in the link, right? How can I do this? Many thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Component with mixed functionality?
Hi! My page needs to output a table with a fixed, predefined number of rows. Some of these rows may have empty content and should not be rendered. Each row has a different type (one is a date, another a string, etc.) and I want a class of "even" or "odd", respectively, be attached to . My first attempt was Title The problem is: the already is a component (@If) but I need to attach additional behaviour (class should alternate between "even" and "odd"). What's an easy way to accomplish this? Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Single OGNL expression evaluated several time s is it normal?
On 02.12.2007, at 00:58, Kevin Menard wrote: This is a known issue and is pending resolution. Okay, thanks for the information. Kaspar P.S. Is there an issue number for the issue on http://issues.apache.org/jira/browse/TAPESTRY I could not find it there. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Single OGNL expression evaluated several times – is it normal?
Hi, My Page.html contains a single Tapestry component: Title Why is my page's method getTitle() executed several times? 15:23:11,106 User:admin DEBUG [knowledgecenter.pages.NodePage] NodePage.pageBeginRender(). 15:23:11,188 User:admin DEBUG [knowledgecenter.pages.NodePage] NodePage.getTitle(). 15:23:11,204 User:admin DEBUG [knowledgecenter.pages.NodePage] NodePage.getTitle(). 15:23:11,244 User:admin DEBUG [knowledgecenter.pages.NodePage] NodePage.getTitle(). 15:23:11,377 User:admin DEBUG [knowledgecenter.pages.NodePage] NodePage.pageEndRender(). Is this normal or have I misconfigured Tapestry in some way? Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using Hivemind to wrap a transaction around a request
Hi list, I need to wrap "begin transaction" and "end transaction" actions around a request cycle. I've read about Hivemind, http://www.nabble.com/hivemind-factory-service-tf251931.html#a704856 and configured a service point (see below). This works very well: my transaction is created, but I cannot see when it is closed (committed)? More precisely, * What method is called on the object created by the factory when it is discarded? It is threadDidDiscardService(), right? * Using a model="threaded" approach as I am doing, when exactly does a thread end in Tapestry? It seems I am wrong in assuming that the thread handles the request cycle and is then cleaned/ended! * How can I catch exceptions so that I can do a rollback instead of a commit? Many thanks, Kaspar -- Here's my configuration: interface="org.my.tapestry.alfresco.AlfrescoTransactionContext" id="alfrescoContext"> model="threaded" /> interface="org.apache.hivemind.ServiceImplementationFactory" id="AlfrescoTransactionFactory" parameters-occurs="none"> class="org.my.tapestry.alfresco.AlfrescoTransactionFactory" /> Here is my facory: public class AlfrescoTransactionFactory implements ServiceImplementationFactory, Discardable { public Object createCoreServiceImplementation (ServiceImplementationFactoryParameters factoryParameters) { System.err.println("createCoreServiceImplementation"); // gets called! UserTransaction transaction; ServiceRegistry serviceRegistry; try { transaction = AlfrescoApplicationInitializer.createAndBeginAuthenticatedTransaction (true); serviceRegistry = AlfrescoApplicationInitializer.getServiceRegistry(); } catch (Exception e) { throw new ApplicationRuntimeException("Could not create an Alfresco transactoin.", e); } return new AlfrescoTransactionContextImpl(transaction, serviceRegistry); } public void threadDidDiscardService() { System.err.println("threadDidDiscardService"); // never called! } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic pages (or: arguments to pages) [T4]
On 29.11.2007, at 11:02, Ulrich Stärk wrote: These are just guesses, I haven't tried them nor verified them. I could imagine that the parameter isn't available via the WebRequest because the page didn't get called by a GET request directly but with the help of the service encoder, so your parameter isn't there anymore when the page get's rendered. Try to get hold of the IRequestCycle by calling getRequestCycle() and call getParameter on it. I wouldn't be surprised if it's in there. Hi Uli, That was it! It turns out that the @InjectObject("infrastructure:request") public abstract WebRequest getRequest(); is not needed anymore with this solution. Thanks a lot for the help, Kaspar P.S. For the sake of completeness, here is the complete solution -- in case somebody else needs it. public abstract class MyPage extends BasePage implements PageBeginRenderListener { public void pageBeginRender(PageEvent event) { super.pageBeginRender(event); // find out the node we're suppost to show IRequestCycle cycle = getRequestCycle(); String myParam = cycle.getParameter("myParam"); } // ... } public class KCNodeServiceEncoder implements ServiceEncoder { // ... public void decode(ServiceEncoding encoding) { // ... (get parameter value from URL) encoding.setParameterValue("myParam", value); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic pages (or: arguments to pages) [T4]
Unfortunately, my solution does not really work yet. My page uses @InjectObject("infrastructure:request") public abstract WebRequest getRequest(); public void pageBeginRender(PageEvent event) { super.pageBeginRender(event); WebRequest request = getRequest(); id = request.getParameterValue("id")); // (*) } to read the Id of the page to display. This indeed works: http://localhost/app?id=someid results in id from (*) being set to "someid". I now wanted to support friendly URLs and wrote a ServiceEncoder whose decode() method extracts the Id form a URL like http://localhost/node/id.html and sets it: public void decode(ServiceEncoding encoding) { // ... String id = // ... encoding.setParameterValue(ServiceConstants.SERVICE, Tapestry.PAGE_SERVICE); encoding.setParameterValue(ServiceConstants.PAGE, _className); encoding.setParameterValue("id", id); } But although the variable encoding contains the parameter "id" with its value (I verifed this), the page's pageBeginRender() from above receives null. I feel I misunderstand something here. Why are parameters not passed on to the page request? Many thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Caching: dependency on session data [OT?]
Dear All, I've tried to search for information on Tapestry's caching mechansism but could not find anything regarding depency on session data (like logged in users). Reading from http://www.nabble.com/RE%3A-Page-caching-nightmare-p3574110.html I understand that tapestry has its page pool but does not cache rendered pages. Is this correct? If so, my next question is slightly off-topic: How can I implement caching? Lots of data I display on my Tapestry pages is pulled from a DB and this might be expensive. I see two approaches: * Caching "in front of T": use some page cache that caches the HTML output by T * Caching "behind T": use a caching layer between T and my DB The first approach seems easier but becomes complicated as soon as my pages depend on session data (e.g., the page displays the name of the logged in user -- you'd have to use a per-user page cache). Because my pages change frequently, I need -- in both approaches -- a cache that allows "dependencies". That is, the cache should not just be a (stored) hash-map but each stored entry may have a list of dependent pages: If one of the latter changes, the entry in the cache gets invalidated. For instance, page A depends on content from no other page, page B depends on {A} (because it links to it, showing its title, for instance), page C depends on {A, B}. After some time, all three pages are cached. If I change B, then the cache should invalidate B and C but should leave the cache entry for A in the cache. Does anybody have any experiences with a mechansism like this? Are there any caching libraries out there that accomplish this? Many thanks and please excuse the slightly off-topic nature of this post. Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic pages (or: arguments to pages) [T4]
Ulrich, Andy, Jesse, Jonathan, and Andy, thanks a lot for the many responses and tips! I am using T4 and have implemented it by injecting the web request into my page and using a URL encoder for friendly URLs. Regards, Kaspar On 27.11.2007, at 01:54, Andy Huhn wrote: Kaspar, If you're using T5, see http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html Especially the section titled "Page activation". Andy On Mon, 2007-11-26 at 19:49 +0100, Kaspar Fischer wrote: Hi All, I am new to Tapestry and would be glad to receive a hint on how to realize "dynamic pages", i.e., pages whose content depends on GET arguments. I have a database full of articles, each having an Id, and I want to show each article on its own page. In PHP, I would have used URLs like http://my.organization.org/app?page=article&id=2832 to display article with Id 2832. I am not quite sure what the Tapestry way for such a problem is. I've coded a page ArticlePage that extends BasePage and now need a way to learn the Id from the URL. How can I do this? Many thanks, Kaspar - 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: Using Alfresco from within Tapestry
On 27.11.2007, at 13:36, adasal wrote: I've been wondering about this exchange. I haven't looked this up, but if this is a problem of sharing across Servlet container contexts then are you trying "to do what ought not to be done"? You are right. A different setup would definitely be more appropriate. For instance, a "clustered repository server", as described on http://wiki.alfresco.com/wiki/Alfresco_Repository_Architecture Why can't you unpack Alfresco and add in Tapestry to the existing context? You have access to Alfresco source which might help as well. I am asking myself whether this is so much better? It would mean that we have Alfresco's Web Client (first "webapp") and our own Tapestry "webapp" together in one webapp, one JSF-based, the other Tapestry-based? Does not sound so nice to me. Or do you mean to go with two webapps and copy all Alfresco code to our Tapestry-based webapp? This does not work as this Alfresco code is not intended to be run twice (it will listen on the same port twice, create caches twice, etc.). For this, a clustered setup would be better suited (see above). Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Alfresco from within Tapestry
Hi all, With the help of the list and another insight into the "crossContext" attribute of Tomcat I've finally found a solution. Thanks for your time! The deails for my particular application are documented here: http://wiki.alfresco.com/wiki/ Alfresco_and_Tapestry_on_the_Same_Tomcat_Installation I hope this helps others that need to do a similar thing. Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dynamic pages (or: arguments to pages)
Hi All, I am new to Tapestry and would be glad to receive a hint on how to realize "dynamic pages", i.e., pages whose content depends on GET arguments. I have a database full of articles, each having an Id, and I want to show each article on its own page. In PHP, I would have used URLs like http://my.organization.org/app?page=article&id=2832 to display article with Id 2832. I am not quite sure what the Tapestry way for such a problem is. I've coded a page ArticlePage that extends BasePage and now need a way to learn the Id from the URL. How can I do this? Many thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Alfresco from within Tapestry
Hi, I am still working on how to get access, from my Tapestry webapp in Tomcat, to a Spring bean called "nodeService" which is from a different webapp of Tomcat (Alfresco in this case). In my previous post, I have run into a problem with the load order: Alfresco was loaded by Tomcat after Tapestry and because of this, the bean was not found (it obviously does not yet exist when my Tapestry webapp starts). I've managed to find a way around this by telling the bean "alfrescoContext" (see below) to load lazily: class="org.icarbasel.tapestry.knowledgecenter.alfresco.AlfrescoApplicati onContext" lazy-init="true"> (The rest is the same as in my previous post.) I know get an exception Error creating bean with name 'alfrescoContext' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'nodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'nodeService' is defined I am asking myself now: Is Spring using a different "context" and does not look in the webapp Alfresco for "nodeService" but only in Tapestry's Spring "context"? Any idea what is going wrong here? Regards, Kaspar P.S. For the sake of completness I add my whole set of configuration/ Java files. // WEB-INF/applicatonContext.xml http://www.springframework.org/dtd/spring-beans.dtd";> class="org.icarbasel.tapestry.knowledgecenter.alfresco.AlfrescoApplicati onContext" lazy-init="true"> // relevant part of web.xml contextConfigLocation WEB-INF/applicationContext.xml class>org.springframework.web.context.ContextLoaderListenerclass> // AlfrescoApplicationContext.java package org.icarbasel.tapestry.knowledgecenter.alfresco; import org.alfresco.service.cmr.repository.NodeService; public class AlfrescoApplicationContext { private NodeService nodeService; public void setNodeService(NodeService nodeService) { System.err.println("Received nodeService " + nodeService); this.nodeService = nodeService; } public NodeService getNodeService() { return this.nodeService; } } // ... and my page which spits out some dummy text public abstract class NodePage extends BasePage { @InjectObject("spring:alfrescoContext") public abstract AlfrescoApplicationContext getAlfrescoContext(); public String getGreetingSubject() { System.err.println(getAlfrescoContext().getNodeService()); return "dummy"; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Get application context from within a BasePage subclass
On 20.11.2007, at 19:08, Ulrich Stärk wrote: What version of Tapestry are you referring to? Tapestry 5 doesn't use subclasses of BasePage anymore, that's Tapestry 4. But you are trying to use T5s spring integration, that is a little bit odd... Have a look here http://www.nabble.com/another-tapestry-4.1.3- archetype-tf4754756.html#a13600914 for a link to a maven archetype I created which integrates Tapestry 4.1.3, Spring 2.0.7 and Hibernate. There's also some instructions on how to use this archetype. Cheers, Uli Aie, embarrassing!! I am indeed mixing Tapestry 5 and 4.1. But thanks for the pointers, Uli and Michael, I gladly take a look at them. Thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Get application context from within a BasePage subclass
Hi, The Tapestry reference, http://static.springframework.org/spring/docs/2.0.x/reference/ webintegration.html#webintegration-common says that "[...] one can use the following code snippet to get access to this 'business context' ApplicationContext created by the ContextLoaderListener": WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext); How would I do this from within a page (i.e., a subclass of BasePage)? IIUC, a page need not have an associated servletContext. So what sort of indirection would I use? I am trying to get the Spring WebApplicationContext service that (apparently) the tapestry-spring.jar, http://tapestry.apache.org/tapestry5/tapestry-spring/ adds. My finally goal is to load a Spring bean from a page to do some processing. Many thanks and sorry for the simple question (I am a Tapestry newbie!), Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Alfresco from within Tapestry
On 20.11.2007, at 07:23, <[EMAIL PROTECTED]> wrote: If your Tomcat instance is dedicated to alfresco and your tapestry app, I would try to go with the shared/lib approach. Logging in Tomcat is a bit complicated to get right due to the funny classloading hierarchy and commons-logging's log-method detection. I put commons-logging into each web-app's lib *and* common/lib. Then, I need commons-logging.properties in common/classes to point to log4j as backend-impl. Again, many thanks, Marcus! Your tip helped me and I have the Tomcat logging fixed. I followed your instructions and the ones from the Spring user manual, http://static.springframework.org/spring/docs/2.0.x/reference/ webintegration.html#view-tapestry-40-style-di and everything works beautifully up to the load order of the webapps: As my module starts before Alfresco, I cannot reference the (yet non- existing) bean of Alfresco that represents the Alfresco Node Service! Here's the situation in more detail: I have an application context like this http://www.springframework.org/dtd/spring-beans.dtd";> class="org.icarbasel.tapestry.knowledgecenter.alfresco.AlfrescoApplicati onContext"> Foo with a bean class AlfrescoApplicationContext.java that simply receives the value ("Foo" in this case). My web.xml contains contextConfigLocation WEB-INF/applicationContext.xml class>org.springframework.web.context.ContextLoaderListenerclass> and my page class is this: public abstract class NodePage extends BasePage { @InjectObject("spring:alfrescoContext") public abstract AlfrescoApplicationContext getAlfrescoContext(); // .. } Everything works fine up to the point when I change 'Foo' to '' in my bean (and of course change the type in the bean class from String to Alfresco's NodeService). At this point I get at startup ERROR main org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'alfrescoContext' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'nodeService' while setting bean property 'nodeService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'nodeService' is defined And I sort of understand it: At this point, Alfresco is started by Tomcat after my Tapestry webapp and it seems that due to its multi- threaded nature, one cannot require a particular order in which the webapps are deployed. Any suggestion as to what I could do? I though about calling Spring's getBean() not at startup but at a later point but do not have any idea which application context to use, i.e., how to obtain an application context at all!? Thanks in advance for any pointer! Best, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Alfresco from within Tapestry
Marcus, many thanks for your kind reply. Your link helped me to get started and I think I see the way. Unfortunately, I've run into a (Alfresco specific?) problem. But maybe one of you has run into a similar one and can help? The problem is this: Alfresco and my Tapestry webapp run as follows in Tomcat: tomcat webapps alfresco.war <-- Alfresco webapp wtpwebapps ROOT <-- don't know, probably not important mywebapp <-- my Tapestry app shared lib <-- empty classes <-- empty Unfortunately, all Alfresco code is in alfresco.war (inside: alfresco/ WEB-INF/lib/) including Spring 2.0.2 itself. So if my webapp mywebapp wants to use this code, the Alfresco/Spring jars should be in shared/ lib/, right? Otherwise I get java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener. But it seems I cannot move/copy the jars as I get strange warnings about logging being disabled. So what is the best way to share Alfresco's jars with another webapp? Could it be that changing "shared.loader" in tomcat/conf/ catalina.properties to include webapps/alfresco/WEB-INF/lib helps? I am very reluctant to do something drastic like this. I'd be very glad to receive some more help as I am rather lost here. Many thanks, Kaspar P.S. The jars in question (in alfresco.war:WEB-INF/lib/) are: acegi-security-0.8.2_patched.jar activation.jar addressing-1.0.jar alfresco-core.jar alfresco-deployment.jar alfresco-external-content.jar alfresco-linkvalidation.jar alfresco-mbeans.jar alfresco-php.jar alfresco-remote-api.jar alfresco-repository.jar alfresco-web-client.jar alfresco-web-framework.jar ant.jar antlr-2.7.5H3.jar aopalliance.jar avalon-framework-4.2.0.jar axis-1.4.jar bcel.jar bcmail-jdk15-137.jar bcprov-jdk15-137.jar bsf-2.4.0.jar bsh-1.3.0.jar catalina.jar cglib-nodep-2.2_beta1.jar chiba-1.3.0.jar commons-beanutils-1.7.0.jar commons-codec-1.3.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-digester-1.6.jar commons-discovery-0.2.jar commons-el.jar commons-fileupload-1.1.1.jar commons-httpclient-3.0.jar commons-io-1.1.jar commons-jxpath-1.2.jar commons-lang-2.1.jar commons-logging-1.1.jar commons-modeler.jar commons-pool-1.3.jar commons-validator.jar cpool.jar derivatives.jar dom4j-1.6.1.jar ehcache-1.3.0-patched.jar facebook_070716.jar fontbox-0.1.0.jar fop-0.92beta.jar freemarker-2.3.10.jar guessencoding-1.0.jar hibernate-3.2.1.jar hrtlib.jar hsqldb.jar htmlparser-1.6.jar icar-knowlege-center.jar icu4j_3_6_1.jar jakarta-oro-2.0.8.jar jaxen-1.1-beta-8.jar jaxrpc.jar jbpm-identity-3.2.jar jbpm-jpdl-3.2-patched.jar jcr-1.0.jar jgroups-2.2.8.jar jibx-bind.jar jibx-run.jar jid3lib-0.5.jar JMagick.jar joda-time-1.2.1.jar jooconverter-2.1.0.jar json.jar jstl-1.1.0.jar jta.jar jug.jar jut.jar log4j-1.2.15.jar lucene-analyzers-2.1.0.jar lucene-core-2.1.0.jar lucene-snowball-2.1.0.jar mail.jar myfaces-api-1.1.5.jar myfaces-impl-1.1.5.jar naming-factory.jar naming-resources.jar odf_utils.jar odmg-3.0.jar openoffice-juh-2.0.3.jar openoffice-jurt-2.0.3.jar openoffice-ridl-2.0.3.jar openoffice-sandbox-2.0.3.jar openoffice-unoil-2.0.3.jar opensaml-1.0.1.jar pdfbox-0.7.3.jar poi-2.5.1_patched.jar portlet-api-lib.jar quartz-1.6.0.jar quercus.jar resin-util.jar resolver.jar rhino-js-1.6R7.jar saaj.jar saxpath.jar shale-test-1.0.4.jar spring-2.0.2.jar springmodules-jbpm31.jar standard.jar subetha-smtp.jar tlc124.jar tm-extractors-0.4_patched.jar tomcat-coyote.jar tomcat-util.jar truezip.jar webclientassoclinkssupport.jar webclienttinymcesupport.jar wsdl4j-1.5.1.jar wss4j.jar xercesImpl-2.8.0.jar xml-apis.jar xmlgraphics-commons-1.0.jar xmlsec-1.4.1.jar xpp3-1.1.3_8.jar xstream-1.1.3.jar On 18.11.2007, at 19:13, Marcus Schulte wrote: Have a look at http://hivemind.apache.org/hivemind1/hivemind-lib/ SpringLookupFactory.html I'm not familiar with Alfresco, but this should get you started with using any kind of Spring bean from HiveMind (and Tapestry). You'll probably need to add a couple of hooks to your Tapestry app's web.xmlto make sure, that the Spring BeanFactory is properly initialized. 2007/11/18, Kaspar Fischer <[EMAIL PROTECTED]>: Hi there! I am completely new to Tapestry and would like to use it in order to display content from an Alfresco data repository. More precisely, I have a folder ("space", in Alfresco's terminology) in Alfresco and I want to create a dynamic webpage for each file in this folder. The webpage shows some properties of the file and I want to obtain these properties by calling Alfresco's Node Service API. I have tried to find some information on how to start here. I have the book "Enjoying Web Development with Tapestry" but need a hint on how to get an Alfresco session from within Tapestry. Alfresco and Tapestry will run on the same installation of Tomcat. Can I then just l
Using Alfresco from within Tapestry
Hi there! I am completely new to Tapestry and would like to use it in order to display content from an Alfresco data repository. More precisely, I have a folder ("space", in Alfresco's terminology) in Alfresco and I want to create a dynamic webpage for each file in this folder. The webpage shows some properties of the file and I want to obtain these properties by calling Alfresco's Node Service API. I have tried to find some information on how to start here. I have the book "Enjoying Web Development with Tapestry" but need a hint on how to get an Alfresco session from within Tapestry. Alfresco and Tapestry will run on the same installation of Tomcat. Can I then just load Alfresco's Node Service bean from within Tapestry and use it?! Could anybody help me with a pointer or a very high-level list of the necessary steps? Many thanks, Kaspar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]