The revel.Controller is the context for
a single request and controls
- the incoming Request stuff
- and the Response back, in Hmtl, Json, Xml, File or your own custom.
A Controller is any type that embeds a *revel.Controller as the first field/type.
must be 'embedded' as the first type in
the a controller struct anonymously
, the Go way for 'kinda inheritance'
The revel.Controller is the context for a request and contains the
Request and Response data.
Below are the most used components and type/struct definitions to give a taste of
- As part of handling a HTTP request, Revel instantiates an instance of a revel.Controller.
- It then sets all of the properties on the embedded
- Revel does not share a
Controller instance between requests.
Extending the Controller
A Controller is any type that embeds revel.Controller either directly or indirectly.
This means controllers may extend other classes, here is an example on how to do that.
- Note in the
BaseController reference is NOT a pointer