cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CAP Java - odata function returning text/plain

Moritz__
Explorer
0 Likes
329

Hello!

Question summary: Can the Java CAP framework return other content-types than xml and json with a custom event handler?

For odata the standard return content-types are xml and json, but if client and server specify the correct accept headers, than it is possible other content-types. I saw nothing in the Java CAP documentation regarding setting the content type. The implementation of the result object requires iterable maps. Given our niche use-case and the missing indication on the documentation, I assume the answer to my question is no.

We need to provide our users with a plain text file with some data from our database. The content of the file created in our Java CAP application. The function to create the file content needs to be in the backend as it is needed in some other processes. The frontend is a SAP Fiori app. My approach is to use a function on my service and to return the calculated file content. Ideally would be to be able to return text/plain. My workaround would be to return json with a list of strings and use JavaScript to create the text file in the frontend. I also thought about creating a rest controller with the spring boot functionality, but I'd like to keep the implementation close to the standard.

I am happy to hear, it there is a solution to my problem.

I am also happy to hear, if you are not aware of a solution and to our knowledge my assumption is correct.

Thank you and best regards,

Moritz

Accepted Solutions (0)

Answers (0)