001
014
015 package com.liferay.portlet.journal.action;
016
017 import com.liferay.portal.kernel.servlet.ServletResponseUtil;
018 import com.liferay.portal.kernel.util.ContentTypes;
019 import com.liferay.portal.kernel.util.ParamUtil;
020 import com.liferay.portal.util.PortalUtil;
021 import com.liferay.portlet.dynamicdatamapping.util.DDMXMLUtil;
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 @Override
037 public ActionForward execute(
038 ActionMapping actionMapping, ActionForm actionForm,
039 HttpServletRequest request, HttpServletResponse response)
040 throws Exception {
041
042 try {
043 String xml = ParamUtil.getString(request, "xml");
044
045 xml = DDMXMLUtil.formatXML(xml);
046
047 String fileName = "structure.xml";
048 byte[] bytes = xml.getBytes();
049
050 ServletResponseUtil.sendFile(
051 request, response, fileName, bytes, ContentTypes.TEXT_XML_UTF8);
052
053 return null;
054 }
055 catch (Exception e) {
056 PortalUtil.sendError(e, request, response);
057
058 return null;
059 }
060 }
061
062 }