Display File not Download Java

[1] Hi I have the following Java that returns a file: // BEGIN USER CODE String inputString="foobar"; InputStream stream = new ByteArrayInputStream(inputString.getBytes(StandardCharsets.UTF_8)); IMendixObject retval=Core.instantiate(getContext(),"System.FileDocument"); Core.storeFileDocumentContent(getContext(), retval, "foo.txt", stream); return retval; // END USER CODE It creates data for a File Download activity, with the activity set to display file in browser if possible. The file does not display, yet it is a simple text file. How do I resove this? How do I force content type as in this C CGI but in Java: int main(int argc,char** argv){ printf("%s%c%c\n", "Content-Type:text/html;charset=iso-8859-1",13,10); printf("foobar"); . . . [2] It might be possible to force the behavior I want with a request handler, have only recently started experimenting with that. Thankyou
1 answers

This doesn't seem to have anything to do with the way you created the files. Uploading files directly to System.filedocument and then trying to display them with a download activity seems to always download and not show the file in the browser. Even when the file is a valid html file the user is prompted to download the file. Tested with chrome 43.0.2357.124 and firefox 38.0.5 and IE 11. Tested with the security in the modeler on and off, both give the same result. This might be an issue with Mx 5.16.1, to verify try and test this with a lower Mx version.