KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > module > admininterface > SimplePageMVCHandler


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.module.admininterface;
14
15 import java.io.IOException JavaDoc;
16
17 import javax.servlet.http.HttpServletRequest JavaDoc;
18 import javax.servlet.http.HttpServletResponse JavaDoc;
19
20
21 /**
22  * This is a simple default implementation. Overwrite the render method to process the page.
23  * @author Philipp Bracher
24  * @version $Revision: 6341 $ ($Author: philipp $)
25  */

26 public abstract class SimplePageMVCHandler extends PageMVCHandler {
27
28     /**
29      * @param name
30      * @param request
31      * @param response
32      */

33     public SimplePageMVCHandler(String JavaDoc name, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) {
34         super(name, request, response);
35     }
36
37     /**
38      * Calls the render method.
39      * @see info.magnolia.cms.servlets.MVCServletHandler#renderHtml(java.lang.String)
40      */

41     public void renderHtml(String JavaDoc view) throws IOException JavaDoc {
42         if (VIEW_SHOW.equals(view)) {
43             try {
44                 render(getRequest(), getResponse());
45             }
46             catch (Exception JavaDoc e) {
47                 log.error("Exception during rendering the page", e);
48                 e.printStackTrace(getResponse().getWriter());
49             }
50         }
51     }
52
53     /**
54      * Does the rendering job. You have to override this method.
55      * @param request
56      * @param response
57      * @throws Exception
58      */

59     protected abstract void render(HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response) throws Exception JavaDoc;
60
61 }
62
Popular Tags