How can I save edits to a page's HTML when using a renderer?

Matt Albone May 19, 2013

Hello, I'm looking to try and build a plugin that will scan through a bunch of pages and fix a load of links.

You can't access the links using the standard 'page.getBodyAsString()' so I used the renderer to output the body as HTML, and now I have access to the links and can manipulate them how I want to which is great.

What I'm stuck with is how I now save those edits back into the page?

Here's a bit of code to give some context...

String pageHTML = renderer.render(page.getContentEntityObject());
pageHTML = pageHTML.replaceAll("x", "y"); //Make changes to the page HTML

So I have this string, 'pageHTML' which I can manipulate to my hearts content, but can anyone help me with how to save this string as the new HTML of the page in question once I'm done making changes?

Thanks in advance

Matt

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
StevenA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2013

You can use : <%=pageHTML%> to print out the whole contents on your current *.jsp page

TAGS
AUG Leaders

Atlassian Community Events