Re: Render a Wicket page to a string for HTML email
That works , thank you! But I have another question: when I use requestLogger.getLiveSessions() to get the live sessions,the number of sessions always increased after I call the render api. Is it possible to render page of html source in the same session(not create a new one)? Thank you! Scott Swank wrote: Here is a largely equivalent class that I created. It simply extends BaseWicketTester. public class PageRenderer extends BaseWicketTester { private final Locale locale; public PageRenderer(Locale locale) { this.locale = locale; } public PageRenderer() { this.locale = null; } private String renderStartPage() { if (this.locale != null) { getWicketSession().setLocale(locale); } return getServletResponse().getDocument(); } public synchronized String render(Class? extends WebPage pageClass) { startPage(pageClass); return renderStartPage(); } public synchronized String render(Class? extends WebPage pageClass, PageParameters parameters) { startPage(pageClass, parameters); return renderStartPage(); } public synchronized String render(WebPage page) { startPage(page); return renderStartPage(); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p27914411.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Render a Wicket page to a string for HTML email
Here is another way I used when I was in need of this feature. This one simulates a request cycle. I don't know if you could adapt this to fit your needs (maybe doing the same, but with the real requestCycle instead) ? http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ Cheers, Xavier 2010/3/16 rolandpeng rolandp...@cht.com.tw That works , thank you! But I have another question: when I use requestLogger.getLiveSessions() to get the live sessions,the number of sessions always increased after I call the render api. Is it possible to render page of html source in the same session(not create a new one)? Thank you! Scott Swank wrote: Here is a largely equivalent class that I created. It simply extends BaseWicketTester. public class PageRenderer extends BaseWicketTester { private final Locale locale; public PageRenderer(Locale locale) { this.locale = locale; } public PageRenderer() { this.locale = null; } private String renderStartPage() { if (this.locale != null) { getWicketSession().setLocale(locale); } return getServletResponse().getDocument(); } public synchronized String render(Class? extends WebPage pageClass) { startPage(pageClass); return renderStartPage(); } public synchronized String render(Class? extends WebPage pageClass, PageParameters parameters) { startPage(pageClass, parameters); return renderStartPage(); } public synchronized String render(WebPage page) { startPage(page); return renderStartPage(); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p27914411.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Klein bottle for rent--inquire within.
Re: Render a Wicket page to a string for HTML email
Oops, forgot to mention that code has a pair of bugs in it. Here is the implementation i came up with : public class RenderHTMLUtils { public static String renderPage(Page page) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); //requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); requestCycle.setRequestTarget(new PageRequestTarget(page)); try { requestCycle.getProcessor().respond(requestCycle); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } } Cheers, Xavier 2010/3/16 Xavier López xavil...@gmail.com Here is another way I used when I was in need of this feature. This one simulates a request cycle. I don't know if you could adapt this to fit your needs (maybe doing the same, but with the real requestCycle instead) ? http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ Cheers, Xavier 2010/3/16 rolandpeng rolandp...@cht.com.tw That works , thank you! But I have another question: when I use requestLogger.getLiveSessions() to get the live sessions,the number of sessions always increased after I call the render api. Is it possible to render page of html source in the same session(not create a new one)? Thank you! Scott Swank wrote: Here is a largely equivalent class that I created. It simply extends BaseWicketTester. public class PageRenderer extends BaseWicketTester { private final Locale locale; public PageRenderer(Locale locale) { this.locale = locale; } public PageRenderer() { this.locale = null; } private String renderStartPage() { if (this.locale != null) { getWicketSession().setLocale(locale); } return getServletResponse().getDocument(); } public synchronized String render(Class? extends WebPage pageClass) { startPage(pageClass); return renderStartPage(); } public synchronized String render(Class? extends WebPage pageClass, PageParameters parameters) { startPage(pageClass, parameters); return renderStartPage(); } public synchronized String render(WebPage page) { startPage(page); return renderStartPage(); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://old.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p27914411.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Klein bottle for rent--inquire within.
Re: Render a Wicket page to a string for HTML email
Thank you. I have tested your implementation class,but it still the same(live sessions increasing) while I call requestLogger.getLiveSessions(). Does anyone have other advice? Thank you so much in advance. Xavier López-2 wrote: Oops, forgot to mention that code has a pair of bugs in it. Here is the implementation i came up with : public class RenderHTMLUtils { public static String renderPage(Page page) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); //requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); requestCycle.setRequestTarget(new PageRequestTarget(page)); try { requestCycle.getProcessor().respond(requestCycle); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } } Cheers, Xavier -- View this message in context: http://old.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p27916314.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Render a Wicket page to a string for HTML email
append some more information. After tracing the sessionId in live sessions. I found several id listed below: sessionId1=3F329131CF155AEAA4FB383AD854E510 (normal format,created by login) sessionId2=7cc3d77e_12766bcf8eb__7fff (strange,created by call render api) sessionId3=7cc3d77e_12766bcf8eb__7ffd (strange,created by call reder api) I use wicket 1.4.6 for developing. rolandpeng wrote: Thank you. I have tested your implementation class,but it still the same(live sessions increasing) while I call requestLogger.getLiveSessions(). Does anyone have other advice? Thank you so much in advance. -- View this message in context: http://old.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p27916505.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Render a Wicket page to a string for HTML email
getBinaryContent was not returning anything for me. When i simply changed it to return tester.getServletResponse().getDocument() everything seemed to work. Here is the sample that works in a jUnit test, I have not yet integrated this into any real applications. public String renderPageToString(final Class? extends Page pageClass, final PageParameters pageParameters) { try { final WebApplication app = (WebApplication)WebApplication.get(); return Executors.newSingleThreadExecutor().submit( new CallableString() { public String call() throws Exception { final WicketTester tester = new WicketTester(app); tester.startPage(pageClass, pageParameters); tester.assertNoErrorMessage(); return tester.getServletResponse().getDocument(); } }).get(); } catch (InterruptedException e) { throw new WicketRuntimeException(e.getMessage(), e); } catch (ExecutionException e) { throw new WicketRuntimeException(e.getMessage(), e); } } Peter Ertl wrote: ... return new String(tester.getServletResponse().getBinaryContent(), tester.getServletResponse().getCharacterEncoding()); ... -- View this message in context: http://www.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p20370600.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
cool. let's put this to the wiki (or maybe org.apache.util.* ???) and help some people out there :-) Am 06.11.2008 um 23:01 schrieb cjlyth: getBinaryContent was not returning anything for me. When i simply changed it to return tester.getServletResponse().getDocument() everything seemed to work. Here is the sample that works in a jUnit test, I have not yet integrated this into any real applications. public String renderPageToString(final Class? extends Page pageClass, final PageParameters pageParameters) { try { final WebApplication app = (WebApplication)WebApplication.get(); return Executors.newSingleThreadExecutor().submit( new CallableString() { public String call() throws Exception { final WicketTester tester = new WicketTester(app); tester.startPage(pageClass, pageParameters); tester.assertNoErrorMessage(); return tester.getServletResponse().getDocument(); } }).get(); } catch (InterruptedException e) { throw new WicketRuntimeException(e.getMessage(), e); } catch (ExecutionException e) { throw new WicketRuntimeException(e.getMessage(), e); } } Peter Ertl wrote: ... return new String(tester.getServletResponse().getBinaryContent(), tester.getServletResponse().getCharacterEncoding()); ... -- View this message in context: http://www.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p20370600.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
final WebApplication app = (WebApplication)WebApplication.get(); this will not work reliably unless you created a new WicketTester before in your tests or are running inside a current request handled by WicketFilter (needed to initialize the ThreadLocal Application instance in Application) Am 06.11.2008 um 23:01 schrieb cjlyth: getBinaryContent was not returning anything for me. When i simply changed it to return tester.getServletResponse().getDocument() everything seemed to work. Here is the sample that works in a jUnit test, I have not yet integrated this into any real applications. public String renderPageToString(final Class? extends Page pageClass, final PageParameters pageParameters) { try { final WebApplication app = (WebApplication)WebApplication.get(); return Executors.newSingleThreadExecutor().submit( new CallableString() { public String call() throws Exception { final WicketTester tester = new WicketTester(app); tester.startPage(pageClass, pageParameters); tester.assertNoErrorMessage(); return tester.getServletResponse().getDocument(); } }).get(); } catch (InterruptedException e) { throw new WicketRuntimeException(e.getMessage(), e); } catch (ExecutionException e) { throw new WicketRuntimeException(e.getMessage(), e); } } Peter Ertl wrote: ... return new String(tester.getServletResponse().getBinaryContent(), tester.getServletResponse().getCharacterEncoding()); ... -- View this message in context: http://www.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p20370600.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
Here is a largely equivalent class that I created. It simply extends BaseWicketTester. public class PageRenderer extends BaseWicketTester { private final Locale locale; public PageRenderer(Locale locale) { this.locale = locale; } public PageRenderer() { this.locale = null; } private String renderStartPage() { if (this.locale != null) { getWicketSession().setLocale(locale); } return getServletResponse().getDocument(); } public synchronized String render(Class? extends WebPage pageClass) { startPage(pageClass); return renderStartPage(); } public synchronized String render(Class? extends WebPage pageClass, PageParameters parameters) { startPage(pageClass, parameters); return renderStartPage(); } public synchronized String render(WebPage page) { startPage(page); return renderStartPage(); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
Yeah this is about the same, I think you would still have to do it in its own thread. try { return Executors.newSingleThreadExecutor().submit( new CallableString() { public String call() throws Exception { return new PageRenderer().render(pageClass, pageParameters); } }).get(); } catch (InterruptedException e) { throw new WicketRuntimeException(e.getMessage(), e); } catch (ExecutionException e) { throw new WicketRuntimeException(e.getMessage(), e); } I think its also worth mentioning that Anatoly Kupriyanov has a template implementation that might solve this problem. However, I like the simpler approach in this thread. http://cwiki.apache.org/confluence/display/WICKET/Use+wicket+as+template+engine Scott Swank wrote: Here is a largely equivalent class that I created. It simply extends BaseWicketTester. ... -- View this message in context: http://www.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p20372800.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
Ours is running in a separate, non-Wicket process that just generates and sends e-mail, so there's nothing to step on. But otherwise yes, you would want to protect your ThreadLocal. On Thu, Nov 6, 2008 at 4:52 PM, cjlyth [EMAIL PROTECTED] wrote: Yeah this is about the same, I think you would still have to do it in its own thread. try { return Executors.newSingleThreadExecutor().submit( new CallableString() { public String call() throws Exception { return new PageRenderer().render(pageClass, pageParameters); } }).get(); } catch (InterruptedException e) { throw new WicketRuntimeException(e.getMessage(), e); } catch (ExecutionException e) { throw new WicketRuntimeException(e.getMessage(), e); } I think its also worth mentioning that Anatoly Kupriyanov has a template implementation that might solve this problem. However, I like the simpler approach in this thread. http://cwiki.apache.org/confluence/display/WICKET/Use+wicket+as+template+engine Scott Swank wrote: Here is a largely equivalent class that I created. It simply extends BaseWicketTester. ... -- View this message in context: http://www.nabble.com/Render-a-Wicket-page-to-a-string-for-HTML-email-tp20325702p20372800.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
Great work! You should put this on the Wiki :-) Am 05.11.2008 um 11:22 schrieb Jörn Zaefferer: No voodoo neccessary, got it working: protected String renderPage(Class? extends Page pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.getProcessor().respond(requestCycle); log.warn(Response after request: +webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } Does it make sense to put this in a ticket to request it for Wicket 1.5? Jörn On Tue, Nov 4, 2008 at 5:55 PM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http:// wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
No voodoo neccessary, got it working: protected String renderPage(Class? extends Page pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.getProcessor().respond(requestCycle); log.warn(Response after request: +webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } Does it make sense to put this in a ticket to request it for Wicket 1.5? Jörn On Tue, Nov 4, 2008 at 5:55 PM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
Is the setAjax(true) absolutely necessary in all cases? On Wed, Nov 5, 2008 at 5:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: No voodoo neccessary, got it working: protected String renderPage(Class? extends Page pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.getProcessor().respond(requestCycle); log.warn(Response after request: +webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } Does it make sense to put this in a ticket to request it for Wicket 1.5? Jörn On Tue, Nov 4, 2008 at 5:55 PM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
make sure you do this in a thread other then the request thread so you dont mess up any threadlocals. -igor On Wed, Nov 5, 2008 at 2:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: No voodoo neccessary, got it working: protected String renderPage(Class? extends Page pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.getProcessor().respond(requestCycle); log.warn(Response after request: +webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } Does it make sense to put this in a ticket to request it for Wicket 1.5? Jörn On Tue, Nov 4, 2008 at 5:55 PM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
Won't it be easier / will it work to use WicketTester for this? Am 05.11.2008 um 17:26 schrieb Igor Vaynberg: make sure you do this in a thread other then the request thread so you dont mess up any threadlocals. -igor On Wed, Nov 5, 2008 at 2:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: No voodoo neccessary, got it working: protected String renderPage(Class? extends Page pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.getProcessor().respond(requestCycle); log.warn(Response after request: +webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } Does it make sense to put this in a ticket to request it for Wicket 1.5? Jörn On Tue, Nov 4, 2008 at 5:55 PM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
you still have to do it in a separate thread :) -igor On Wed, Nov 5, 2008 at 9:14 AM, Peter Ertl [EMAIL PROTECTED] wrote: Won't it be easier / will it work to use WicketTester for this? Am 05.11.2008 um 17:26 schrieb Igor Vaynberg: make sure you do this in a thread other then the request thread so you dont mess up any threadlocals. -igor On Wed, Nov 5, 2008 at 2:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: No voodoo neccessary, got it working: protected String renderPage(Class? extends Page pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.getProcessor().respond(requestCycle); log.warn(Response after request: +webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } Does it make sense to put this in a ticket to request it for Wicket 1.5? Jörn On Tue, Nov 4, 2008 at 5:55 PM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
So would this be ok ?! (caution! untested!) try { final String html = Executors.newSingleThreadExecutor().submit(new CallableString() { public String call() throws Exception { final WicketTester tester = new WicketTester(); tester.startPage(MyPage.class); return new String(tester.getServletResponse().getBinaryContent(), tester.getServletResponse().getCharacterEncoding()); } }).get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } Am 05.11.2008 um 18:18 schrieb Igor Vaynberg: you still have to do it in a separate thread :) -igor On Wed, Nov 5, 2008 at 9:14 AM, Peter Ertl [EMAIL PROTECTED] wrote: Won't it be easier / will it work to use WicketTester for this? Am 05.11.2008 um 17:26 schrieb Igor Vaynberg: make sure you do this in a thread other then the request thread so you dont mess up any threadlocals. -igor On Wed, Nov 5, 2008 at 2:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: No voodoo neccessary, got it working: protected String renderPage(Class? extends Page pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.getProcessor().respond(requestCycle); log.warn(Response after request: +webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } Does it make sense to put this in a ticket to request it for Wicket 1.5? Jörn On Tue, Nov 4, 2008 at 5:55 PM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,
Re: Render a Wicket page to a string for HTML email
that should do it for most cases. you might want to give wickettester the actual application object also. -igor On Wed, Nov 5, 2008 at 9:26 AM, Peter Ertl [EMAIL PROTECTED] wrote: So would this be ok ?! (caution! untested!) try { final String html = Executors.newSingleThreadExecutor().submit(new CallableString() { public String call() throws Exception { final WicketTester tester = new WicketTester(); tester.startPage(MyPage.class); return new String(tester.getServletResponse().getBinaryContent(), tester.getServletResponse().getCharacterEncoding()); } }).get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } Am 05.11.2008 um 18:18 schrieb Igor Vaynberg: you still have to do it in a separate thread :) -igor On Wed, Nov 5, 2008 at 9:14 AM, Peter Ertl [EMAIL PROTECTED] wrote: Won't it be easier / will it work to use WicketTester for this? Am 05.11.2008 um 17:26 schrieb Igor Vaynberg: make sure you do this in a thread other then the request thread so you dont mess up any threadlocals. -igor On Wed, Nov 5, 2008 at 2:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: No voodoo neccessary, got it working: protected String renderPage(Class? extends Page pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.getProcessor().respond(requestCycle); log.warn(Response after request: +webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } Does it make sense to put this in a ticket to request it for Wicket 1.5? Jörn On Tue, Nov 4, 2008 at 5:55 PM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail:
Re: Render a Wicket page to a string for HTML email
public String renderPageToString(final WebApplication application, final Page page) { try { return Executors.newSingleThreadExecutor().submit(new CallableString() { public String call() throws Exception { final WicketTester tester = new WicketTester(application); tester.startPage(page); tester.assertNoErrorMessage(); return new String(tester.getServletResponse().getBinaryContent(), tester.getServletResponse().getCharacterEncoding()); } }).get(); } catch (InterruptedException e) { throw new WicketRuntimeException(e.getMessage(), e); } catch (ExecutionException e) { throw new WicketRuntimeException(e.getMessage(), e); } } Am 05.11.2008 um 18:31 schrieb Igor Vaynberg: that should do it for most cases. you might want to give wickettester the actual application object also. -igor On Wed, Nov 5, 2008 at 9:26 AM, Peter Ertl [EMAIL PROTECTED] wrote: So would this be ok ?! (caution! untested!) try { final String html = Executors.newSingleThreadExecutor().submit(new CallableString() { public String call() throws Exception { final WicketTester tester = new WicketTester(); tester.startPage(MyPage.class); return new String(tester.getServletResponse().getBinaryContent(), tester.getServletResponse().getCharacterEncoding()); } }).get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } Am 05.11.2008 um 18:18 schrieb Igor Vaynberg: you still have to do it in a separate thread :) -igor On Wed, Nov 5, 2008 at 9:14 AM, Peter Ertl [EMAIL PROTECTED] wrote: Won't it be easier / will it work to use WicketTester for this? Am 05.11.2008 um 17:26 schrieb Igor Vaynberg: make sure you do this in a thread other then the request thread so you dont mess up any threadlocals. -igor On Wed, Nov 5, 2008 at 2:22 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: No voodoo neccessary, got it working: protected String renderPage(Class? extends Page pageClass, PageParameters pageParameters) { //get the servlet context WebApplication application = (WebApplication) WebApplication.get(); ServletContext context = application.getServletContext(); //fake a request/response cycle MockHttpSession servletSession = new MockHttpSession(context); servletSession.setTemporary(true); MockHttpServletRequest servletRequest = new MockHttpServletRequest( application, servletSession, context); MockHttpServletResponse servletResponse = new MockHttpServletResponse( servletRequest); //initialize request and response servletRequest.initialize(); servletResponse.initialize(); WebRequest webRequest = new ServletWebRequest(servletRequest); BufferedWebResponse webResponse = new BufferedWebResponse(servletResponse); webResponse.setAjax(true); WebRequestCycle requestCycle = new WebRequestCycle( application, webRequest, webResponse); requestCycle.setRequestTarget(new BookmarkablePageRequestTarget(pageClass, pageParameters)); try { requestCycle.getProcessor().respond(requestCycle); log.warn(Response after request: +webResponse.toString()); if (requestCycle.wasHandled() == false) { requestCycle.setRequestTarget(new WebErrorCodeResponseTarget( HttpServletResponse.SC_NOT_FOUND)); } requestCycle.detach(); } finally { requestCycle.getResponse().close(); } return webResponse.toString(); } Does it make sense to put this in a ticket to request it for Wicket 1.5? Jörn On Tue, Nov 4, 2008 at 5:55 PM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn
Render a Wicket page to a string for HTML email
Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn
Re: Render a Wicket page to a string for HTML email
without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render a Wicket page to a string for HTML email
saving up vacation days for the caribbean baby :) -igor On Tue, Nov 4, 2008 at 9:55 AM, Martijn Dashorst [EMAIL PROTECTED] wrote: Are you in New Orleans in some voodoo bar? Why not join us at ApacheCon? :) Martijn On Tue, Nov 4, 2008 at 10:43 AM, Igor Vaynberg [EMAIL PROTECTED] wrote: without seeing your code we have to resort to waving a dead chicken in front of our screens or making swags. -igor On Tue, Nov 4, 2008 at 9:19 AM, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi, I've found this article on how to render a page to a String: http://www.danwalmsley.com/2008/10/21/render-a-wicket-page-to-a-string-for-html-email/ It seemed to be exactly what I was looking for. Copying the code into my app, I got a compiler error on the line where the WebRequest is created. Using the constructor to ServletWebRequest helped. Nonetheless, I get only an empty string back, no clue whats going wrong. I'm using Wicket 1.3.5. Any ideas? Jörn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]