Example usage for com.liferay.portal.kernel.util ContentTypes TEXT_CALENDAR

List of usage examples for com.liferay.portal.kernel.util ContentTypes TEXT_CALENDAR

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util ContentTypes TEXT_CALENDAR.

Prototype

String TEXT_CALENDAR

To view the source code for com.liferay.portal.kernel.util ContentTypes TEXT_CALENDAR.

Click Source Link

Usage

From source file:com.liferay.portlet.calendar.action.ExportEventsAction.java

License:Open Source License

@Override
public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
        ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    File file = null;// www . jav a 2s . co m

    try {
        ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

        long eventId = ParamUtil.getLong(actionRequest, "eventId");

        String exportFileName = ParamUtil.getString(actionRequest, "exportFileName");

        if (Validator.isNull(exportFileName)) {
            exportFileName = "liferay.ics";
        } else {
            exportFileName = FileUtil.getShortFileName(exportFileName);
        }

        if (eventId > 0) {
            file = CalEventServiceUtil.exportEvent(eventId);
        } else {
            file = CalEventServiceUtil.exportGroupEvents(themeDisplay.getScopeGroupId(), exportFileName);
        }

        HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest);
        HttpServletResponse response = PortalUtil.getHttpServletResponse(actionResponse);

        ServletResponseUtil.sendFile(request, response, exportFileName, new FileInputStream(file),
                ContentTypes.TEXT_CALENDAR);

        setForward(actionRequest, ActionConstants.COMMON_NULL);
    } catch (Exception e) {
        _log.error(e, e);
    } finally {
        FileUtil.delete(file);
    }
}

From source file:it.smc.calendar.sync.caldav.CalendarBookingResourceImpl.java

License:Open Source License

@Override
public String getContentType() {
    return ContentTypes.TEXT_CALENDAR;
}

From source file:it.smc.calendar.sync.caldav.CalendarResourceImpl.java

License:Open Source License

@Override
public String getContentType() {
    return ContentTypes.TEXT_CALENDAR + "; component=vevent";
}