1 18 19 20 package org.apache.struts.tiles.actions; 21 22 import java.io.PrintWriter ; 23 24 import javax.servlet.ServletContext ; 25 import javax.servlet.http.HttpServletRequest ; 26 import javax.servlet.http.HttpServletResponse ; 27 28 import org.apache.struts.action.Action; 29 import org.apache.struts.action.ActionForm; 30 import org.apache.struts.action.ActionForward; 31 import org.apache.struts.action.ActionMapping; 32 import org.apache.struts.tiles.DefinitionsFactory; 33 import org.apache.struts.tiles.TilesUtil; 34 35 36 37 43 44 public class ViewDefinitionsAction extends Action { 45 46 60 public ActionForward execute(ActionMapping mapping, 61 ActionForm form, 62 HttpServletRequest request, 63 HttpServletResponse response) 64 throws Exception 65 { 66 response.setContentType("text/plain"); 67 PrintWriter writer = response.getWriter(); 68 69 try { 70 ServletContext context = getServlet().getServletContext(); 71 DefinitionsFactory factory = TilesUtil.getDefinitionsFactory(request, context ); 72 writer.println( factory.toString() ); 73 } catch (Exception e) { 74 writer.println("FAIL - " + e.toString()); 75 getServlet().log("ReloadAction", e); 76 } 77 78 writer.flush(); 79 writer.close(); 80 81 return (null); 82 83 } 84 85 } 86 87 | Popular Tags |