001
014
015 package com.liferay.portlet.journal.action;
016
017 import com.liferay.portal.kernel.util.ContentTypes;
018 import com.liferay.portal.kernel.util.ParamUtil;
019 import com.liferay.portal.util.PortalUtil;
020 import com.liferay.portlet.journal.util.JournalUtil;
021 import com.liferay.util.servlet.ServletResponseUtil;
022
023 import javax.servlet.http.HttpServletRequest;
024 import javax.servlet.http.HttpServletResponse;
025
026 import org.apache.struts.action.Action;
027 import org.apache.struts.action.ActionForm;
028 import org.apache.struts.action.ActionForward;
029 import org.apache.struts.action.ActionMapping;
030
031
034 public class GetStructureContentAction extends Action {
035
036 public ActionForward execute(
037 ActionMapping mapping, ActionForm form, HttpServletRequest request,
038 HttpServletResponse response)
039 throws Exception {
040
041 try {
042 String xml = ParamUtil.getString(request, "xml");
043
044 xml = JournalUtil.formatXML(xml);
045
046 String fileName = "structure.xml";
047 byte[] bytes = xml.getBytes();
048
049 ServletResponseUtil.sendFile(
050 request, response, fileName, bytes, ContentTypes.TEXT_XML_UTF8);
051
052 return null;
053 }
054 catch (Exception e) {
055 PortalUtil.sendError(e, request, response);
056
057 return null;
058 }
059 }
060
061 }