2011/11/7 Thiago H. de Paula Figueiredo <[email protected]> > On Sat, 05 Nov 2011 18:24:17 -0200, Felix Scheffer <
[email protected] > > wrote: > Hi everyone, >> > > Hi! > > Thanks for the response. i spent some time working on the portlet support based on the work of >> Markus Feindler, Trun Le Xuan and Kristina B. Taylor. >> The source can be found at: >> http://code.google.com/p/tapestry5-portlet-support/ >> > > Nice! > > 1) StreamResponses are difficult to deal with. They require an >> OutputStream to which we can write the content of the stream but portlet >> ActionResponse is not supposed to return content and therefore does not >> have an >> OutputStream. So we can not use ActionURLs for events that return >> StreamResponses. I thought about redirecting these requests to a >> ResourceRequest which could then return the content of the StreamResponse >> but i am not sure if this is a good approach (or a feasible one). >> > > Couldn't you just let Tapestry itself take care of that (a.k.a. invoking > ComponentEventResultProcessor.processResultValue())? StreamResponseResultProcessor.processResultValue(...) is calling response.getOutputStream(...). I had to write a portlet-specific implementation of Tapestry's Response interface because portlets dont have a HttpServletResponse. The implementation wraps around the different portlet's responses. During the action lifecycle phase it wraps around ActionResponse which does not have an OutputStream... > 2) EventLinks dont support AJAX right now. For ActionLinks it's quite >> easy to determine if they are bound to a Zone but i haven't found a way to >> do >> the same for EventLinks in >> ComponentEventLinkEncoder.createComponentEventLink(). >> > > ActionLink and EventLink are almost the same, so I don't know why > something would work in one and not in the other. ActionLink is basically > an EventLink with the event property hardwired to "action". > > Anyway, check the source of RequestImpl.isXHR(). > The following code works fine for ActionLinks: Link createComponentEventLink(ComponentEventRequestParameters parameters, boolean forForm) { ... String containingPageName = parameters.getContainingPageName(); String nestedComponentId = parameters.getNestedComponentId(); Component component = this.componentSource.getComponent(containingPageName + ":" + nestedComponentId); ComponentResources componentResources = component.getComponentResources(); boolean isAjaxRequest = componentResources.isBound("zone"); ... } For EventLinks, nestedComponentId is always null. > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br >
