replaced all the line breaks by <br/>, and all the double spaces by the html version &nbsp; to preserve new lines in posts.

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@92964 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-03-11 13:03:09 +00:00
parent 65822d43ec
commit 8fed2ab7cf
1 changed files with 9 additions and 3 deletions

View File

@ -134,8 +134,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
if (user == null) {
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
user = "test.user";
// user = "massimiliano.assante";
// SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
user = "massimiliano.assante";
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
withinPortal = false;
}
else {
@ -562,8 +562,14 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
if (html == null) {
return null;
}
return html.replaceAll("&", "&amp;").replaceAll("<", "&lt;")
String toReturn = html.replaceAll("&", "&amp;").replaceAll("<", "&lt;")
.replaceAll(">", "&gt;");
// then replace all the line breaks by <br/>, and all the double spaces by the html version &nbsp;
toReturn = toReturn.replaceAll("(\r\n|\n)","<br />");
toReturn = toReturn.replaceAll("\\s\\s","&nbsp;&nbsp;");
return toReturn;
}
/**