org.alweb.doff.core
Class Controller
java.lang.Object
org.alweb.doff.util.error.ErrorContainer
org.alweb.doff.core.Service
org.alweb.doff.core.Controller
- All Implemented Interfaces:
- ErrorProducer
- Direct Known Subclasses:
- Debugger
public abstract class Controller
- extends Service
Represents the superclass of all of your controllers. Controllers defines
actions and a path. By default, the path of the controller is the simple name
of the class (Class.getSimpleName()) converted thanks to
PathUtilities.convert(String) method. This method precede all
uppercase letters of the class name by a slash and convert them to lowercase.
If you want to change this path, you can annotate your controller thanks to
URLPattern annotation. This path is the prefix of URL before each
action's path.
Like controller, actions can defines their proper path. By default, it's the
name of the method. It can be the overrided thanks to path property of
Action annotation. Don't forget to annotate your controller's methods
in order to consider them to actions. If an action method take any parameter
a MappingException will be thrown.
You should better override Service.init() method instead of defining a
constructor for your controllers. But, if you really want to declare your own
constructors, you must at least provide a default constructor. This
constructor can be private, protected or public.
All non static fields are assigned into the request before rendering a view
in order to use them into jsps. All fields are consired (private, public and
protected). All leading underscores into field's name are ignored for the
request attribute name.
- Author:
- Alexis Toulotte
- See Also:
Action,
URLPattern,
ControllerMapping
|
Method Summary |
void |
forwardRequest(String path)
This method has been overriden in order to assign controller's fields
into request. |
| Methods inherited from class org.alweb.doff.core.Service |
addCookie, addCookie, addHeader, addHeader, disableBrowserCache, encodeRedirectURL, encodeRedirectURL, encodeURL, encodeURL, flash, getAction, getCompleteURL, getCompleteURL, getContextPath, getCookie, getCookies, getErrors, getFileUpload, getHeader, getHeader, getHeaders, getHost, getLocale, getMethod, getOutputStream, getParam, getParamOrSessionAttr, getParamOrSessionAttr, getParams, getParams, getPathInfo, getPathInfoWithQueryString, getPathParam, getPathParam, getPort, getProtocol, getPublicURL, getQueryString, getRemoteAddress, getRequest, getRequestAttribute, getResponse, getResponseLocale, getServiceMapping, getServlet, getSession, getSessionAttribute, getSessionAttributeName, getUploadedFile, getUploadedFile, getUploadedFiles, getURL, getURL, getURL, getURL, getWriter, hasParam, init, isAjaxRequest, isHttpsRequest, isLocalRequest, paginate, paginate, paginate, paginate, print, println, redirect, redirect, redirect, redirect, redirectToPublic, removeCookie, removeCookies, removeSessionAttributes, renderFile, renderFile, renderFile, renderFile, renderFragment, renderFragment, renderFragment, renderFragment, renderStream, renderStream, renderView, renderView, renderView, renderView, responseContainsHeader, responseContainsHeader, sendError, sendError, sendError, sendNotFound, sendPermissionDenied, setContentType, setExpires, setHeader, setHeader, setLastModified, setLocale, setOutputFilename, setOutputFilename, setRequestAttribute, toString |
Controller
public Controller()
forwardRequest
public void forwardRequest(String path)
- This method has been overriden in order to assign controller's fields
into request.
- Overrides:
forwardRequest in class Service
- Parameters:
path - a String specifying the pathname to the resource.- Since:
- 1.5.2
- See Also:
ControllerMapping.assignFieldsInRequest(Controller)