We are using AEM as a cloud service. our requirement is to generate ics file as sling servlet response on click of a button on a page.
Issue: When content inside ICS file has special characters like emdash "—", endash "–", it takes lot of time to generate and download an ICS file for the first time. On the 2nd hit to the same servlet, response becomes faster as it serves cached content.
we are not able to reproduce this issue in local AEM environment. This issue is occurring only on cloud environments.
Below is the code we have which generates ics file as reponse
slingHttpServletResponse.setContentType("text/calendar");
slingHttpServletResponse.setHeader("Content-Disposition", "attachment; filename=event.ics");
slingHttpServletResponse.setCharacterEncoding("UTF-8");
slingHttpServletResponse.setContentLength(teststring.length());
slingHttpServletResponse.getWriter().write(teststring);
We also tried below code with no luck.
response.getOutputStream().write(teststring.getBytes("UTF-8"))
Please some one suggest how to fix this issue.