I am facing a problem while returning a string. I have a java code and which will convert to image. I am able to convert the image in the backend using this Java code but i need to do this in frontend.
String responseString="ë!!ëh$þë.ë
(-0mÓæEÈRjqY-ÖÉr-Êjêתl-d@i¶`é¥mÛzàMÄínþÎmÝÞmÞ®ßþmàná&&nÓ:mãêëã^írLî6ví^î³fî&r®Ù~®Â®ÛÜBìéöfêâÞ:@ëö-à
¸o¿ú¨üÒ¯ýf"æïðò/þoè¬ { 0+0;0_ÆÌTðø6øïktðS§0 K® o#
$ð[@?0t¬È'YpÓño0± íò8ø¥¥ÄFðd¾ÞFBùÁ¸éû&k%Jb<±hÁåJ?¤?| y®0Æp Ó0ãÀlÀÀXAðÿÀÿìðS°ñz±÷T? "×<óq ÿ1ò
ærhíû-×ïMèr®pTdEþkÎÀµÎ´ó #< Ø ¬´A=?³?às>»Xó@ôA«©dRøCCoÀC8ßDEFórlôØÊGÓáHÿÁÚ4tJ¯4 ´ôKCóO3XдM.Atâêô¤*4C;4Dï.B5
_ô×f´(õæ2µâSGµ$O5J«4K»´3k5rMsdXçôt
´Ëô@@
0VPÀûûû<ü æü´öÀf(æoAFVüÅ?@
Dhp!C¹f¼Ø5"þÇ%ymÊ-cÂIÓfN<}JÔ(R¥LBJÕêÕ¬
8ÚÂ
-Ë&û"øðxáÍ`r¨&2Ðá ¾xüI-bP`þ£ôJÈà@A&î è øÀèp»2ã*òAÃÉ:ü0 I4 Ud aÆfÀQG}L
:î!a O¸?þ±pD.ü;Ç¢¢¯p7à+xArnA!HèòÀý#X¼ hV"
String fileName = "one.gif";
String fileLocation = new File("src\\main\\resources\\static\\img").getAbsolutePath() + "\\" + fileName;
FileOutputStream fos = new FileOutputStream(fileLocation);
fos.write(responseString.getBytes("ISO-8859-1"));
fos.flush();
fos.close();
I want to return this responseString and use in angularJs. How to return form Restcontroller and use in Angular/HTML? When I return directly responseString I am getting ERRORError: [$http:baddata] http://errors.angularjs.org/1.6.4/$http/baddata? also.