01: /**
02: * Copyright (C) 2006, 2007 David Bulmore, Software Sensation Inc.
03: * All Rights Reserved.
04: *
05: * This file is part of jWebApp.
06: *
07: * jWebApp is free software; you can redistribute it and/or modify it under
08: * the terms of the GNU General Public License (Version 2) as published by
09: * the Free Software Foundation.
10: *
11: * jWebApp is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with jWebApp; if not, write to the Free Software Foundation,
18: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19: */package jwebapp.controller;
20:
21: /**
22: * The Model/Business Objects interface. All request validation and processing is done here.
23: */
24: public abstract class RequestHandler {
25: public static final String SUCCESS = "success";
26: public static final String VALIDATION_ERROR = "validationError";
27: public static final String NO_FORWARDING = "noForwarding";
28: public static final String AUTHENTICATION_ERROR = "authenticationError";
29: public static final String NOT_SECURE_ERROR = "notSecureError";
30:
31: /**
32: * Is extended by the developer to define whether to validate request parameters or not.
33: * @return true or false, defaults to true.
34: */
35: public boolean validateParameters() {
36: return true;
37: }
38:
39: /**
40: * Is extended by the developer to provide custom validation of the requests data.
41: * @param serverInterface server interface
42: * @return forwarding string indicating success or failure.
43: */
44: public String validateRequest(ServerInterface serverInterface)
45: throws Exception {
46: return SUCCESS;
47: }
48:
49: /**
50: * Is extended by the developer to provide custom handling of the requests data.
51: * Mostly store and/or retrieve data from the model/business objects.
52: * @param serverInterface server interface
53: * @return forwarding string.
54: */
55: public abstract String processRequest(
56: ServerInterface serverInterface) throws Exception;
57: }
|