KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > model > AbstractModelObject


1 package hudson.model;
2
3 import org.kohsuke.stapler.StaplerRequest;
4 import org.kohsuke.stapler.StaplerResponse;
5
6 import javax.servlet.ServletException JavaDoc;
7 import java.io.IOException JavaDoc;
8
9 /**
10  * {@link ModelObject} with some convenience methods.
11  *
12  * @author Kohsuke Kawaguchi
13  */

14 public abstract class AbstractModelObject implements ModelObject {
15     /**
16      * Displays the error in a page.
17      */

18     protected final void sendError(Exception JavaDoc e, StaplerRequest req, StaplerResponse rsp) throws ServletException JavaDoc, IOException JavaDoc {
19         sendError(e.getMessage(),req,rsp);
20     }
21
22     protected final void sendError(String JavaDoc message, StaplerRequest req, StaplerResponse rsp) throws ServletException JavaDoc, IOException JavaDoc {
23         req.setAttribute("message",message);
24         rsp.forward(this,"error",req);
25     }
26 }
27
Popular Tags