Re: update a zone from within a component
Indeed, that would do the trick just nicely. I was thinking way too complicated, thanks Igor. Uli On 27.07.2009 22:29 schrieb Igor Drobiazko: I'm not sure I understand completely what you are trying to do but why don't you publish an event inside the handler method of the component. This event can be handled in the handler method of the containing page by returning the zone's body. On Mon, Jul 27, 2009 at 8:41 PM, Ulrich Stärk wrote: That's not what I was asking for. Maybe I was a bit unclear. Triggering the update itself is not the problem but returning the correct content for updating the zone from the event handler method of the component. The zone should update itself with it's own content and that's the problem. Inside the component I don't have direct access to the Zone on the page. Passing the Zone as a parameter to the component works but calling getBody() on it returns nothing it seems. I now have to use ComponentSource to locate the zone in the page and then I can return it's body from the event handler mehtod. That works but is ugly. Uli On 27.07.2009 19:54 schrieb Thiago H. de Paula Figueiredo: Em Mon, 27 Jul 2009 10:20:08 -0300, Ulrich Stärk escreveu: Hi List, Hi! How can I update a zone on a page from within a component placed on that page? I can successfully pass the zone's id to the enclosed component but I can't return the zone's body in any of the components handler methods. How can I get a handle on the zone? In https://issues.apache.org/jira/browse/TAP5-569, Fernando Padilla posted some very useful Javascript code that I've used successfully in a project. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Audit logging - how to acces SSO in Hibernate
What i am doing is to contribute a PageRenderRequestHandler like this: public static void contributePageRenderRequestHandler(OrderedConfiguration configuration, final @Local @InjectService("securityContextPageRenderRequestFilter") PageRenderRequestFilter securityContextPageRenderRequestFilter) { configuration.add("securityContext", securityContextPageRenderRequestFilter, "after:*"); } I am using Chenillekit's access component: (http://www.chenillekit.org/chenillekit-access/index.html) so in the filter i get the WebSessionUser using the ApplicationStateManager. Here u should get the object from the session. Just be sure that the filter is executed after the WebSessionUser is put into the session. the filter look like this: public class SecurityContextPageRenderRequestFilter implements PageRenderRequestFilter { private final ApplicationStateManager _manager; private final Logger _logger; /** * @param manager * @author jmayaalv */ public SecurityContextPageRenderRequestFilter(ApplicationStateManager manager, Logger logger) { super(); _manager = manager; _logger = logger; } public void handle(PageRenderRequestParameters parameters, PageRenderRequestHandler handler) throws IOException { RincoSessionUser webSessionUser = (RincoSessionUser) _manager.getIfExists(WebSessionUser.class); if (webSessionUser != null) { SecurityContext securityContext = new SecurityContext(webSessionUser.getUserId()); SecurityContextHolder.set(securityContext); _logger.debug("SecurityContext added to the thread {} ", new Object[] { securityContext }); } handler.handle(parameters); } } SecurityContextHolder is the class that interacts with threadlocal: public class SecurityContextHolder { private static ThreadLocal tLocal = new ThreadLocal(); public static void set(SecurityContext securityContext) { tLocal.set(securityContext); } public static SecurityContext get() { return tLocal.get(); } public static void remove() { tLocal.remove(); } } U can get the SecurityContext during the thread execution with: SecurityContextHolder.get() Let me know if u need something else On Tue, Jul 28, 2009 at 12:25 AM, "Max Weißböck (info)" wrote: > Ok, I think I get the idea... > > But where and when do you set the ThreadLocal? It must be set on every > request (each request is another thread...) > Do you have a common base class where you handle this? Any other way you do > it? > > Max > > > Am 28.07.2009 um 00:08 schrieb Juan E. Maya: > >> Hey Max, I had a similar problem and at the end create an object in >> the ThreadLocal that contains a SecurityContext with the user >> information (very lightweight object). The idea was taken from >> Spring-Security. This way u have access to the user in the execution >> thread. It was kind of weird for me to be accessing the HttpSession in >> all the layers of the application. >> >> >> On Mon, Jul 27, 2009 at 11:18 PM, "Max Weißböck >> (info)" wrote: >>> >>> Sorry, my question seems not to be clear. >>> >>> It is not a Hibernate question, I now how to acces and set the attributes >>> using the event. >>> I already set the creation and modification date in each entity. >>> >>> But what I need too, is who (which user) did the creation/modification of >>> an >>> entity. >>> This information (the user) is in an SSO (WebUser in my case) but I could >>> not figure out, >>> how I can get access to this SSO from the Hibernate Listener Class. >>> >>> thx, Max >>> >>> Am 27.07.2009 um 22:42 schrieb Igor Drobiazko: >>> This is a Hibernate question, not Tapestry. Have a look into the event passed to your listener. There is a method called getEntity(). On Mon, Jul 27, 2009 at 10:34 PM, Max Weißböck (info) wrote: > I'm using Hibernate Listeners PreUpdateEventListener and > PreInsertEventListener to do audit logging in the DB. > > Now my problem is, how can I get access in the EventListenr class to > the > SSO where the user is stored? As Hibernate loads > the classes as defined in the config file (see below), I can not bind > them > using AppModule and @Inject something - or at least I do not know how. > > I searched the list but found no solution (or did not understand it ;-) > > Thx, Max > > --- definition in hibernate.cfg.xml --- > > > class="net.weissboeck.gimmo.entities.AuditListenerImpl"/> > class="net.weissboeck.gimmo.entities.AuditListenerImpl"/> > > > > -- Best regards, Igor Drobiazko >>> >>> >>> ---
Re: Audit logging - how to acces SSO in Hibernate
Ok, I think I get the idea... But where and when do you set the ThreadLocal? It must be set on every request (each request is another thread...) Do you have a common base class where you handle this? Any other way you do it? Max Am 28.07.2009 um 00:08 schrieb Juan E. Maya: Hey Max, I had a similar problem and at the end create an object in the ThreadLocal that contains a SecurityContext with the user information (very lightweight object). The idea was taken from Spring-Security. This way u have access to the user in the execution thread. It was kind of weird for me to be accessing the HttpSession in all the layers of the application. On Mon, Jul 27, 2009 at 11:18 PM, "Max Weißböck (info)" wrote: Sorry, my question seems not to be clear. It is not a Hibernate question, I now how to acces and set the attributes using the event. I already set the creation and modification date in each entity. But what I need too, is who (which user) did the creation/ modification of an entity. This information (the user) is in an SSO (WebUser in my case) but I could not figure out, how I can get access to this SSO from the Hibernate Listener Class. thx, Max Am 27.07.2009 um 22:42 schrieb Igor Drobiazko: This is a Hibernate question, not Tapestry. Have a look into the event passed to your listener. There is a method called getEntity(). On Mon, Jul 27, 2009 at 10:34 PM, Max Weißböck (info) wrote: I'm using Hibernate Listeners PreUpdateEventListener and PreInsertEventListener to do audit logging in the DB. Now my problem is, how can I get access in the EventListenr class to the SSO where the user is stored? As Hibernate loads the classes as defined in the config file (see below), I can not bind them using AppModule and @Inject something - or at least I do not know how. I searched the list but found no solution (or did not understand it ;-) Thx, Max --- definition in hibernate.cfg.xml --- -- Best regards, Igor Drobiazko - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Audit logging - how to acces SSO in Hibernate
Hey Max, I had a similar problem and at the end create an object in the ThreadLocal that contains a SecurityContext with the user information (very lightweight object). The idea was taken from Spring-Security. This way u have access to the user in the execution thread. It was kind of weird for me to be accessing the HttpSession in all the layers of the application. On Mon, Jul 27, 2009 at 11:18 PM, "Max Weißböck (info)" wrote: > Sorry, my question seems not to be clear. > > It is not a Hibernate question, I now how to acces and set the attributes > using the event. > I already set the creation and modification date in each entity. > > But what I need too, is who (which user) did the creation/modification of an > entity. > This information (the user) is in an SSO (WebUser in my case) but I could > not figure out, > how I can get access to this SSO from the Hibernate Listener Class. > > thx, Max > > Am 27.07.2009 um 22:42 schrieb Igor Drobiazko: > >> This is a Hibernate question, not Tapestry. Have a look into the event >> passed to your listener. >> There is a method called getEntity(). >> >> On Mon, Jul 27, 2009 at 10:34 PM, Max Weißböck (info) >> wrote: >> >>> I'm using Hibernate Listeners PreUpdateEventListener and >>> PreInsertEventListener to do audit logging in the DB. >>> >>> Now my problem is, how can I get access in the EventListenr class to the >>> SSO where the user is stored? As Hibernate loads >>> the classes as defined in the config file (see below), I can not bind >>> them >>> using AppModule and @Inject something - or at least I do not know how. >>> >>> I searched the list but found no solution (or did not understand it ;-) >>> >>> Thx, Max >>> >>> --- definition in hibernate.cfg.xml --- >>> >>> >>> >> class="net.weissboeck.gimmo.entities.AuditListenerImpl"/> >>> >> class="net.weissboeck.gimmo.entities.AuditListenerImpl"/> >>> >>> >>> >>> >> >> >> -- >> Best regards, >> >> Igor Drobiazko > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Audit logging - how to acces SSO in Hibernate
Sorry, my question seems not to be clear. It is not a Hibernate question, I now how to acces and set the attributes using the event. I already set the creation and modification date in each entity. But what I need too, is who (which user) did the creation/modification of an entity. This information (the user) is in an SSO (WebUser in my case) but I could not figure out, how I can get access to this SSO from the Hibernate Listener Class. thx, Max Am 27.07.2009 um 22:42 schrieb Igor Drobiazko: This is a Hibernate question, not Tapestry. Have a look into the event passed to your listener. There is a method called getEntity(). On Mon, Jul 27, 2009 at 10:34 PM, Max Weißböck (info) wrote: I'm using Hibernate Listeners PreUpdateEventListener and PreInsertEventListener to do audit logging in the DB. Now my problem is, how can I get access in the EventListenr class to the SSO where the user is stored? As Hibernate loads the classes as defined in the config file (see below), I can not bind them using AppModule and @Inject something - or at least I do not know how. I searched the list but found no solution (or did not understand it ;-) Thx, Max --- definition in hibernate.cfg.xml --- -- Best regards, Igor Drobiazko - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T4.1: rendering a page to alternate OutputStream
My implementation is based on (what I suspect) is the same post you're referring to. But somewhere I'm missing the mark. I'll try from scratch in a Page rather than via IEngineService and check my mileage. I'll let you know.. Thanks again. On Jul 27, 2009, at 3:47 PM, Norman Franke wrote: In that case, someone posted how to get HTML from a page for sending email a long time ago. This is what I distilled. I do this in a page, but it doesn't use PageRenderSupport: MyPageToRender p = get MyPageToRender(); p.setSomeParameter(value); MarkupFilter filter = new AsciiMarkupFilter(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); PrintWriter writer = new PrintWriter(bos); RequestCycleFactory factory = getRequestCycleFactory(); IRequestCycle cycle = factory.newRequestCycle(getRequestCycle().getEngine()); MarkupWriterImpl mw = new MarkupWriterImpl("text/html", writer, filter); DefaultResponseBuilder rb = new DefaultResponseBuilder(mw); cycle.activate(p); cycle.renderPage(rb); writer.flush(); byte [] html = bos.toByteArray(); Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 27, 2009, at 4:27 PM, Nathan Beemer wrote: Unfortunately, I need to render a Page and capture that output to feed into my PDF lib. And its the rendering to someplace-other-than-the-web browser that is fighting me. Thanks for your help though! On Jul 27, 2009, at 3:02 PM, Norman Franke wrote: Mine is rather long owning to having it create a PDF. In short, I don't use PageRenderSupport since you don't really need it and it's likely usable only by pages, which this isn't. In my case, I'm filling in a form then flattening it (removing the forms, but leaving the filled in data.) Using iText, I get a Reader (which reads PDFs) and then create a Stamper that writes them, and it uses a FileOutputStream to send the data. If your lib can't use a FileOutputStream, create an ByteArrayOutputStream or copy from a local file (I do that as well for PDFs that just stream out as-is.) Here is an excerpted part: public class PDFExport implements IEngineService { public static final String MIME_TYPE = "application/pdf"; private WebResponse response; private LinkFactory linkFactory; private HttpServletRequest request; public PDFExport() { } public PDFExport(MapMailbox inMailbox) { mailbox = inMailbox; } public WebResponse getResponse() { return response; } public void setResponse(WebResponse response) { this.response = response; } public LinkFactory getLinkFactory() { return linkFactory; } public void setLinkFactory(LinkFactory linkFactory) { this.linkFactory = linkFactory; } public HttpServletRequest getRequest() { return request; } public void setRequest(HttpServletRequest request) { this.request = request; } @Override public void service(IRequestCycle cycle) throws IOException { WebResponse w = getResponse(); ContentType ct = new ContentType(MIME_TYPE); String formIdParam = cycle.getParameter("formId"); // Set special headers to work around a bug in IE with https. w.setHeader("Cache-Control", "max-age=0"); w.setHeader("Pragma", "public"); Integer formId = Integer.parseInt(formIdParam); Form f = FormManager.getForms(true).get(formId); // Set the file name of the exported file. w.setHeader("Content-Disposition", "inline; attachment; filename=" + f.getFileName()); Map baseFieldMap = FormManager.getFieldMap(getMailbox(), f); servicePdf(f, baseFieldMap, w.getOutputStream(ct)); } /** * Output a dynamically modified PDF form. * * @param f The form to output. * @param baseFieldMap The data to put on the form. * @param theOutStream The stream to output the form to. * @throws IOException */ public void servicePdf(Form f, Map baseFieldMap, OutputStream theOutStream) throws IOException { // Set up an output stream OutputStream webOut = theOutStream; PdfReader reader = null; FileInputStream fis = new FileInputStream(f.getFile()); reader = new PdfReader(fis); // Write PDF to webOut PdfStamper stamp = new PdfStamper(reader, out);
Re: T4.1: rendering a page to alternate OutputStream
In that case, someone posted how to get HTML from a page for sending email a long time ago. This is what I distilled. I do this in a page, but it doesn't use PageRenderSupport: MyPageToRender p = get MyPageToRender(); p.setSomeParameter(value); MarkupFilter filter = new AsciiMarkupFilter(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); PrintWriter writer = new PrintWriter(bos); RequestCycleFactory factory = getRequestCycleFactory(); IRequestCycle cycle = factory.newRequestCycle(getRequestCycle().getEngine()); MarkupWriterImpl mw = new MarkupWriterImpl("text/html", writer, filter); DefaultResponseBuilder rb = new DefaultResponseBuilder(mw); cycle.activate(p); cycle.renderPage(rb); writer.flush(); byte [] html = bos.toByteArray(); Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 27, 2009, at 4:27 PM, Nathan Beemer wrote: Unfortunately, I need to render a Page and capture that output to feed into my PDF lib. And its the rendering to someplace-other-than-the-web browser that is fighting me. Thanks for your help though! On Jul 27, 2009, at 3:02 PM, Norman Franke wrote: Mine is rather long owning to having it create a PDF. In short, I don't use PageRenderSupport since you don't really need it and it's likely usable only by pages, which this isn't. In my case, I'm filling in a form then flattening it (removing the forms, but leaving the filled in data.) Using iText, I get a Reader (which reads PDFs) and then create a Stamper that writes them, and it uses a FileOutputStream to send the data. If your lib can't use a FileOutputStream, create an ByteArrayOutputStream or copy from a local file (I do that as well for PDFs that just stream out as-is.) Here is an excerpted part: public class PDFExport implements IEngineService { public static final String MIME_TYPE = "application/pdf"; private WebResponse response; private LinkFactory linkFactory; private HttpServletRequest request; public PDFExport() { } public PDFExport(MapMailbox inMailbox) { mailbox = inMailbox; } public WebResponse getResponse() { return response; } public void setResponse(WebResponse response) { this.response = response; } public LinkFactory getLinkFactory() { return linkFactory; } public void setLinkFactory(LinkFactory linkFactory) { this.linkFactory = linkFactory; } public HttpServletRequest getRequest() { return request; } public void setRequest(HttpServletRequest request) { this.request = request; } @Override public void service(IRequestCycle cycle) throws IOException { WebResponse w = getResponse(); ContentType ct = new ContentType(MIME_TYPE); String formIdParam = cycle.getParameter("formId"); // Set special headers to work around a bug in IE with https. w.setHeader("Cache-Control", "max-age=0"); w.setHeader("Pragma", "public"); Integer formId = Integer.parseInt(formIdParam); Form f = FormManager.getForms(true).get(formId); // Set the file name of the exported file. w.setHeader("Content-Disposition", "inline; attachment; filename=" + f.getFileName()); Map baseFieldMap = FormManager.getFieldMap(getMailbox(), f); servicePdf(f, baseFieldMap, w.getOutputStream(ct)); } /** * Output a dynamically modified PDF form. * * @param f The form to output. * @param baseFieldMap The data to put on the form. * @param theOutStream The stream to output the form to. * @throws IOException */ public void servicePdf(Form f, Map baseFieldMap, OutputStream theOutStream) throws IOException { // Set up an output stream OutputStream webOut = theOutStream; PdfReader reader = null; FileInputStream fis = new FileInputStream(f.getFile()); reader = new PdfReader(fis); // Write PDF to webOut PdfStamper stamp = new PdfStamper(reader, out); ... } interface="org.apache.tapestry.engine.IEngineService"> value="infrastructure:response"/> value="infrastructure:linkFactory"/> id="tapestry.globals.HttpServletRequest"/> id="tapestry.services.ApplicationServices"> Norma
Re: Audit logging - how to acces SSO in Hibernate
This is a Hibernate question, not Tapestry. Have a look into the event passed to your listener. There is a method called getEntity(). On Mon, Jul 27, 2009 at 10:34 PM, Max Weißböck (info) wrote: > I'm using Hibernate Listeners PreUpdateEventListener and > PreInsertEventListener to do audit logging in the DB. > > Now my problem is, how can I get access in the EventListenr class to the > SSO where the user is stored? As Hibernate loads > the classes as defined in the config file (see below), I can not bind them > using AppModule and @Inject something - or at least I do not know how. > > I searched the list but found no solution (or did not understand it ;-) > > Thx, Max > > --- definition in hibernate.cfg.xml --- > > > class="net.weissboeck.gimmo.entities.AuditListenerImpl"/> > class="net.weissboeck.gimmo.entities.AuditListenerImpl"/> > > > > -- Best regards, Igor Drobiazko
Audit logging - how to acces SSO in Hibernate
I'm using Hibernate Listeners PreUpdateEventListener and PreInsertEventListener to do audit logging in the DB. Now my problem is, how can I get access in the EventListenr class to the SSO where the user is stored? As Hibernate loads the classes as defined in the config file (see below), I can not bind them using AppModule and @Inject something - or at least I do not know how. I searched the list but found no solution (or did not understand it ;-) Thx, Max --- definition in hibernate.cfg.xml --- class="net.weissboeck.gimmo.entities.AuditListenerImpl"/> class="net.weissboeck.gimmo.entities.AuditListenerImpl"/>
Re: update a zone from within a component
I'm not sure I understand completely what you are trying to do but why don't you publish an event inside the handler method of the component. This event can be handled in the handler method of the containing page by returning the zone's body. On Mon, Jul 27, 2009 at 8:41 PM, Ulrich Stärk wrote: > That's not what I was asking for. Maybe I was a bit unclear. Triggering the > update itself is not the problem but returning the correct content for > updating the zone from the event handler method of the component. The zone > should update itself with it's own content and that's the problem. Inside > the component I don't have direct access to the Zone on the page. Passing > the Zone as a parameter to the component works but calling getBody() on it > returns nothing it seems. I now have to use ComponentSource to locate the > zone in the page and then I can return it's body from the event handler > mehtod. That works but is ugly. > > Uli > > On 27.07.2009 19:54 schrieb Thiago H. de Paula Figueiredo: > >> Em Mon, 27 Jul 2009 10:20:08 -0300, Ulrich Stärk >> escreveu: >> >> Hi List, >>> >> >> Hi! >> >> How can I update a zone on a page from within a component placed on that >>> page? I can successfully pass the zone's id to the enclosed component but I >>> can't return the zone's body in any of the components handler methods. How >>> can I get a handle on the zone? >>> >> >> In https://issues.apache.org/jira/browse/TAP5-569, Fernando Padilla >> posted some very useful Javascript code that I've used successfully in a >> project. >> >> > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Best regards, Igor Drobiazko
Re: T4.1: rendering a page to alternate OutputStream
Unfortunately, I need to render a Page and capture that output to feed into my PDF lib. And its the rendering to someplace-other-than-the-web browser that is fighting me. Thanks for your help though! On Jul 27, 2009, at 3:02 PM, Norman Franke wrote: Mine is rather long owning to having it create a PDF. In short, I don't use PageRenderSupport since you don't really need it and it's likely usable only by pages, which this isn't. In my case, I'm filling in a form then flattening it (removing the forms, but leaving the filled in data.) Using iText, I get a Reader (which reads PDFs) and then create a Stamper that writes them, and it uses a FileOutputStream to send the data. If your lib can't use a FileOutputStream, create an ByteArrayOutputStream or copy from a local file (I do that as well for PDFs that just stream out as-is.) Here is an excerpted part: public class PDFExport implements IEngineService { public static final String MIME_TYPE = "application/pdf"; private WebResponse response; private LinkFactory linkFactory; private HttpServletRequest request; public PDFExport() { } public PDFExport(MapMailbox inMailbox) { mailbox = inMailbox; } public WebResponse getResponse() { return response; } public void setResponse(WebResponse response) { this.response = response; } public LinkFactory getLinkFactory() { return linkFactory; } public void setLinkFactory(LinkFactory linkFactory) { this.linkFactory = linkFactory; } public HttpServletRequest getRequest() { return request; } public void setRequest(HttpServletRequest request) { this.request = request; } @Override public void service(IRequestCycle cycle) throws IOException { WebResponse w = getResponse(); ContentType ct = new ContentType(MIME_TYPE); String formIdParam = cycle.getParameter("formId"); // Set special headers to work around a bug in IE with https. w.setHeader("Cache-Control", "max-age=0"); w.setHeader("Pragma", "public"); Integer formId = Integer.parseInt(formIdParam); Form f = FormManager.getForms(true).get(formId); // Set the file name of the exported file. w.setHeader("Content-Disposition", "inline; attachment; filename=" + f.getFileName()); Map baseFieldMap = FormManager.getFieldMap(getMailbox(), f); servicePdf(f, baseFieldMap, w.getOutputStream(ct)); } /** * Output a dynamically modified PDF form. * * @param f The form to output. * @param baseFieldMap The data to put on the form. * @param theOutStream The stream to output the form to. * @throws IOException */ public void servicePdf(Form f, Map baseFieldMap, OutputStream theOutStream) throws IOException { // Set up an output stream OutputStream webOut = theOutStream; PdfReader reader = null; FileInputStream fis = new FileInputStream(f.getFile()); reader = new PdfReader(fis); // Write PDF to webOut PdfStamper stamp = new PdfStamper(reader, out); ... } interface="org.apache.tapestry.engine.IEngineService"> value="infrastructure:response"/> value="infrastructure:linkFactory"/> id="tapestry.globals.HttpServletRequest"/> id="tapestry.services.ApplicationServices"> Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 27, 2009, at 3:45 PM, Nathan Beemer wrote: Sorry, my response wasn't put together very well. The specific problem I'm having is with the rendering from with my IEngineService.service(IRequestCycle) implementation The latest problem is with the PageRenderSupport error. I've tried a few different approaches, but they all end up with some Exception thrown during Tapestry's render process. Would you mind posting your implementation of IEngineService.service(..) ? Thanks On Jul 27, 2009, at 2:34 PM, Norman Franke wrote: I am using an IEngineService. I get an output stream from the response and use that to send the data. I don't know what PD4ML expects, but I'd hope it can take an OutputStream. Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 27, 2009, at 1:49 PM, Nathan Beemer wrote: I need to have a "Download as PDF" link on some of my pages that will render the given page to PDF and send to client. I'm not familiar with iText, but eve
Re: How to use JavaScript for dependent selects?
I had the very same problem, here is the solution I have (with great help from the list - search for it) --- java part --- selection model as found in T5 HowTos in the wicki and with event definition from Chenillekit--- @IncludeJavaScriptLibrary( { "context:js/Chenillekit.js", "context:js/ RESelection.js" }) public class Index { @InjectSelectionModel(labelField = "name", idField = "oid") @Persist private List reTypes; @InjectSelectionModel(labelField = "name", idField = "oid") @Persist private List reSubTypes; @Component(parameters = {"event=change", "onCompleteCallback=literal:onCompleteChangeReSubType"}) @Mixins({"ck/OnEvent"}) private Select reType; @Log @OnEvent(component="reType", value="change") public JSONArray onChangeRETypeEvent(String value) { JSONArray jsonArray = new JSONArray(); // Tapestry cant handle the empty first field for us in this situation reSubTypes = dataService .getRESubTypesWithFirstEmpty (dataService.loadREType(Long.parseLong(value))); query.setReSubType(reSubTypes.get(0)); for (RESubType subType : reSubTypes) { JSONObject jo = new JSONObject(); jo.put("value", subType.getOid()); jo.put("label", subType.getName()); jsonArray.put(jo); } return jsonArray; } --- tml part --- model="reTypesSelectionModel" encoder="reTypesValueEncoder" validate="required"/> javascript part --- function onCompleteChangeReSubType(response) { selectElement = $('resubtype'); while (selectElement.options.length > 0) { selectElement.options[0] = null; } for (index = 0; index < response.length; index++) { if (index == 0) { selectElement.options[index] = new Option(response[index].label, response[index].value, true, true); } else { selectElement.options[index] = new Option(response[index].label, response[index].value); } } //Tapestry.ElementEffect.highlight($("resubtype")); } hope this helps, Max Am 26.07.2009 um 20:16 schrieb sparqle: All, I know Java and have been using pure Java frameworks like ZK and Echo2 to develop web applications. I don't know anything about JavaScript, and have been trying to learn T5 in the hope of creating a real application. However, it appears that with T5 I am not completely shielded from JavaScript (may be I can do this in pure Java?) if I want to do AJAX. The specific example that I want to implement is the classic 2 dropdown - the second one dependent on the first one. So let's say you select a country, and the in the second dropdown, the list of states/provinces is updated to match what is available for the country selected in the first dropdown. From the forums, I have gathered that I must use the Chenille Kit "onEvent" mixin to make this happen. I also saw some sample codes in the forums that appear to solve this exact issue. The problem is that I don't know where to put this code (in Java file or tml file or some other js file) and then how to tie these things together. In the T5 help documentation, there is some info about using RenderSupport for this. Again, the code given is only snippets with no complete example that I can download/copy. I could not understand this documentation at all. So my question is simple: where should this code be located and how are all these things connected? Is there anything else that needs to be added - such as RenderSupport (and where)? --- @OnEvent(component = "operator", value = "change") public JSONArray onChangeOperatorEvent(String value) { JSONArray jsonArray = new JSONArray(); for (Plaza plaza : getDestinationSelectValues(value)) { JSONObject jsonObject = new JSONObject(); jsonObject.put("value", plaza.getId()); jsonObject.put("label", plaza.getDescription()); jsonArray.put(jsonObject); } return jsonArray; } -- function onCompleteOperatorChange(response) { selectElement = $("entryPlaza"); responseJSON = response.evalJSON(); while (selectElement .options.length > 0) { selectElement .options[0] = null; } for (index = 0; index < responseJSON .length; index++) { selectElement.options[index] = new Option(responseJSON [index].label, responseJSON [index].value); } Tapestry.ElementEffect.highlight($("entryPlaza")); } --- -- View this message in context: http://www.nabble.com/How-to-use-JavaScript-for-dependent-selects--tp24669071p24669071.html
Re: T4.1: rendering a page to alternate OutputStream
Mine is rather long owning to having it create a PDF. In short, I don't use PageRenderSupport since you don't really need it and it's likely usable only by pages, which this isn't. In my case, I'm filling in a form then flattening it (removing the forms, but leaving the filled in data.) Using iText, I get a Reader (which reads PDFs) and then create a Stamper that writes them, and it uses a FileOutputStream to send the data. If your lib can't use a FileOutputStream, create an ByteArrayOutputStream or copy from a local file (I do that as well for PDFs that just stream out as-is.) Here is an excerpted part: public class PDFExport implements IEngineService { public static final String MIME_TYPE = "application/pdf"; private WebResponse response; private LinkFactory linkFactory; private HttpServletRequest request; public PDFExport() { } public PDFExport(MapMailbox inMailbox) { mailbox = inMailbox; } public WebResponse getResponse() { return response; } public void setResponse(WebResponse response) { this.response = response; } public LinkFactory getLinkFactory() { return linkFactory; } public void setLinkFactory(LinkFactory linkFactory) { this.linkFactory = linkFactory; } public HttpServletRequest getRequest() { return request; } public void setRequest(HttpServletRequest request) { this.request = request; } @Override public void service(IRequestCycle cycle) throws IOException { WebResponse w = getResponse(); ContentType ct = new ContentType(MIME_TYPE); String formIdParam = cycle.getParameter("formId"); // Set special headers to work around a bug in IE with https. w.setHeader("Cache-Control", "max-age=0"); w.setHeader("Pragma", "public"); Integer formId = Integer.parseInt(formIdParam); Form f = FormManager.getForms(true).get(formId); // Set the file name of the exported file. w.setHeader("Content-Disposition", "inline; attachment; filename=" + f.getFileName()); Map baseFieldMap = FormManager.getFieldMap(getMailbox(), f); servicePdf(f, baseFieldMap, w.getOutputStream(ct)); } /** * Output a dynamically modified PDF form. * * @param f The form to output. * @param baseFieldMap The data to put on the form. * @param theOutStream The stream to output the form to. * @throws IOException */ public void servicePdf(Form f, Map baseFieldMap, OutputStream theOutStream) throws IOException { // Set up an output stream OutputStream webOut = theOutStream; PdfReader reader = null; FileInputStream fis = new FileInputStream(f.getFile()); reader = new PdfReader(fis); // Write PDF to webOut PdfStamper stamp = new PdfStamper(reader, out); ... } interface="org.apache.tapestry.engine.IEngineService"> value="infrastructure:response"/> value="infrastructure:linkFactory"/> id="tapestry.globals.HttpServletRequest"/> id="tapestry.services.ApplicationServices"> Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 27, 2009, at 3:45 PM, Nathan Beemer wrote: Sorry, my response wasn't put together very well. The specific problem I'm having is with the rendering from with my IEngineService.service(IRequestCycle) implementation The latest problem is with the PageRenderSupport error. I've tried a few different approaches, but they all end up with some Exception thrown during Tapestry's render process. Would you mind posting your implementation of IEngineService.service(..) ? Thanks On Jul 27, 2009, at 2:34 PM, Norman Franke wrote: I am using an IEngineService. I get an output stream from the response and use that to send the data. I don't know what PD4ML expects, but I'd hope it can take an OutputStream. Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 27, 2009, at 1:49 PM, Nathan Beemer wrote: I need to have a "Download as PDF" link on some of my pages that will render the given page to PDF and send to client. I'm not familiar with iText, but everything you said sounds good, except the "blast out the data". My trouble is getting a handle on "the data". I'm using PD4ML, but I can't hook onto the rendered Tapestry output to pipe into PD4ML. Are you not using a IEngineService for thi
Re: T4.1: rendering a page to alternate OutputStream
Sorry, my response wasn't put together very well. The specific problem I'm having is with the rendering from with my IEngineService.service(IRequestCycle) implementation The latest problem is with the PageRenderSupport error. I've tried a few different approaches, but they all end up with some Exception thrown during Tapestry's render process. Would you mind posting your implementation of IEngineService.service(..) ? Thanks On Jul 27, 2009, at 2:34 PM, Norman Franke wrote: I am using an IEngineService. I get an output stream from the response and use that to send the data. I don't know what PD4ML expects, but I'd hope it can take an OutputStream. Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 27, 2009, at 1:49 PM, Nathan Beemer wrote: I need to have a "Download as PDF" link on some of my pages that will render the given page to PDF and send to client. I'm not familiar with iText, but everything you said sounds good, except the "blast out the data". My trouble is getting a handle on "the data". I'm using PD4ML, but I can't hook onto the rendered Tapestry output to pipe into PD4ML. Are you not using a IEngineService for this? On Jul 27, 2009, at 10:35 AM, Norman Franke wrote: I do this for PDF exporting from iText. I inject the (Http) request and (WebResponse) response along with a linkFactory via hivemind.xml. Then WebResponse.setHeader("Content-Description", "inline; attachment; filename=whatever"); Then just blast out the data to getResponse().getOutputStream(). Perhaps PageRenderSupport can't be used in services? What do you need it for? Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 25, 2009, at 11:05 AM, Nathan Beemer wrote: I want to direct the render of a Page to a specific OutputStream. Is it possible to do this? I'm trying to use an IEngineService to accomplish this. Seems I'm close, but getting: "Component UClients/a requires rendering support, but no PageRenderSupport object has been stored into the request cycle. This object is typically provided by a Body component. You should add a Body component to your template." I'm injecting RequestGlobals service into my Pages and then doing: ((AbstractMyPage) homePage).getRequestGlobals().store(builder); But this doesn't seem to be what Tapestry is looking for during the render: Stack Trace: org .apache .tapestry.TapestryUtils.getPageRenderSupport(TapestryUtils.java: 124) org .apache .tapestry .dojo .form.DropdownDatePicker.renderFormWidget(DropdownDatePicker.java: 120) org .apache .tapestry .dojo .form .AbstractFormWidget.renderFormComponent(AbstractFormWidget.java:66) - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T4.1: rendering a page to alternate OutputStream
I am using an IEngineService. I get an output stream from the response and use that to send the data. I don't know what PD4ML expects, but I'd hope it can take an OutputStream. Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 27, 2009, at 1:49 PM, Nathan Beemer wrote: I need to have a "Download as PDF" link on some of my pages that will render the given page to PDF and send to client. I'm not familiar with iText, but everything you said sounds good, except the "blast out the data". My trouble is getting a handle on "the data". I'm using PD4ML, but I can't hook onto the rendered Tapestry output to pipe into PD4ML. Are you not using a IEngineService for this? On Jul 27, 2009, at 10:35 AM, Norman Franke wrote: I do this for PDF exporting from iText. I inject the (Http) request and (WebResponse) response along with a linkFactory via hivemind.xml. Then WebResponse.setHeader("Content-Description", "inline; attachment; filename=whatever"); Then just blast out the data to getResponse().getOutputStream(). Perhaps PageRenderSupport can't be used in services? What do you need it for? Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 25, 2009, at 11:05 AM, Nathan Beemer wrote: I want to direct the render of a Page to a specific OutputStream. Is it possible to do this? I'm trying to use an IEngineService to accomplish this. Seems I'm close, but getting: "Component UClients/a requires rendering support, but no PageRenderSupport object has been stored into the request cycle. This object is typically provided by a Body component. You should add a Body component to your template." I'm injecting RequestGlobals service into my Pages and then doing: ((AbstractMyPage) homePage).getRequestGlobals().store(builder); But this doesn't seem to be what Tapestry is looking for during the render: Stack Trace: org .apache .tapestry.TapestryUtils.getPageRenderSupport(TapestryUtils.java:124) org .apache .tapestry .dojo .form.DropdownDatePicker.renderFormWidget(DropdownDatePicker.java: 120) org .apache .tapestry .dojo .form .AbstractFormWidget.renderFormComponent(AbstractFormWidget.java:66) - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: update a zone from within a component
That's not what I was asking for. Maybe I was a bit unclear. Triggering the update itself is not the problem but returning the correct content for updating the zone from the event handler method of the component. The zone should update itself with it's own content and that's the problem. Inside the component I don't have direct access to the Zone on the page. Passing the Zone as a parameter to the component works but calling getBody() on it returns nothing it seems. I now have to use ComponentSource to locate the zone in the page and then I can return it's body from the event handler mehtod. That works but is ugly. Uli On 27.07.2009 19:54 schrieb Thiago H. de Paula Figueiredo: Em Mon, 27 Jul 2009 10:20:08 -0300, Ulrich Stärk escreveu: Hi List, Hi! How can I update a zone on a page from within a component placed on that page? I can successfully pass the zone's id to the enclosed component but I can't return the zone's body in any of the components handler methods. How can I get a handle on the zone? In https://issues.apache.org/jira/browse/TAP5-569, Fernando Padilla posted some very useful Javascript code that I've used successfully in a project. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: update a zone from within a component
Em Mon, 27 Jul 2009 10:20:08 -0300, Ulrich Stärk escreveu: Hi List, Hi! How can I update a zone on a page from within a component placed on that page? I can successfully pass the zone's id to the enclosed component but I can't return the zone's body in any of the components handler methods. How can I get a handle on the zone? In https://issues.apache.org/jira/browse/TAP5-569, Fernando Padilla posted some very useful Javascript code that I've used successfully in a project. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T4.1: rendering a page to alternate OutputStream
I need to have a "Download as PDF" link on some of my pages that will render the given page to PDF and send to client. I'm not familiar with iText, but everything you said sounds good, except the "blast out the data". My trouble is getting a handle on "the data". I'm using PD4ML, but I can't hook onto the rendered Tapestry output to pipe into PD4ML. Are you not using a IEngineService for this? On Jul 27, 2009, at 10:35 AM, Norman Franke wrote: I do this for PDF exporting from iText. I inject the (Http) request and (WebResponse) response along with a linkFactory via hivemind.xml. Then WebResponse.setHeader("Content-Description", "inline; attachment; filename=whatever"); Then just blast out the data to getResponse().getOutputStream(). Perhaps PageRenderSupport can't be used in services? What do you need it for? Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 25, 2009, at 11:05 AM, Nathan Beemer wrote: I want to direct the render of a Page to a specific OutputStream. Is it possible to do this? I'm trying to use an IEngineService to accomplish this. Seems I'm close, but getting: "Component UClients/a requires rendering support, but no PageRenderSupport object has been stored into the request cycle. This object is typically provided by a Body component. You should add a Body component to your template." I'm injecting RequestGlobals service into my Pages and then doing: ((AbstractMyPage) homePage).getRequestGlobals().store(builder); But this doesn't seem to be what Tapestry is looking for during the render: Stack Trace: org .apache .tapestry.TapestryUtils.getPageRenderSupport(TapestryUtils.java:124) org .apache .tapestry .dojo .form.DropdownDatePicker.renderFormWidget(DropdownDatePicker.java: 120) org .apache .tapestry .dojo .form .AbstractFormWidget.renderFormComponent(AbstractFormWidget.java:66) - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5 IoC Eagerloading and ordering of services
> The first would be pushing a performance hit to > startup-time, so the user doesn't suffer from latency while waiting > for some expensive service to be manifested. In practice this is exactly what is happening in the given example. > At any rate, as HLS suggested, statics are a > design smell, and T5 IoC was designed around IoC patterns, so it's not > that surprising. I can agree with that, and in my case yes it is a workaround. But that is not the issue... Ordered service creation does not depart from the spirit of IoC! Peter - Original Message - From: "Christian Gruber" To: "Tapestry users" Sent: Monday, 27 July, 2009 18:52:29 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services On Jul 27, 2009, at 11:40 AM, Peter Stavrinides wrote: >> Create a service wrapper around >> DatabaseConnection.getReadConnection(). This will put the >> eager-loading mechanism on your side. > I will try this, but this is not relevant to the issue in question, > which is how to control the ordering of eagerloaded services. The > very need to eagerload a service already implies that order is > important, not being able to imho is an oversight. Not necessarily, there are two solid cases for eager-loading that don't require order. The first would be pushing a performance hit to startup-time, so the user doesn't suffer from latency while waiting for some expensive service to be manifested. The second would be for services which, if failed, should fail the entire application setup. These should be eagerly loaded so as to ensure you fix the problem before you think of your server as started. "Fail early," in other words. Not that it can't be useful, but it isn't the goal intended, if I understand correctly. At any rate, as HLS suggested, statics are a design smell, and T5 IoC was designed around IoC patterns, so it's not that surprising. Ordered service creation would specifically be a workaround to support legacy code which could not be easily hosted into an IoC situation. cheers, Christian. Christian Edward Gruber christianedwardgru...@gmail.com http://www.geekinasuit.com/ - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5 IoC Eagerloading and ordering of services
On Jul 27, 2009, at 11:40 AM, Peter Stavrinides wrote: Create a service wrapper around DatabaseConnection.getReadConnection(). This will put the eager-loading mechanism on your side. I will try this, but this is not relevant to the issue in question, which is how to control the ordering of eagerloaded services. The very need to eagerload a service already implies that order is important, not being able to imho is an oversight. Not necessarily, there are two solid cases for eager-loading that don't require order. The first would be pushing a performance hit to startup-time, so the user doesn't suffer from latency while waiting for some expensive service to be manifested. The second would be for services which, if failed, should fail the entire application setup. These should be eagerly loaded so as to ensure you fix the problem before you think of your server as started. "Fail early," in other words. Not that it can't be useful, but it isn't the goal intended, if I understand correctly. At any rate, as HLS suggested, statics are a design smell, and T5 IoC was designed around IoC patterns, so it's not that surprising. Ordered service creation would specifically be a workaround to support legacy code which could not be easily hosted into an IoC situation. cheers, Christian. Christian Edward Gruber christianedwardgru...@gmail.com http://www.geekinasuit.com/ - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5 IoC Eagerloading and ordering of services
> Create a service wrapper around > DatabaseConnection.getReadConnection(). This will put the > eager-loading mechanism on your side. I will try this, but this is not relevant to the issue in question, which is how to control the ordering of eagerloaded services. The very need to eagerload a service already implies that order is important, not being able to imho is an oversight. > Alternately, put in proper synchronization semantics on > DatabaseConnection static methods.l > Use of statics in an application using Tapestry IoC is a design smell. The is a database connection pool that has all the relevant synchronization semantics in place, I agree that pure IoC would be better but this is legacy code used in thousands of classes, so is difficult to change, but again that should not detract from the question but thanks for the tip Howard, Peter - Original Message - From: "Howard Lewis Ship" To: "Tapestry users" Sent: Monday, 27 July, 2009 18:09:16 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services Create a service wrapper around DatabaseConnection.getReadConnection(). This will put the eager-loading mechanism on your side. Alternately, put in proper synchronization semantics on DatabaseConnection static methods.l Use of statics in an application using Tapestry IoC is a design smell. On Mon, Jul 27, 2009 at 12:55 AM, wrote: > Hi, > > Before I open a jira for this I have devised an coded example to illustrate > it, and hopefully get some comments: > > //Example: The shell of an eagerloaded service > public class ImageService { > > /** Cache to hold thumbnail images */ > private static ConcurrentHashMap imageCache_ = new > ConcurrentHashMap(); > > > public void preloadImageCache() { > DbConnection connection = null; > try { > //Sometimes this turns into a Null Pointer Exception > as another eagerloaded service sets up the connection pool etc. > //this service should start up after that one, but > this is not always the case in practice?? > connection = DatabaseConnection.getReadConnection(); > //database query > } catch (Exception e) { > //handle exception > } > } > > > public static ImageService build() { > return new ImageService(); > } > > public ImageService() { > preloadImageCache(); > } > } > > //Workaround: adding a dependency on the other eagerloaded service solves it, > but this is not a practical solution if there are many of these services > public class ImageService { > > /** Cache to hold thumbnail images */ > private static ConcurrentHashMap imageCache_ = new > ConcurrentHashMap(); > > > public void preloadImageCache() { > DbConnection connection = null; > try { > connection = DatabaseConnection.getReadConnection(); > //database query > } catch (Exception e) { > //handle exception > } > } > > > public static ImageService build(SiteInitialise siteInitialise) { > return new ImageService(siteInitialise); > } > > public ImageService(SiteInitialise siteInitialise) { > if(siteInitialise.isConnectionOk()) > preloadImageCache(); > } > } > > If there is a way to ensure the ordering of eagerloaded services, then this > is not an issue, perhaps this is a regression from the fix to > http://issues.apache.org/jira/browse/TAPESTRY-2267 ? otherwise I am surprised > that others have not come across this, perhaps I have missed something? > > Cheers, > Peter > > > - Original Message - > From: "Peter Stavrinides" > To: "Tapestry Mailing List" > Sent: Friday, 24 July, 2009 15:59:20 GMT +02:00 Athens, Beirut, Bucharest, > Istanbul > Subject: Tapestry 5 IoC Eagerloading and ordering of services > > Hi everyone, > > Is it possible to control the ordering of eagerloaded IoC services, > especially if the services exist is separate but dependent IoC modules. > > I found an issue http://issues.apache.org/jira/browse/TAPESTRY-2267 that > states these service proxies are claimed and loaded collectively, however no > mention is made of how to ensure the correct ordering of these claimed > services? > > Any help with this would be greatly appreciated. > > Kind regards, > Peter > > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For add
Re: T4.1: rendering a page to alternate OutputStream
I do this for PDF exporting from iText. I inject the (Http) request and (WebResponse) response along with a linkFactory via hivemind.xml. Then WebResponse.setHeader("Content-Description", "inline; attachment; filename=whatever"); Then just blast out the data to getResponse().getOutputStream(). Perhaps PageRenderSupport can't be used in services? What do you need it for? Norman Franke Answering Service for Directors, Inc. www.myasd.com On Jul 25, 2009, at 11:05 AM, Nathan Beemer wrote: I want to direct the render of a Page to a specific OutputStream. Is it possible to do this? I'm trying to use an IEngineService to accomplish this. Seems I'm close, but getting: "Component UClients/a requires rendering support, but no PageRenderSupport object has been stored into the request cycle. This object is typically provided by a Body component. You should add a Body component to your template." I'm injecting RequestGlobals service into my Pages and then doing: ((AbstractMyPage) homePage).getRequestGlobals().store(builder); But this doesn't seem to be what Tapestry is looking for during the render: Stack Trace: org .apache .tapestry.TapestryUtils.getPageRenderSupport(TapestryUtils.java:124) org .apache .tapestry .dojo .form.DropdownDatePicker.renderFormWidget(DropdownDatePicker.java:120) org .apache .tapestry .dojo .form.AbstractFormWidget.renderFormComponent(AbstractFormWidget.java: 66)
Re: Tapestry 5 IoC Eagerloading and ordering of services
Create a service wrapper around DatabaseConnection.getReadConnection(). This will put the eager-loading mechanism on your side. Alternately, put in proper synchronization semantics on DatabaseConnection static methods.l Use of statics in an application using Tapestry IoC is a design smell. On Mon, Jul 27, 2009 at 12:55 AM, wrote: > Hi, > > Before I open a jira for this I have devised an coded example to illustrate > it, and hopefully get some comments: > > //Example: The shell of an eagerloaded service > public class ImageService { > > /** Cache to hold thumbnail images */ > private static ConcurrentHashMap imageCache_ = new > ConcurrentHashMap(); > > > public void preloadImageCache() { > DbConnection connection = null; > try { > //Sometimes this turns into a Null Pointer Exception > as another eagerloaded service sets up the connection pool etc. > //this service should start up after that one, but > this is not always the case in practice?? > connection = DatabaseConnection.getReadConnection(); > //database query > } catch (Exception e) { > //handle exception > } > } > > > public static ImageService build() { > return new ImageService(); > } > > public ImageService() { > preloadImageCache(); > } > } > > //Workaround: adding a dependency on the other eagerloaded service solves it, > but this is not a practical solution if there are many of these services > public class ImageService { > > /** Cache to hold thumbnail images */ > private static ConcurrentHashMap imageCache_ = new > ConcurrentHashMap(); > > > public void preloadImageCache() { > DbConnection connection = null; > try { > connection = DatabaseConnection.getReadConnection(); > //database query > } catch (Exception e) { > //handle exception > } > } > > > public static ImageService build(SiteInitialise siteInitialise) { > return new ImageService(siteInitialise); > } > > public ImageService(SiteInitialise siteInitialise) { > if(siteInitialise.isConnectionOk()) > preloadImageCache(); > } > } > > If there is a way to ensure the ordering of eagerloaded services, then this > is not an issue, perhaps this is a regression from the fix to > http://issues.apache.org/jira/browse/TAPESTRY-2267 ? otherwise I am surprised > that others have not come across this, perhaps I have missed something? > > Cheers, > Peter > > > - Original Message - > From: "Peter Stavrinides" > To: "Tapestry Mailing List" > Sent: Friday, 24 July, 2009 15:59:20 GMT +02:00 Athens, Beirut, Bucharest, > Istanbul > Subject: Tapestry 5 IoC Eagerloading and ordering of services > > Hi everyone, > > Is it possible to control the ordering of eagerloaded IoC services, > especially if the services exist is separate but dependent IoC modules. > > I found an issue http://issues.apache.org/jira/browse/TAPESTRY-2267 that > states these service proxies are claimed and loaded collectively, however no > mention is made of how to ensure the correct ordering of these claimed > services? > > Any help with this would be greatly appreciated. > > Kind regards, > Peter > > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry Director of Open Source Technology at Formos - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5.1 default locale for app.properties: bug or feature?
Hi, My application uses *"ru"* as default locale. It works ok for component message properties. I don't have *"acomponent.properties"* files, only *"acomponent_ru.properties" *and it work right. However when I create global message catalogue - *"app_ru.properties"*(without "app.properties"), it is not used by Tapestry. When I rename it to *"app.properties"* - it is used. *Is it by design or bug?* Regards, Sergey.
Re: embedded components
I already guessed that I'd get "static structure, dynamic behaviour" as an answer but declaring the component inside the page class *IS* static. I don't see the need to also have it in the template. Uli On 27.07.2009 15:16 schrieb Kristian Marinkovic: i think because of tapestry's rule: static structure, dynamic behaviour :) what i ended up doing is to have a BlockService that contains a contribution of all available Blocks in my app with a unique id. anytime i need such a component i just ask my service: @Inject private BlockService blockService return blockService.get("blockid"); or you could create a base page that contains all Blocks and components that could be used in some context. i hope this helps :) g, kris Ulrich Stärk 27.07.2009 13:00 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema embedded components Why do embedded components declared with @Component _have_ to have a corresponding element in the template? If I just want to use them as a return value from some delegating method, why do I still have to declare them in the template, bloating it with unused stuff? Uli - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
update a zone from within a component
Hi List, How can I update a zone on a page from within a component placed on that page? I can successfully pass the zone's id to the enclosed component but I can't return the zone's body in any of the components handler methods. How can I get a handle on the zone? Uli - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: embedded components
i think because of tapestry's rule: static structure, dynamic behaviour :) what i ended up doing is to have a BlockService that contains a contribution of all available Blocks in my app with a unique id. anytime i need such a component i just ask my service: @Inject private BlockService blockService return blockService.get("blockid"); or you could create a base page that contains all Blocks and components that could be used in some context. i hope this helps :) g, kris Ulrich Stärk 27.07.2009 13:00 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema embedded components Why do embedded components declared with @Component _have_ to have a corresponding element in the template? If I just want to use them as a return value from some delegating method, why do I still have to declare them in the template, bloating it with unused stuff? Uli - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Testify injection only works once per test
Hi Paul, Yes there are three groups involved in the suite. How ever no other test from other groups are available. It seems that when I remove the reference to groups in my testng.xml it works fine. For now a workable solution it looks like a bug though not sure wether testng or testify. thanks anyway. regards Rolf Paul Field wrote: > > rolfst wrote on 27/07/2009 13:26:23: > >> >>@Test(groups = "rbudisplay") >>public void test_rbuselection_fulltype() throws Exception >>{ > > Oooo... it might be something to do with groups. Is your suite specifying > that only certain groups are run? > > (my brain aches whenever I try to work out what get runs in TestNG :-) ). > > Paul > > > > --- > > This e-mail may contain confidential and/or privileged information. If you > are not the intended recipient (or have received this e-mail in error) > please notify the sender immediately and delete this e-mail. Any > unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > > Please refer to http://www.db.com/en/content/eu_disclosures.htm for > additional EU corporate and regulatory disclosures. > -- View this message in context: http://www.nabble.com/Testify-injection-only-works-once-per-test-tp24665202p24680484.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5] JPF-Plugins (or any other plugin-framework) to add page content?
Tapestry OSGI may help you http://groups.google.com/group/tapestry-osgi/ 2009/7/27 Tobias Wehrum > Hello everyone, > > I need to write an application where multiple page contents should be added > in later via plugins - for example different ways to output things, other > payment modi, or statistics. > > Currently I am reading into http://jpf.sourceforge.net/index.html, but it > is not necessairly a JPF problem: > How can I add Tapestry pages and classes later in "per hand"? Or can you > think of any other way plugin support could be made possible? > > Can anyone can make sense out of what I am trying to do? I would love some > ideas, hints and solutions, because I'm stuck. > > Cheers! > Tobias > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: Testify injection only works once per test
rolfst wrote on 27/07/2009 13:26:23: > >@Test(groups = "rbudisplay") >public void test_rbuselection_fulltype() throws Exception >{ Oooo... it might be something to do with groups. Is your suite specifying that only certain groups are run? (my brain aches whenever I try to work out what get runs in TestNG :-) ). Paul --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
Re: Testify injection only works once per test
Hi Paul, I have this test method @Inject private TestPageResultRetriever retriever; @Inject private RBUTypeRepository repository; @Override protected void doSetUp() throws Exception { } @Test(groups = "rbudisplay") public void test_rbuselection_fulltype() throws Exception { Document doc = tester.renderPage("multiselect/rbuselectiontestpage"); List selectelements = TapestryXPath.xpath("//select").selectElements(doc); assertEquals(selectelements.size(), 2); Iterable options = getSelectElementOptions(doc, "//table/tr[1]//select[1]"); assertEquals(Iterables.size(options), 3); selectOptionElement(options, 1); Element textfield = TapestryXPath.xpath("//table/tr[1]//input[1]").selectSingleElement(doc); textfield.forceAttributes("value", "1"); Iterable options2 = getSelectElementOptions(doc, "//table/tr[2]//select[1]"); selectOptionElement(options2, 1); Element hidden = TapestryXPath.xpath("//table/tr[2]//input[1]").selectSingleElement(doc); assertNotNull(hidden); Element form = doc.getElementById("rbuselection"); tester.submitForm(form, new HashMap()); RBUSelection selection = getSubmittedRBUSelection(1L); assertNotNull(selection); RBU rbu = selection.getSelection(); assertEquals(rbu.getId(), Long.valueOf(2L)); } private RBUSelection getSubmittedRBUSelection(Long id) { RBUType type = repository.findById(id, false); RBUSelection entry = new RBUSelection(type); RBUSelection selection = retriever.getEntry(entry); return selection; } When I run the test within a suite the test fails in the getSubmittedRBUSelection method on the first statement which as you can see is being called at the forth statement before the end of the testmethod. the repository is already been used in the page aswell otherwise I would have recieved an exception from there. When i run the test alone with its class it works Paul Field wrote: > > Hi Rolf, > > >> Hi I am using Testify to inject a fake repository into my testng test > but I >> come op to a problem. >> >> when i first access the fake repository it gets injected however the > second >> time i access the repository I get a null pointer exception. >> >> Now comes another strange thing when i debug everything works fine and > the >> repository gets injected perfectly. > > At the moment Testify's TestNG integration is using @BeforeClass to > process the @Inject annotations. So I can see that there might be possible > scenarios that match yours: something where the '@Inject'ed field is > cleared between tests for example... but it's hard to know exactly what's > happening from your description. > > Could you give some more information (e.g. code examples) that show the > problem? Also, when you debug, are you running exactly the same suite as > when you aren't debugging? And is the behaviour consistent if you try this > multiple times? > > Thanks, > > Paul > > > > > > > --- > > This e-mail may contain confidential and/or privileged information. If you > are not the intended recipient (or have received this e-mail in error) > please notify the sender immediately and delete this e-mail. Any > unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > > Please refer to http://www.db.com/en/content/eu_disclosures.htm for > additional EU corporate and regulatory disclosures. > -- View this message in context: http://www.nabble.com/Testify-injection-only-works-once-per-test-tp24665202p24679761.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Custom validator for int constraint for a dynamic list
I got it I Used Void.class as its first parameter to its super() changed it to null did the trick rolfst wrote: > > Hi can someone help me on creating an int validator like in the wiki. > However This validator must be used with an ajax loop on a custom > component. > So a message catalog file cannot really work because the number of text > fields is not known beforehand. > > thanx > Rolf > -- View this message in context: http://www.nabble.com/Custom-validator-for-int-constraint-for-a-dynamic-list-tp24678040p24679622.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[T5] JPF-Plugins (or any other plugin-framework) to add page content?
Hello everyone, I need to write an application where multiple page contents should be added in later via plugins - for example different ways to output things, other payment modi, or statistics. Currently I am reading into http://jpf.sourceforge.net/index.html, but it is not necessairly a JPF problem: How can I add Tapestry pages and classes later in "per hand"? Or can you think of any other way plugin support could be made possible? Can anyone can make sense out of what I am trying to do? I would love some ideas, hints and solutions, because I'm stuck. Cheers! Tobias - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
embedded components
Why do embedded components declared with @Component _have_ to have a corresponding element in the template? If I just want to use them as a return value from some delegating method, why do I still have to declare them in the template, bloating it with unused stuff? Uli - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Testify injection only works once per test
On Jul 27, 2009, at 6:25 AM, Paul Field wrote: If you are setting up state that you want to be fresh for each test, then you should consider using Testify's pertest scope: http://tapestry.formos.com/nightly/tapestry-testify/#Per-test_scope Ah... this is what I was thinking - thanks for pointing it out. Christian. Christian Edward Gruber christianedwardgru...@gmail.com http://www.geekinasuit.com/
Re: Tapestry 5 IoC Eagerloading and ordering of services
Sorry, I think I misunderstood you Kristian, reading through your comments again I realized this is your own contribution. I have adjusted the jira accordingly. So in fact it is not possible to order them natively in Tapestry. Cheers, Peter - Original Message - From: "p stavrinides" To: "Tapestry users" Sent: Monday, 27 July, 2009 13:23:50 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services Hi Kristian, Could you please point me to the JavaDoc of this service? Thanks, Peter -- If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Please visit http://www.albourne.com/email.html for important additional terms relating to this e-mail. - Original Message - From: "Peter Stavrinides" To: "Tapestry users" Sent: Monday, 27 July, 2009 12:57:56 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services I added a documentation enhancement request: https://issues.apache.org/jira/browse/TAP5-795 Thanks again, Peter - Original Message - From: "P Stavrinides" To: "Tapestry users" Sent: Monday, 27 July, 2009 12:45:29 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services Thanks Kristian! Thats good enough for me, I think the documentation should include this point though. Cheers, Peter - Original Message - From: "Kristian Marinkovic" To: "Tapestry users" Sent: Monday, 27 July, 2009 11:50:08 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services hi Peter, because i couldn't control the ordering of eager load services i stated that no developer may define an eager load service himself. instead i created an eager load service (StartupInitializer) that accepts an orderedconfiguration of initializers every developer must contribute to. g, kris p.stavrini...@albourne.com 27.07.2009 09:55 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema Re: Tapestry 5 IoC Eagerloading and ordering of services Hi, Before I open a jira for this I have devised an coded example to illustrate it, and hopefully get some comments: //Example: The shell of an eagerloaded service public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { //Sometimes this turns into a Null Pointer Exception as another eagerloaded service sets up the connection pool etc. //this service should start up after that one, but this is not always the case in practice?? connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build() { return new ImageService(); } public ImageService() { preloadImageCache(); } } //Workaround: adding a dependency on the other eagerloaded service solves it, but this is not a practical solution if there are many of these services public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build(SiteInitialise siteInitialise) { return new ImageService(siteInitialise); } public ImageService(SiteInitialise siteInitialise) { if(siteInitialise.isConnectionOk()) preloadImageCache(); } } If there is a way to ensure the ordering of eagerloaded services, then this is not an issue, perhaps this is a regression from the fix to http
Re: Tapestry 5 IoC Eagerloading and ordering of services
its a custom service... i created it in my project sorry for the misunderstanding g, kris p.stavrini...@albourne.com 27.07.2009 12:23 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema Re: Tapestry 5 IoC Eagerloading and ordering of services Hi Kristian, Could you please point me to the JavaDoc of this service? Thanks, Peter -- If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Please visit http://www.albourne.com/email.html for important additional terms relating to this e-mail. - Original Message - From: "Peter Stavrinides" To: "Tapestry users" Sent: Monday, 27 July, 2009 12:57:56 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services I added a documentation enhancement request: https://issues.apache.org/jira/browse/TAP5-795 Thanks again, Peter - Original Message - From: "P Stavrinides" To: "Tapestry users" Sent: Monday, 27 July, 2009 12:45:29 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services Thanks Kristian! Thats good enough for me, I think the documentation should include this point though. Cheers, Peter - Original Message - From: "Kristian Marinkovic" To: "Tapestry users" Sent: Monday, 27 July, 2009 11:50:08 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services hi Peter, because i couldn't control the ordering of eager load services i stated that no developer may define an eager load service himself. instead i created an eager load service (StartupInitializer) that accepts an orderedconfiguration of initializers every developer must contribute to. g, kris p.stavrini...@albourne.com 27.07.2009 09:55 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema Re: Tapestry 5 IoC Eagerloading and ordering of services Hi, Before I open a jira for this I have devised an coded example to illustrate it, and hopefully get some comments: //Example: The shell of an eagerloaded service public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { //Sometimes this turns into a Null Pointer Exception as another eagerloaded service sets up the connection pool etc. //this service should start up after that one, but this is not always the case in practice?? connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build() { return new ImageService(); } public ImageService() { preloadImageCache(); } } //Workaround: adding a dependency on the other eagerloaded service solves it, but this is not a practical solution if there are many of these services public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build(SiteInitialise siteInitialise) { return new ImageService(siteInitialise); } public ImageService(SiteInitialise siteInitialise) { if(siteInitialise.isConnectionOk()) preloadImageCache(); } } If there is a way to ensure the ordering of eagerloaded services, then this is not an issue, perhaps this is a regression from the fix to http://issues.apache.org/jira/browse/TAPESTRY-2267 ? otherwise I am surprised that others have not come across this, perhaps I have missed something? Cheers, Peter - Original Message - F
Re: Testify injection only works once per test
Christian Edward Gruber wrote on 27/07/2009 11:07:41: > I think that @BeforeMethod is a better one to key off-of. If > singleton-scoped objects are the only ones being injected, then > @BeforeClass makes sense, but if you're testing per-request or per- > session objects, then it's best to use @BeforeMethod, since you may be > setting state on these which needs to be fresh for each test. As I understand the Tapestry IOC, it shouldn't make any difference. Generally, service objects are actually proxy objects; with non-singleton scopes the proxy object is responsible for forwarding calls to the correct instance of the service. For example, to quote the documentation, "With perthread, the service proxy will delegate to a local service instance that is associated with the current thread. Two different threads, invoking methods on the same proxy, will ultimately be invoking methods on two different service instances, each reserved to their own thread." See "Defining Service Scope" on: http://tapestry.apache.org/tapestry5.1/tapestry-ioc/service.html This ingenious feature is what allows Tapestry IOC to inject a per-thread service into a singleton service and have that work correctly. If you are setting up state that you want to be fresh for each test, then you should consider using Testify's pertest scope: http://tapestry.formos.com/nightly/tapestry-testify/#Per-test_scope Paul --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
Custom validator for int constraint for a dynamic list
Hi can someone help me on creating an int validator like in the wiki. However This validator must be used with an ajax loop on a custom component. So a message catalog file cannot really work because the number of text fields is not known beforehand. thanx Rolf -- View this message in context: http://www.nabble.com/Custom-validator-for-int-constraint-for-a-dynamic-list-tp24678040p24678040.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5 IoC Eagerloading and ordering of services
Hi Kristian, Could you please point me to the JavaDoc of this service? Thanks, Peter -- If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Please visit http://www.albourne.com/email.html for important additional terms relating to this e-mail. - Original Message - From: "Peter Stavrinides" To: "Tapestry users" Sent: Monday, 27 July, 2009 12:57:56 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services I added a documentation enhancement request: https://issues.apache.org/jira/browse/TAP5-795 Thanks again, Peter - Original Message - From: "P Stavrinides" To: "Tapestry users" Sent: Monday, 27 July, 2009 12:45:29 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services Thanks Kristian! Thats good enough for me, I think the documentation should include this point though. Cheers, Peter - Original Message - From: "Kristian Marinkovic" To: "Tapestry users" Sent: Monday, 27 July, 2009 11:50:08 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services hi Peter, because i couldn't control the ordering of eager load services i stated that no developer may define an eager load service himself. instead i created an eager load service (StartupInitializer) that accepts an orderedconfiguration of initializers every developer must contribute to. g, kris p.stavrini...@albourne.com 27.07.2009 09:55 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema Re: Tapestry 5 IoC Eagerloading and ordering of services Hi, Before I open a jira for this I have devised an coded example to illustrate it, and hopefully get some comments: //Example: The shell of an eagerloaded service public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { //Sometimes this turns into a Null Pointer Exception as another eagerloaded service sets up the connection pool etc. //this service should start up after that one, but this is not always the case in practice?? connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build() { return new ImageService(); } public ImageService() { preloadImageCache(); } } //Workaround: adding a dependency on the other eagerloaded service solves it, but this is not a practical solution if there are many of these services public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build(SiteInitialise siteInitialise) { return new ImageService(siteInitialise); } public ImageService(SiteInitialise siteInitialise) { if(siteInitialise.isConnectionOk()) preloadImageCache(); } } If there is a way to ensure the ordering of eagerloaded services, then this is not an issue, perhaps this is a regression from the fix to http://issues.apache.org/jira/browse/TAPESTRY-2267 ? otherwise I am surprised that others have not come across this, perhaps I have missed something? Cheers, Peter - Original Message - From: "Peter Stavrinides" To: "Tapestry Mailing List" Sent: Friday, 24 July, 2009 15:59:20 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Tapestry 5 IoC Eagerloading and ordering of services Hi everyone, Is it possible to control the ordering of eagerloaded IoC s
Re: Form component generates invalid xhtml
Added. See https://issues.apache.org/jira/browse/TAP5-796 On Fri, Jul 24, 2009 at 5:12 PM, Sergey Didenko wrote: > I guess nobody have it working the right way, so I'm going to add a JIRA > issue. > > > On Thu, Jul 23, 2009 at 9:00 AM, Sergey Didenko > wrote: > > Yes, these are the first 2 lines of my Layout component: > > > > " > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> > > http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";> > > " > > > > On Thu, Jul 23, 2009 at 12:30 AM, Ulrich Stärk wrote: > >> Did you set the correct doctype inside your templates? > >> > > >
Re: Testify injection only works once per test
I think that @BeforeMethod is a better one to key off-of. If singleton-scoped objects are the only ones being injected, then @BeforeClass makes sense, but if you're testing per-request or per- session objects, then it's best to use @BeforeMethod, since you may be setting state on these which needs to be fresh for each test. cheers, Christian. On 2009-07-27, at 05:00 , Paul Field wrote: Hi Rolf, Hi I am using Testify to inject a fake repository into my testng test but I come op to a problem. when i first access the fake repository it gets injected however the second time i access the repository I get a null pointer exception. Now comes another strange thing when i debug everything works fine and the repository gets injected perfectly. At the moment Testify's TestNG integration is using @BeforeClass to process the @Inject annotations. So I can see that there might be possible scenarios that match yours: something where the '@Inject'ed field is cleared between tests for example... but it's hard to know exactly what's happening from your description. Could you give some more information (e.g. code examples) that show the problem? Also, when you debug, are you running exactly the same suite as when you aren't debugging? And is the behaviour consistent if you try this multiple times? Thanks, Paul --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e- mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures. Christian Edward Gruber e-mail: christianedwardgru...@gmail.com weblog: http://www.geekinasuit.com/ - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5 IoC Eagerloading and ordering of services
I added a documentation enhancement request: https://issues.apache.org/jira/browse/TAP5-795 Thanks again, Peter - Original Message - From: "P Stavrinides" To: "Tapestry users" Sent: Monday, 27 July, 2009 12:45:29 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services Thanks Kristian! Thats good enough for me, I think the documentation should include this point though. Cheers, Peter - Original Message - From: "Kristian Marinkovic" To: "Tapestry users" Sent: Monday, 27 July, 2009 11:50:08 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services hi Peter, because i couldn't control the ordering of eager load services i stated that no developer may define an eager load service himself. instead i created an eager load service (StartupInitializer) that accepts an orderedconfiguration of initializers every developer must contribute to. g, kris p.stavrini...@albourne.com 27.07.2009 09:55 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema Re: Tapestry 5 IoC Eagerloading and ordering of services Hi, Before I open a jira for this I have devised an coded example to illustrate it, and hopefully get some comments: //Example: The shell of an eagerloaded service public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { //Sometimes this turns into a Null Pointer Exception as another eagerloaded service sets up the connection pool etc. //this service should start up after that one, but this is not always the case in practice?? connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build() { return new ImageService(); } public ImageService() { preloadImageCache(); } } //Workaround: adding a dependency on the other eagerloaded service solves it, but this is not a practical solution if there are many of these services public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build(SiteInitialise siteInitialise) { return new ImageService(siteInitialise); } public ImageService(SiteInitialise siteInitialise) { if(siteInitialise.isConnectionOk()) preloadImageCache(); } } If there is a way to ensure the ordering of eagerloaded services, then this is not an issue, perhaps this is a regression from the fix to http://issues.apache.org/jira/browse/TAPESTRY-2267 ? otherwise I am surprised that others have not come across this, perhaps I have missed something? Cheers, Peter - Original Message - From: "Peter Stavrinides" To: "Tapestry Mailing List" Sent: Friday, 24 July, 2009 15:59:20 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Tapestry 5 IoC Eagerloading and ordering of services Hi everyone, Is it possible to control the ordering of eagerloaded IoC services, especially if the services exist is separate but dependent IoC modules. I found an issue http://issues.apache.org/jira/browse/TAPESTRY-2267 that states these service proxies are claimed and loaded collectively, however no mention is made of how to ensure the correct ordering of these claimed services? Any help with this would be greatly appreciated. Kind regards, Peter - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --
Re: Tapestry 5 IoC Eagerloading and ordering of services
Thanks Kristian! Thats good enough for me, I think the documentation should include this point though. Cheers, Peter - Original Message - From: "Kristian Marinkovic" To: "Tapestry users" Sent: Monday, 27 July, 2009 11:50:08 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Re: Tapestry 5 IoC Eagerloading and ordering of services hi Peter, because i couldn't control the ordering of eager load services i stated that no developer may define an eager load service himself. instead i created an eager load service (StartupInitializer) that accepts an orderedconfiguration of initializers every developer must contribute to. g, kris p.stavrini...@albourne.com 27.07.2009 09:55 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema Re: Tapestry 5 IoC Eagerloading and ordering of services Hi, Before I open a jira for this I have devised an coded example to illustrate it, and hopefully get some comments: //Example: The shell of an eagerloaded service public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { //Sometimes this turns into a Null Pointer Exception as another eagerloaded service sets up the connection pool etc. //this service should start up after that one, but this is not always the case in practice?? connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build() { return new ImageService(); } public ImageService() { preloadImageCache(); } } //Workaround: adding a dependency on the other eagerloaded service solves it, but this is not a practical solution if there are many of these services public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build(SiteInitialise siteInitialise) { return new ImageService(siteInitialise); } public ImageService(SiteInitialise siteInitialise) { if(siteInitialise.isConnectionOk()) preloadImageCache(); } } If there is a way to ensure the ordering of eagerloaded services, then this is not an issue, perhaps this is a regression from the fix to http://issues.apache.org/jira/browse/TAPESTRY-2267 ? otherwise I am surprised that others have not come across this, perhaps I have missed something? Cheers, Peter - Original Message - From: "Peter Stavrinides" To: "Tapestry Mailing List" Sent: Friday, 24 July, 2009 15:59:20 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Tapestry 5 IoC Eagerloading and ordering of services Hi everyone, Is it possible to control the ordering of eagerloaded IoC services, especially if the services exist is separate but dependent IoC modules. I found an issue http://issues.apache.org/jira/browse/TAPESTRY-2267 that states these service proxies are claimed and loaded collectively, however no mention is made of how to ensure the correct ordering of these claimed services? Any help with this would be greatly appreciated. Kind regards, Peter - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional
Re: Testify injection only works once per test
Hi Rolf, > Hi I am using Testify to inject a fake repository into my testng test but I > come op to a problem. > > when i first access the fake repository it gets injected however the second > time i access the repository I get a null pointer exception. > > Now comes another strange thing when i debug everything works fine and the > repository gets injected perfectly. At the moment Testify's TestNG integration is using @BeforeClass to process the @Inject annotations. So I can see that there might be possible scenarios that match yours: something where the '@Inject'ed field is cleared between tests for example... but it's hard to know exactly what's happening from your description. Could you give some more information (e.g. code examples) that show the problem? Also, when you debug, are you running exactly the same suite as when you aren't debugging? And is the behaviour consistent if you try this multiple times? Thanks, Paul --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
Re: Tapestry 5 IoC Eagerloading and ordering of services
hi Peter, because i couldn't control the ordering of eager load services i stated that no developer may define an eager load service himself. instead i created an eager load service (StartupInitializer) that accepts an orderedconfiguration of initializers every developer must contribute to. g, kris p.stavrini...@albourne.com 27.07.2009 09:55 Bitte antworten an "Tapestry users" An Tapestry users Kopie Thema Re: Tapestry 5 IoC Eagerloading and ordering of services Hi, Before I open a jira for this I have devised an coded example to illustrate it, and hopefully get some comments: //Example: The shell of an eagerloaded service public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { //Sometimes this turns into a Null Pointer Exception as another eagerloaded service sets up the connection pool etc. //this service should start up after that one, but this is not always the case in practice?? connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build() { return new ImageService(); } public ImageService() { preloadImageCache(); } } //Workaround: adding a dependency on the other eagerloaded service solves it, but this is not a practical solution if there are many of these services public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build(SiteInitialise siteInitialise) { return new ImageService(siteInitialise); } public ImageService(SiteInitialise siteInitialise) { if(siteInitialise.isConnectionOk()) preloadImageCache(); } } If there is a way to ensure the ordering of eagerloaded services, then this is not an issue, perhaps this is a regression from the fix to http://issues.apache.org/jira/browse/TAPESTRY-2267 ? otherwise I am surprised that others have not come across this, perhaps I have missed something? Cheers, Peter - Original Message - From: "Peter Stavrinides" To: "Tapestry Mailing List" Sent: Friday, 24 July, 2009 15:59:20 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Tapestry 5 IoC Eagerloading and ordering of services Hi everyone, Is it possible to control the ordering of eagerloaded IoC services, especially if the services exist is separate but dependent IoC modules. I found an issue http://issues.apache.org/jira/browse/TAPESTRY-2267 that states these service proxies are claimed and loaded collectively, however no mention is made of how to ensure the correct ordering of these claimed services? Any help with this would be greatly appreciated. Kind regards, Peter - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5 IoC Eagerloading and ordering of services
Hi, Before I open a jira for this I have devised an coded example to illustrate it, and hopefully get some comments: //Example: The shell of an eagerloaded service public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { //Sometimes this turns into a Null Pointer Exception as another eagerloaded service sets up the connection pool etc. //this service should start up after that one, but this is not always the case in practice?? connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build() { return new ImageService(); } public ImageService() { preloadImageCache(); } } //Workaround: adding a dependency on the other eagerloaded service solves it, but this is not a practical solution if there are many of these services public class ImageService { /** Cache to hold thumbnail images */ private static ConcurrentHashMap imageCache_ = new ConcurrentHashMap(); public void preloadImageCache() { DbConnection connection = null; try { connection = DatabaseConnection.getReadConnection(); //database query } catch (Exception e) { //handle exception } } public static ImageService build(SiteInitialise siteInitialise) { return new ImageService(siteInitialise); } public ImageService(SiteInitialise siteInitialise) { if(siteInitialise.isConnectionOk()) preloadImageCache(); } } If there is a way to ensure the ordering of eagerloaded services, then this is not an issue, perhaps this is a regression from the fix to http://issues.apache.org/jira/browse/TAPESTRY-2267 ? otherwise I am surprised that others have not come across this, perhaps I have missed something? Cheers, Peter - Original Message - From: "Peter Stavrinides" To: "Tapestry Mailing List" Sent: Friday, 24 July, 2009 15:59:20 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Tapestry 5 IoC Eagerloading and ordering of services Hi everyone, Is it possible to control the ordering of eagerloaded IoC services, especially if the services exist is separate but dependent IoC modules. I found an issue http://issues.apache.org/jira/browse/TAPESTRY-2267 that states these service proxies are claimed and loaded collectively, however no mention is made of how to ensure the correct ordering of these claimed services? Any help with this would be greatly appreciated. Kind regards, Peter - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Session lost when cookies disabled?
Sorry, I was wrong. In my case the problem was that "redirectTo" url was created before session. And thus before putting jsessionid in url. So the login was working fine - it was appending "jsessionid" to the url and then my code was redirecting to the old "redirectTo" url without "jsessionid". On Mon, Jul 27, 2009 at 9:52 AM, Sergey Didenko wrote: > I have the same bug. > > I tried to catch it. > > It seems that ApplicationStateManager does not trigger url based session > tracking when setting a session object from a service. But it works ok if > there a "write" to session from a component. > > I will create a JIRA if there is no objections. > > Regards, Sergey. >