I am working on prototyping something, and I'm hoping someone can help me. I am trying to create an Add event to calendar
link which will download and open an iCal file (.ics), so that they can add it to their calendar.
We are using Jax-RS with Jersey and tomcat as the container, and I have the iCal4j
package. The client is jQuery/backbone.
Thanks, Ray
You should not create a file to return the data. You should be able to return your Calendar object directly. Try something like:
@GET
@Path("calendar")
@Produces("text/calendar")
public Response generateCalendar() {
Calendar calendar = new Calendar();
// Generate your calendar here
ResponseBuilder builder = Response.ok();
builder.header("content-disposition", "attachment;filename=calendar.ics");
builder.entity(calendar.toString());
return builder.build();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.