RE: Converting T3 to T4 issues
1. The method getRequestContext() is undefined for the type IRequestCycle. The RequestContext doesn't exist anymore. Now we have the Infrastructure object. Also, in order to support portlets, the Infrastructure object doesn't give you HttpServletRequest or HttpServletResponse objects, but instead give you a custom object called WebRequest and WebResponse. If you want a reference to the actual HttpServletRequest, you can inject it into the page. With Tapestry annotations, that's done like this: @InjectObject("service:tapestry.globals.HttpServletRequest") public abstract HttpServletRequest getRequest(); I'm not sure how to get a reference to the Servlet or ServletConfig, but I'm reasonably certain that it would be in a similar manner. 2. The method getServiceParameters() is undefined for the type IRequestCycle IRequestCycle.getServiceParameters() is now IRequestCycle.getListenerParameters(). 3. The method getObject(Class) in the type IBinding is not applicable for the arguments (String, Class) Retrieval of values from Ibinding objects has been simpllified; you now just call getObject(), or getObject(Class) if you want to perform an assignability check. So yeah, calling .getObject(Browser.class) should work just fine. 5. (What happened to 4? :))org.apache.tapestry.event.PageRenderListener; is not used in TP4 what should I use here? PageRenderListener was split into PageBeginRenderListener and PageEndRenderListener. The information is kind of spread around, so I can understand that it's a bit hard to find, but there are several pages to look to for this kind of help. Here are some I found useful: User's Guide: http://tapestry.apache.org/tapestry4.1/usersguide/index.html Component Reference: http://tapestry.apache.org/tapestry4.1/components/index.html Tapestry Wiki: http://wiki.apache.org/tapestry/ JavaDocs: http://tapestry.apache.org/tapestry4.1/apidocs/index.html Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T4 overriding properties unnecessarily?
Done. Here's the link to the JIRA issue. https://issues.apache.org/jira/browse/TAPESTRY-1545 Robert J. Walker -Original Message- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 06, 2007 4:38 PM To: Tapestry users Subject: Re: T4 overriding properties unnecessarily? I think there is no explanation other than it being a bug. None that come to mind at least. If you log a jira issue it can be addressed. On 6/6/07, Robert J. Walker <[EMAIL PROTECTED]> wrote: > > That did the trick. Thanks you, Christian. > > So that answers the question of how to get around the problem, but I still > want to understand why this happens. Is this a bug or desired behavior? If > the latter, why is it desired? > > Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T4 overriding properties unnecessarily?
That did the trick. Thanks you, Christian. So that answers the question of how to get around the problem, but I still want to understand why this happens. Is this a bug or desired behavior? If the latter, why is it desired? Robert J. Walker -Original Message- From: Christian Dutaret [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 06, 2007 12:48 PM To: Tapestry users Subject: Re: T4 overriding properties unnecessarily? i'd try to make isFinished() non-abstract in the SignupPage, and have it throw a runtime exception to make sure the base class implementation is never called 2007/6/6, Robert J. Walker <[EMAIL PROTECTED]>: > > I have an application that allows users to sign up for our service. One > thing the application needs to do is determine whether it needs to continue > to the next page or if it has enough information already. For example, some > of our clients pay for some or all of the service at the corporate level. If > a franchisee signs up for service that is completely paid by corporate, we > can stop before asking for their payment info. > > So there's an abstract base class for all the pages called SignupPage > which has an abstract method called isFinished(). This method should return > true if the "FINISH" button should be shown on this page instead of the > "Next" button. The individual page classes implement the isFinished() method > with whatever logic is needed to determine whether or not the user is > finished on that page. > > So here's the problem: In the case above, if I put a breakpoint in my > page's implementation of the isFinished() method, it never gets hit. A > little reflection reveals that Tapestry is overriding the page class's > implementation of the isFinished() method with one of its own which is > always returning false, resulting in the application asking for payment > information from users who don't owe anything. > > Making my implementation of isFinished() final results in a VerifyError > when I hit the page. If I instead make my implementation class non-abstract, > my IDE complains that I haven't implemented the clientId property, which to > my understanding is supposed to be provided by Tapestry. The > Locations.page file does not declare finished as a property or even > mention it. > > So the questions are: 1) Why is Tapestry creating an implementation of > this method when one already exists, and 2) how do I make it stop? Relevant > bits of code follow. > > Thanks, > > Robert J. Walker > > > SignupPage.java > public abstract class SignupPage extends BasePage { > ... > public abstract boolean isFinished(); > ... > } > _ > > Locations.java (one of several pages which extend SignupPage) > public abstract class Locations extends SignupPage { > ... > public boolean isFinished() { > // My logic goes here; this never gets executed > } > ... > } > _ > > Locations.html > ... > > > > > > > ... > > > - > 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 overriding properties unnecessarily?
I have an application that allows users to sign up for our service. One thing the application needs to do is determine whether it needs to continue to the next page or if it has enough information already. For example, some of our clients pay for some or all of the service at the corporate level. If a franchisee signs up for service that is completely paid by corporate, we can stop before asking for their payment info. So there's an abstract base class for all the pages called SignupPage which has an abstract method called isFinished(). This method should return true if the "FINISH" button should be shown on this page instead of the "Next" button. The individual page classes implement the isFinished() method with whatever logic is needed to determine whether or not the user is finished on that page. So here's the problem: In the case above, if I put a breakpoint in my page's implementation of the isFinished() method, it never gets hit. A little reflection reveals that Tapestry is overriding the page class's implementation of the isFinished() method with one of its own which is always returning false, resulting in the application asking for payment information from users who don't owe anything. Making my implementation of isFinished() final results in a VerifyError when I hit the page. If I instead make my implementation class non-abstract, my IDE complains that I haven't implemented the clientId property, which to my understanding is supposed to be provided by Tapestry. The Locations.page file does not declare finished as a property or even mention it. So the questions are: 1) Why is Tapestry creating an implementation of this method when one already exists, and 2) how do I make it stop? Relevant bits of code follow. Thanks, Robert J. Walker SignupPage.java public abstract class SignupPage extends BasePage { ... public abstract boolean isFinished(); ... } _ Locations.java (one of several pages which extend SignupPage) public abstract class Locations extends SignupPage { ... public boolean isFinished() { // My logic goes here; this never gets executed } ... } _ Locations.html ... ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [vote] remove renderTags default of true for @If/@Else? (tapestry 4.1.2 )
+1 default both to false, and to make changing the default apply at the app or library level rather than globally as indicated in the JIRA issue. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tap 4.1.1: Unable to add clientId() method
Figured out why it's happening. Any page that has a form on it and a method called getOrg() will crash. Details in JIRA: https://issues.apache.org/jira/browse/TAPESTRY-1415. Robert J. Walker -Original Message- From: Robert J. Walker [mailto:[EMAIL PROTECTED] Sent: Monday, April 16, 2007 1:33 PM To: Tapestry users Subject: Tap 4.1.1: Unable to add clientId() method I've just created a new page and was trying it out and I got a bizarre error when calling cycle.getPage() to get a reference to the new page: org.apache.hivemind.ApplicationRuntimeException: Error at context:/WEB-INF/PasswordUpdate.page, line 3, column 69: Error adding property clientId to class mshare.web.tapestry.page.PasswordUpdate: Unable to add method java.lang.String getClientId() to class $PasswordUpdate_34: [source error] no such field: apache [context:/WEB-INF/PasswordUpdate.page, line 3, column 69] at org.apache.hivemind.impl.StrictErrorHandler.error(StrictErrorHandler.java:39) at org.apache.hivemind.impl.ErrorLogImpl.error(ErrorLogImpl.java:40) at org.apache.tapestry.enhance.ClientIdPropertyWorker.performEnhancement(ClientIdPropertyWorker.java:54) at $EnhancementWorker_111fbcab83a.performEnhancement($EnhancementWorker_111fbcab83a.java) at $EnhancementWorker_111fbcab84e.performEnhancement($EnhancementWorker_111fbcab84e.java) at $EnhancementWorker_111fbcab822.performEnhancement($EnhancementWorker_111fbcab822.java) at org.apache.tapestry.services.impl.ComponentConstructorFactoryImpl.getComponentConstructor(ComponentConstructorFactoryImpl.java:103) at $ComponentConstructorFactory_111fbcab80f.getComponentConstructor($ComponentConstructorFactory_111fbcab80f.java) at org.apache.tapestry.pageload.PageLoader.instantiatePage(PageLoader.java:564) at org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:591) at $IPageLoader_111fbcab7ff.loadPage($IPageLoader_111fbcab7ff.java) at $IPageLoader_111fbcab800.loadPage($IPageLoader_111fbcab800.java) at org.apache.tapestry.pageload.PageSource.getPage(PageSource.java:119) at $IPageSource_111fbcab75f.getPage($IPageSource_111fbcab75f.java) at org.apache.tapestry.engine.RequestCycle.loadPage(RequestCycle.java:248) at org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:235) ... Caused by: org.apache.hivemind.ApplicationRuntimeException: Unable to add method java.lang.String getClientId() to class $PasswordUpdate_34: [source error] no such field: apache at org.apache.hivemind.service.impl.ClassFabImpl.addMethod(ClassFabImpl.java:295) at org.apache.tapestry.enhance.EnhancementOperationImpl.addMethod(EnhancementOperationImpl.java:397) at org.apache.tapestry.enhance.ClientIdPropertyWorker.createProperty(ClientIdPropertyWorker.java:99) at org.apache.tapestry.enhance.ClientIdPropertyWorker.performEnhancement(ClientIdPropertyWorker.java:50) ... 69 more Caused by: javassist.CannotCompileException: [source error] no such field: apache at javassist.CtBehavior.setBody(CtBehavior.java:347) at javassist.CtBehavior.setBody(CtBehavior.java:316) at org.apache.hivemind.service.impl.ClassFabImpl.addMethod(ClassFabImpl.java:288) ... 72 more Caused by: compile error: no such field: apache at javassist.compiler.MemberResolver.lookupField(MemberResolver.java:302) at javassist.compiler.MemberResolver.lookupFieldByJvmName(MemberResolver.java:288) at javassist.compiler.TypeChecker.fieldAccess(TypeChecker.java:829) at javassist.compiler.TypeChecker.atFieldRead(TypeChecker.java:770) at javassist.compiler.TypeChecker.atExpr(TypeChecker.java:571) at javassist.compiler.ast.Expr.accept(Expr.java:67) at javassist.compiler.TypeChecker.fieldAccess(TypeChecker.java:827) at javassist.compiler.TypeChecker.atFieldRead(TypeChecker.java:770) at javassist.compiler.TypeChecker.atExpr(TypeChecker.java:571) at javassist.compiler.ast.Expr.accept(Expr.java:67) at javassist.compiler.TypeChecker.fieldAccess(TypeChecker.java:827) at javassist.compiler.TypeChecker.atFieldRead(TypeChecker.java:770) at javassist.compiler.TypeChecker.atExpr(TypeChecker.java:571) at javassist.compiler.ast.Expr.accept(Expr.java:67) at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:653) at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:156) at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45) at javassist.compiler.JvstTypeChecker.atMethodArgs(JvstTypeChecker.java:220) at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:702) at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:681) at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:156)
Tap 4.1.1: Unable to add clientId() method
a:356) at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49) at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344) at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49) at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:384) at javassist.compiler.CodeGen.atStmnt(CodeGen.java:348) at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49) at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:285) at javassist.compiler.Javac.compileBody(Javac.java:212) at javassist.CtBehavior.setBody(CtBehavior.java:341) ... 74 more --- PasswordUpdate.page: http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";> --- The PasswordUpdate class itself is an abstract class extending BasePage. It does not already contain a clientId property, and it appears that Tapestry is trying to enhance the page to add a clientId property and encountering an error in the attempt. I have no idea why it's looking for a field named apache. The only place the word "apache" is even referenced is in the .page file's doctype. Any ideas? Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
renderTag
Another hiccup with 4.1 -> 4.1.1: We have a VXML application that stopped working after the conversion. Turned out the reason was that components like If, For, etc. by default used to not render their tags (renderTag="false") but now the default is true, In HTML this often isn't a big deal, but it really screwed up our VXML stuff. So I found out how to change the default via a global parameter, but now exception rendering looks awful, probably because the exception renderer is expecting the default value of renderTag to be true. Is there any way to set the default just for our pages and components, while leaving it alone for components from the Tapestry framework? Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ForBean: 4.1 to 4.1.1
I just upgraded from Tapestry 4.1 to 4.1.1. Now I'm having some problems with the For component. It seems that it was changed so that it stores the source list in hidden fields in the page and uses the stored version on rewind. I can understand why this might be useful, since it could be problematic if the source list changed on you between render and rewind. That being said, it causes two really big problems for me: 1. The download size of the page just got enormous. 2. The source list contains Hibernate entities, which are now detached on the rewind, causing errors. What I really want is the old behavior, which is to reload the list every time. I'll deal with the consequences of the list changing. Is there some way to get that behavior back, short of making my own component that subclasses ForBean and overrides getData()? Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Upgrade to 4.1.1 or wait to 4.12
So 4.1.2 is considered stable, then? It'd be really nice if the download box on the Tapestry home page showed the status of the various versions. Jesse Kuhnert wrote: > Go with 4.1.2. It's better than 4.1.1. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Radio button labels
I ultimately just created a LabeledRadio component that did the trick. It's not very flexible; the label ALWAYS immediately follows the radio button in the source, which may not always be desirable, but it does the job that we need it to do. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Back button = no cycle
53.service($ServletRequestServicer_1107562b853.java) * org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52) * $ServletRequestServicerFilter_1107562b84b.service($ServletRequestServicerFilter_1107562b84b.java) * $ServletRequestServicer_1107562b853.service($ServletRequestServicer_1107562b853.java) * org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53) * $ServletRequestServicerFilter_1107562b84f.service($ServletRequestServicerFilter_1107562b84f.java) * $ServletRequestServicer_1107562b853.service($ServletRequestServicer_1107562b853.java) * $ServletRequestServicer_1107562b845.service($ServletRequestServicer_1107562b845.java) * org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123) * org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:104) * javax.servlet.http.HttpServlet.service(HttpServlet.java:689) * javax.servlet.http.HttpServlet.service(HttpServlet.java:802) * org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) * org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) * org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174) * org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77) * org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) * org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) * org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) * org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) * org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) * org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) * org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) * org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) * org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) * org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) * org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) * org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) * org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) * java.lang.Thread.run(Thread.java:595) Looking at line 35 of AbstractTableViewComponent seems to indicate that the request cycle is null, which seems odd to me considering that the RequestCycle class itself is further up the call stack. Any ideas as to what's going on here? Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reading page specifications... *without* loading the page
Yeah, we've been considering Acegi, but that's a little more long-range. The only issue I have with using annotations for this is that I would have to create a class for every page in the app. As it stands right now, I'm able to reuse the same class for a fair number of my simpler pages without having a subclass for each one. Robert J. Walker -Original Message- From: Hugo Palma [mailto:[EMAIL PROTECTED] Sent: Monday, January 29, 2007 4:53 PM To: Tapestry users Subject: Re: Reading page specifications... *without* loading the page Without really answering your question, have you looked at tapestry-acegi (http://www.carmanconsulting.com/tapestry-acegi/). The Secured annotation is a life saver.. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Reading page specifications... *without* loading the page
My application has multiple security roles. To handle this, I have a ProtectedPage class that handles all the security stuff, and all pages that need to be secured descend from this class. It expects that the page specification have the following tag: In the validate() method, it reads that role name list, checks to see if the user has any of those roles and acts accordingly. All this works fine. The problem is, in my navigation I need to check each link to see if the user is allowed to navigate to that page, and hide the link if they aren't. This has two problems: 1) It has to load *all* the page specifications just to check one meta element on each. That sucks. 2) When page caching is enabled, it causes NullPointerExceptions since many of the pages require a reference to the request cycle to initialize themselves, which works fine when you're actually activating that page, but when you pull a page out of the pool without activating it, it often *won't* have a cycle. So are there any ideas out there on how I can read a in a page specification *without* initializing the page? Even just the string value would suffice. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Radio button labels
andyhot wrote: > if you use > > then > value="ognl:curChoice.label" raw="true"/> Nice idea, but it didn't recognize the clientId: prefix for some reason. When I changed it to its ognl equivalent (ognl:components.curRadio.clientId), this is what rendered for the first radio button: Yes The for value does not match the radio button id. The radio button appears to be getting its id from the surrounding RadioGroup. Weird. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Radio button labels
I'm having trouble rendering tags for individual radio buttons in Tapestry 4.1. Simplified example: This works fine, except that I'd like for each radio button to have a tag rendered for it so that the labels are actually clickable. There doesn't seem to be a simple way to do this since the Radio component, strangely, does NOT descend from IFormComponent, so the FieldLabel component refuses to have anything to do with it. The only solution I can think of is to create my own custom component (possibly subclassing Radio) that emits the radio button AND the label. Anyone else have a better idea? Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: encrypt query string
If you're using Tapestry 4, friendly URL support could probably help you here. Write a class that implements ServiceEncoder. Then implement decode(), where you read your encrypted data and translate it to standard Tapestry parameters, and encode(), where you do the reverse. Then apply the encoder to the tapestry.url.ServiceEncoders configuration in your hivemodule.xml file. Details can be found at http://tapestry.apache.org/tapestry4/UsersGuide/friendly-urls.html. Hope that helps, Robert W. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: AW: Re: AW: download a file
andreas a wrote: > Why not return an ILink from the listener ? > > http://tapestry.apache.org/tapestry4.1/usersguide/listenermethods.html Not sure about others, but I don't think this will work for me. I'm generating a PDF inside my listener, which I then wish to send to the client as a download. Any strategy for turning this into a URL won't work because there are too many variables for generating the PDF in the first place and I certainly can't serialize the byte array itself onto the URL. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: download a file
James Carman wrote: > I did this by creating my own "service" in T4. Have some code to share? I'm sure we'd all love to see it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tap4.1: No more action ID
Andreas Andreou wrote: > You'll have to rewrite this part to make use of the Direct service... > The Action service is gone in 4.1 - and that's why > cycle.getNextActionId() has no use now. That's what I thought; I was just praying that an easier way existed. *sigh* Oh, well. Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: download a file
Here's a method that will do what you're asking: // Tapestry 3 protected void download(IRequestCycle cycle, ByteArrayOutputStream content, String contentType, String filename) throws IOException { HttpServletResponse response = cycle.getRequestContext().getResponse(); response.setHeader("Content-disposition", "attachment; filename=" + filename); response.setContentType(contentType); response.setContentLength(content.size()); response.getOutputStream().write(content.toByteArray()); response.flushBuffer(); response.getOutputStream().close(); } // Tapestry 4 protected void download(IRequestCycle cycle, ByteArrayOutputStream content, String contentType, String filename) throws IOException { WebResponse response = cycle.getInfrastructure().getResponse(); response.setHeader("Content-disposition", "attachment; filename=" + filename); response.setIntHeader("Content-Length", content.size()); OutputStream stream = response.getOutputStream(new ContentType(contentType)); stream.write(content.toByteArray()); stream.flush(); stream.close(); } You should make sure that the filename you provide is compatible with the user's operating system, or you could run into problems. It's also advisable to make the file extension jive with the content type so that the user doesn't have to rename the file to open it. Hope this helps. Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tap4.1: No more action ID
So I'm trying to convert a component written for Tapestry 3.1 to Tapestry 4.1, and it has this little section of code: ... protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) { String actionId = cycle.getNextActionId(); IEngineService service = cycle.getEngine().getService(Tapestry.ACTION_SERVICE); Ilink link = service.getLink(cycle, this, new Object[]{actionId}); // Proceed to do stuff with the link } ... The problem, of course, is that IRequestCycle.getNextActionId() is gone. So my question is, how do I get this to work again, short of completely rewriting everything? Or is that my only option? Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
VoiceXML
Anyone out there know of a good VXML library for Tapestry 4.1? We have some VXML components that we wrote for Tapestry 3 that don't work in Tapestry 4.1, and it occurs to me that before I go whole hog and rewrite stuff, I should check to see if I would be reinventing the wheel. Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: User sessions overlapping ....
Are you sure that the properties that are "leaking" between sessions lives on the session? Might they actually be manually-created page properties that you forgot to clean up? If you haven't checked that already, I'd give it a look; it's usually the culprit of something like this in my experience. Robert J. Walker -Original Message- From: Stephane Decleire [mailto:[EMAIL PROTECTED] Sent: Thursday, January 04, 2007 4:00 PM To: users@tapestry.apache.org Subject: User sessions overlapping Hi, I have implemented a small application using the new possibilites of T4.1.1 (EventListener / ResponseBuilder) but when i made some tests from 2 differents computers, the properties of my session N°2 are impacted by the modifications made on the session N°1 using EventListener and vice versa !!! Has anybody already encountered seach a surprising behavior ?? I can't find the origin of such a bug in my code. Moreover, i thought that the isolation of the user session was guaranted by the servlet container (Jetty in my case). Thanks in advance for any advice ! -- Stéphane Decleire - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Migration experiences (3.0 -> 4.1? )
I've been migrating from 3.1 to 4.1, and yes, it's been pretty painful. The documentation found at http://tapestry.apache.org/tapestry4/ and http://tapestry.apache.org/tapestry4/UsersGuide/upgrade.html is woefully incomplete unless your application is very simple. I've been keeping notes on everything I've discovered in my migration efforts, so maybe I could post them on the Tapestry Wiki when I'm done. Robert J. Walker Marilen Corciovei wrote: > Hello, > > I have been working on a Tapestry based product started almost 2.5 years > ago. It's a CMS based product targeted at french cityhalls sites (as > described here: http://www.nemesisit.ro/clients/case-study ). This was > build on 3.0 beta and then on 3.0.3. Now it's in production from more > than one year and they want to begin a new cycle of developments. I want > to try to impose a migration on the new versions. As this does not seem > always usefull for non-technical people I am trying first to estimate > the efforts implied. I have also worked on 4.0 based projects and there > are some differences. 4.1 seems to finally remove all the deprecated > stuff in 4.0. > > What are your migration experiences from 3.0 to 4.0 or 4.1. Is there a > migration directly to 4.1 much too complicated, has anyone did that? The > project was quite large and on several ocasions I had to overwrite > components or use some "tricks". One aspect which I want to keep in mind > is that I did a migration from 2.3 to 3.0 in the past on an equaly large > project and I ended up with some very non-uniform code. Even if the > old .page or .jwc component definitions still worked I had no reason not > to use the @Component in template definitions so the pages are quite > strange to look on. It's rather obvious where all the new code is. So, I > would like to avoid having this "diversity" once again. > > Thank you, > Len > www.len.ro > > - 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: External page URL change in Tapestry 4
Well, in the meantime I read up more on ServiceEncoders and came to the conclusion that it shouldn't be too tough, so I went ahead and wrote one that seems to work fine. It was almost done by the time I got your post. The thing I like about this solution is that it doesn't require another library. :) I include the code below for anybody who's interested. Caveats: 1) It assumes /app instead of whatever your application might be using, 2) it's designed to work only for one page per instance, rather than all external pages in your app, and 3) it requires Java 1.5 (because of the for loop construct). All of these things could be changed easily enough. Obviously, I hope it's useful, but no warranty, yada yada yada. Robert = package mshare.web.tapestry.page; import org.apache.tapestry.engine.ServiceEncoder; import org.apache.tapestry.engine.ServiceEncoding; import org.apache.tapestry.services.ServiceConstants; /** * Decodes old Tapestry 3 external page URLs and converts them to Tapestry 4 URLs. It does not * re-encode them back to Tapestry 3 URLs, since this is only here to provide backward support for * the Tapestry 3 URLs. * @author Robert J. Walker */ public class Tap3ExternalPageEncoder implements ServiceEncoder { private static final String TAP_3_PARAM_NAME = "service"; private static final String EXTERNAL_SERVICE = "external"; private static final String SERVICE_PARAMETER = "sp"; private String pageName; public void decode(ServiceEncoding encoding) { String tap3Param = encoding.getParameterValue(TAP_3_PARAM_NAME); // No service parameter? if(tap3Param == null) { return; } String[] arr = tap3Param.split("/"); // Serivce name has a slash? if(arr.length != 2) { return; } // It's the external service? if(!EXTERNAL_SERVICE.equals(arr[0])) { return; } // Right page? if(!arr[1].equals(pageName)) { return; } // Update servlet path StringBuilder path = new StringBuilder("/app?"); path.append(ServiceConstants.SERVICE) .append('=') .append(EXTERNAL_SERVICE) .append('&') .append(ServiceConstants.PAGE) .append('=') .append(pageName); for(String param : encoding.getParameterValues(SERVICE_PARAMETER)) { path.append("&sp=").append(param); } encoding.setServletPath(path.toString()); // Update parameter values encoding.setParameterValue(ServiceConstants.SERVICE, EXTERNAL_SERVICE); encoding.setParameterValue(ServiceConstants.PAGE, pageName); } public void encode(ServiceEncoding encoding) { // Do nothing here; we don't want to encode the URLs back to Tapestry 3 style } public void setPageName(String pageName) { this.pageName = pageName; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
External page URL change in Tapestry 4
I'm upgrading our existing applications from Tapestry 3.1 to Tapestry 4.1. One problem we have is that we send emails to our users with links to an IExternalPage. The URL format for this has changed in Tapestry 4, so when we release, all the links in emails sent before the release will be broken. I imagine that it must be possible to set up an URL encoder to translate the old URLs to the new ones. I also imagine that someone else out there must have already encountered this and written one, but I've been unable to find any such thing. I'd rather not re-invent the wheel if the solution already exists. Robert J. Walker - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]