Hi all, I'm using Wicket as some render engine to render mails for reports consisting of different individual render approaches: plain text only, HTML only, a combination of both. In the latter case I of course would like to simply reuse the former approaches, but am not sure if the used ComponentRenderer does support that.
My individual rendering looks like the following: > private static String > forSome(VwrCtx ctx, > Supplier<VwrHtmlPage> page) > { > try (VwrCtxThreadScoped scopedCtx = new VwrCtxThreadScoped(ctx)) > { > VwrHtmlApp app = new VwrHtmlApp(); > ComponentRenderer renderer = new ComponentRenderer(app); > CharSequence retVal = renderer.renderPage(page); > > return retVal.toString(); > } > } "renderer.renderPage" is where I would call the above additionally to provide text- and HTML-only. From my understanding that should be safe, because ComponentRenderer supports multiple different contexts for app etc.: > private <T> T inThreadContext(Supplier<T> supplier) > { > ThreadContext oldContext = ThreadContext.detach(); > > try > { > ThreadContext.setApplication(application); > > return supplier.get(); > } > finally > { > > ThreadContext.restore(oldContext); > } > } As well I really only need to render within one and the same thread one after another, I'm not resuing apps or contexts between different threads in parallel. If that would be needed at some point, it would be dealt with at a higher level rendering using some threadpool. So, is it safe to render recursively using ComponentRenderer within one and the same thread? Thanks! Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...........05151- 9468- 55 Fax...............05151- 9468- 88 Mobil..............0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org