1
14
15 package com.liferay.portlet.journal.action;
16
17 import com.liferay.portal.kernel.util.ContentTypes;
18 import com.liferay.portal.kernel.util.ParamUtil;
19 import com.liferay.portal.util.PortalUtil;
20 import com.liferay.portlet.journal.util.JournalUtil;
21 import com.liferay.util.servlet.ServletResponseUtil;
22
23 import javax.servlet.http.HttpServletRequest;
24 import javax.servlet.http.HttpServletResponse;
25
26 import org.apache.struts.action.Action;
27 import org.apache.struts.action.ActionForm;
28 import org.apache.struts.action.ActionForward;
29 import org.apache.struts.action.ActionMapping;
30
31
36 public class GetStructureContentAction extends Action {
37
38 public ActionForward execute(
39 ActionMapping mapping, ActionForm form, HttpServletRequest request,
40 HttpServletResponse response)
41 throws Exception {
42
43 try {
44 String xml = ParamUtil.getString(request, "xml");
45
46 xml = JournalUtil.formatXML(xml);
47
48 String fileName = "structure.xml";
49 byte[] bytes = xml.getBytes();
50
51 ServletResponseUtil.sendFile(
52 response, fileName, bytes, ContentTypes.TEXT_XML_UTF8);
53
54 return null;
55 }
56 catch (Exception e) {
57 PortalUtil.sendError(e, request, response);
58
59 return null;
60 }
61 }
62
63 }