Froala Editor Java sdk Examples don’t work

Tags: , , ,



When I try to upload image with the exmaple given in the froala java sdk, the picture is stored in local storage but the picture disappear because the server have no access to the folder.

Error here:

froala upload image error 404

Answer

Just added new context in the Tomcat file server.xml to point to the folder images in the root of the server:

<Context docBase="images" path="" reloadable="true" source="your source"/>

Then in class File.class changed parameters in method FileUtils.copyInputStreamToFile to save images in this folder.

And I should add a Thread.sleep(5000) after Image.upload() call in UploadImage.java to display image otherwise it didn’t work. I think there is a problem with synchronization between the upload and the http request GET which get the image.

So I didn’t succeed to create my own servlet so I used those in froala sdk examples.

I tried to find where the http request GET is made in froala’s javascript, to change the URL in http request but didn’t find.

Didn’t understand why the froala example didn’t work but find how to make it works in other way.



Source: stackoverflow