001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.journal.action;
016    
017    import com.liferay.portal.struts.ActionConstants;
018    import com.liferay.portal.struts.PortletAction;
019    import com.liferay.portal.util.PortalUtil;
020    import com.liferay.portlet.journal.util.ExportArticleUtil;
021    
022    import javax.portlet.ActionRequest;
023    import javax.portlet.ActionResponse;
024    import javax.portlet.PortletConfig;
025    
026    import org.apache.struts.action.ActionForm;
027    import org.apache.struts.action.ActionMapping;
028    
029    /**
030     * @author Bruno Farache
031     */
032    public class ExportArticleAction extends PortletAction {
033    
034            @Override
035            public void processAction(
036                            ActionMapping actionMapping, ActionForm actionForm,
037                            PortletConfig portletConfig, ActionRequest actionRequest,
038                            ActionResponse actionResponse)
039                    throws Exception {
040    
041                    try {
042                            ExportArticleUtil.sendFile(actionRequest, actionResponse);
043    
044                            setForward(actionRequest, ActionConstants.COMMON_NULL);
045                    }
046                    catch (Exception e) {
047                            PortalUtil.sendError(e, actionRequest, actionResponse);
048                    }
049            }
050    
051            @Override
052            protected boolean isCheckMethodOnProcessAction() {
053                    return _CHECK_METHOD_ON_PROCESS_ACTION;
054            }
055    
056            private static final boolean _CHECK_METHOD_ON_PROCESS_ACTION = false;
057    
058    }