1 13 package info.magnolia.module.admininterface; 14 15 import info.magnolia.cms.beans.runtime.MultipartForm; 16 import info.magnolia.cms.i18n.MessagesManager; 17 import info.magnolia.cms.servlets.MVCServletHandlerImpl; 18 import info.magnolia.cms.util.RequestFormUtil; 19 import info.magnolia.cms.util.Resource; 20 21 import java.io.IOException ; 22 23 import javax.servlet.http.HttpServletRequest ; 24 import javax.servlet.http.HttpServletResponse ; 25 26 27 32 33 public abstract class DialogPageMVCHandler extends MVCServletHandlerImpl { 34 35 protected static final String COMMAND_SHOW = "show"; 37 protected static final String VIEW_DRAW = "draw"; 39 42 protected HttpServletRequest request; 43 44 47 protected HttpServletResponse response; 48 49 52 protected MultipartForm form; 53 54 protected info.magnolia.cms.i18n.Messages msgs; 55 56 protected RequestFormUtil params; 57 58 62 public DialogPageMVCHandler(String name, HttpServletRequest request, HttpServletResponse response) { 63 super(name, request, response); 64 65 this.request = request; 66 this.response = response; 67 68 form = Resource.getPostedForm(request); 69 params = new RequestFormUtil(request, form); 70 msgs = MessagesManager.getMessages(request); 71 } 72 73 76 public String getCommand() { 77 return COMMAND_SHOW; 78 } 79 80 83 public String show() { 84 return VIEW_DRAW; 85 } 86 87 public void renderHtml(String view) throws IOException { 88 if (VIEW_DRAW.equals(view)) { 89 try { 90 draw(request, response); 91 } 92 catch (Exception e) { 93 response.getWriter().print(e); 94 } 95 } 96 } 97 98 protected abstract void draw(HttpServletRequest request, HttpServletResponse response) throws Exception ; 99 100 } | Popular Tags |