1 package org.nextime.ion.admin.action.publi; 2 3 import java.io.IOException ; 4 5 import javax.servlet.ServletException ; 6 import javax.servlet.http.HttpServletRequest ; 7 import javax.servlet.http.HttpServletResponse ; 8 9 import org.apache.struts.action.Action; 10 import org.apache.struts.action.ActionForm; 11 import org.apache.struts.action.ActionForward; 12 import org.apache.struts.action.ActionMapping; 13 import org.nextime.ion.framework.business.Publication; 14 import org.nextime.ion.framework.mapping.Mapping; 15 import org.nextime.ion.framework.mapping.MappingException; 16 17 public class XmlPubliAction extends Action { 18 19 public ActionForward perform( 20 ActionMapping mapping, 21 ActionForm form, 22 HttpServletRequest request, 23 HttpServletResponse response) 24 throws IOException , ServletException { 25 26 try { 27 String id = request.getParameter("id"); 28 int version = Integer.parseInt(request.getParameter("version")); 29 Mapping.begin(); 30 Publication p = Publication.getInstance(id); 31 Mapping.rollback(); 32 request.setAttribute("xml", p.getVersion(version).getXml()); 33 } catch (MappingException e) { 34 Mapping.rollback(); 35 throw new ServletException (e); 36 } 37 38 return mapping.findForward("view"); 39 } 40 41 } | Popular Tags |