I want to work with long strings (size minimum: 100kb) on Xpages. I assume the best method to store a large string is in a data field of the type "Rich Text". Right now I am stuck with the data handing of this string. How can I transfer this string between server and client?
So far I tried:
data binding controls: Rich text field (Problem: formats the text, tags), text field (Problem: does not work after a certain size)
implementing a rest service: The response body will be cut off at a certain point
<xe:restService pathInfo="getTestString">
<xe:this.service>
<xe:customRestService>
<xe:this.doGet><![CDATA[#{javascript:var id = context.getUrlParameter("documentId");
session.getCurrentDatabase().getDocumentByID(id).getItemValueString("test");}]]></xe:this.doGet>
</xe:customRestService>
</xe:this.service>
</xe:restService>
var url = new URL(window.location.href);
var documentId = url.searchParams.get("documentId");
xhr.open('GET', './rest.xsp/getTestString?documentId=' + documentId, true);;
xhr.send(null);
xhr.response;
So I was wondering whether I missed out on a configuration of my REST Service. Which other alternatives are available to transfer large data between client and server on Xpages?
I tested your scenario. doc.getItemValueString()
only reads 64 KB of data from the rich text field. If you want all data you can use (in SSJS):
var doc = database.getDocumentByUNID(id);
var item:NotesRichTextItem = doc.getFirstItem('test');
return item.getUnformattedText();
Looks like that method return the exact text from the rich text item, no paragraph characters are inserted.