Hi Richard, When viewing the string in webtools, please could you view the string in your browser's developer tool's element view - e.g. right-click the string and choose Inspect. Alternatively you could right-click the page and choose 'View Source'
I suspect the formatting is preserved in the sources of the web page sources, but it stripped out when the browser renders the page. In your testResponse.ftl file, try surrounding the formatted string with <pre> tags (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre) Please let us know how you get on. Dan. On Tue, 16 May 2023 at 23:29, Richard Fleming <[email protected]> wrote: > Daniel,Thanks for your quick response!I'm running 17.12.06 > > The service is a simple java service that calls chatGpt and returns the > text response as a json object.I use jackson to create the response text as > a String. > I've run the java response string out to a file(textfile.txt) and to both > the console log and > the ofbiz log. In all cases the text is formatted. > In the webtools service engine, I run the service and the return screen > shows no formatting. Likewise,running the service in the request definition > in the controller and then displaying the result in a screen definition > testResponse.ftl, the formatting is lost. > It seems as though this is the intended behavior... or a bug. Is it > possible that Tomcat is changing it for security reasons? > > Thanks for any enlightenment. > Rick > > On Tuesday, May 16, 2023 at 12:23:00 PM MDT, Daniel Watford < > [email protected]> wrote: > > Hi Richard, > > I don't think OFBiz service engine should be altering the content of a > string return value. If it was doing so I would have assumed that to be a > bug. > > Do you have a small reproduction case we can check? How are you observing > that the return value has changed? Any chance the place you are observing > the string is not rendering carriage returns, newlines, tabs correctly? > > If you are rendering the string in HTML, the browser is likely removing all > superfluous whitespace. In that case you would need to use <pre> tags in > your output. > > Also, what version of OFBiz are you using? > > Dan. > > On Tue, 16 May 2023 at 17:59, Richard Fleming <[email protected]> wrote: > > > Hi all, > > I have a service that creates a prompt and calls an outside API endpoint. > > The return from the API is formatted text.But when I get the return field > > from the ofbiz service, the formatting is lost. > > Is there a way for ofbiz to keep the text formatting in the return field? > > In this case the return field is defined as String. > > TIARick > > > > > -- > Daniel Watford > -- Daniel Watford
