Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Taking more time in generating ics file as servlet response when special characters inside it.

Avatar

Level 1

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.

2 Replies

Avatar

Employee Advisor

I don't think that this is related to these characters, but there are other aspects which influence the runtime of this code. 

My first guess is that on your CS environments you have much more content than on your local environment.

Avatar

Level 1

Hi @Jörg_Hoh , ICS content is an authorable content. we tried with same content in local and in cloud env. Where in cloud env it took more time (more than 2 mins) for ICS file to get downloaded. But in local it is instant. 
When we removed emdash "", endash "" , generation of ics file is quicker. we were able to reproduce this scenario with various other special characters as well.