Martin,

What does method escapeHighEnd() do?

Regards,

Ernesto

On Wed, Oct 13, 2010 at 4:11 PM, Martin Makundi
<martin.maku...@koodaripalvelut.com> wrote:
> Here:
>
>
> /**
>   * Renders given page
>   * @param pageClass to render
>   * @param pageParameters to render with
>   * @param clean
>   * @return String of HTML produced
>   */
>  public static String renderPageToString(
>      final Class<? extends Page> pageClass,
>      final PageParameters pageParameters, boolean clean) {
>    String webPageAsString;
>    {
>      WebApplication webApplication = WebApplication.get();
>      ServletContext servletContext = webApplication.getServletContext();
>      MockHttpSession servletSession = new MockHttpSession(servletContext);
>      servletSession.setTemporary(true);
>
>      MockHttpServletRequest servletRequest = new MockHttpServletRequest(
>          webApplication, servletSession, servletContext);
>      MockHttpServletResponse servletResponse = new MockHttpServletResponse(
>          servletRequest);
>      servletRequest.initialize();
>      servletResponse.initialize();
>
>      WebRequest webRequest = new ServletWebRequest(servletRequest);
>
>      BufferedWebResponse webResponse = new
> BufferedWebResponse(servletResponse);
>      webResponse.setAjax(true);
>
>      WebRequestCycle htmlRequestCycle =
>        new WebRequestCycle(webApplication, webRequest, webResponse);
>
>      BookmarkablePageRequestTarget htmlTarget =
>        new BookmarkablePageRequestTarget(pageClass, pageParameters);
>
>      htmlRequestCycle.setRequestTarget(htmlTarget);
>
>      try {
>        htmlRequestCycle.getProcessor().respond(htmlRequestCycle);
>
>        if (htmlRequestCycle.wasHandled() == false) {
>          htmlRequestCycle.setRequestTarget(new WebErrorCodeResponseTarget(
>              HttpServletResponse.SC_NOT_FOUND));
>        }
>        htmlRequestCycle.detach();
>      } finally {
>        htmlRequestCycle.getResponse().close();
>      }
>
>      webPageAsString = webResponse.toString();
>    }
>
> //    try {
> //      FileOutputStream fileOutputStream = new
> FileOutputStream("c:/temp/test.html", false);
> //      OutputStreamWriter o = new OutputStreamWriter(fileOutputStream, 
> "UTF8");
> //      o.write(webResponse.toString());
> //      o.flush();
> //      o.close();
> //    } catch (Exception e) {
> //      throw new IllegalStateException("Bug", e);
> //    }
>
>    webPageAsString = Utils.replaceAll(webPageAsString,
> WebPageConstants.SRC_URL_PATTERN, "src=\"file:///" +
> WebApplication.get().getServletContext().getRealPath("/") + "/");
>
>    if (clean) {
>      return escapeHighEnd(webPageAsString.replaceAll("<wicket.*?>", "")
>          .replaceAll("</wicket.*?>", "").replaceAll("\\swicketpath=\".*?\"",
>              ""));
>    }
>
>    return escapeHighEnd(webPageAsString);
>  }
>
>
> **
> Martin
>
> 2010/10/13 msantos <mpssan...@gmail.com>:
>>
>> Hi there.
>>
>> Is possible instanciate a WebPage component and the getting the string that
>> represents that webpage? My intention is to create a method that returns a
>> string representing a html page to use on a email.
>>
>> Thanks a lot
>> --
>> View this message in context: 
>> http://apache-wicket.1842946.n4.nabble.com/WebPage-geting-string-tp2993717p2993717.html
>> Sent from the Users forum 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
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to