github.com/gogf/gf@v1.16.9/frame/gmvc/controller.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 // Package gmvc provides basic object classes for MVC. 8 // Deprecated, no longer suggested. 9 package gmvc 10 11 import ( 12 "github.com/gogf/gf/net/ghttp" 13 ) 14 15 // Controller is used for controller register of ghttp.Server. 16 // Deprecated, no longer suggested. 17 type Controller struct { 18 Request *ghttp.Request 19 Response *ghttp.Response 20 Server *ghttp.Server 21 Cookie *ghttp.Cookie 22 Session *ghttp.Session 23 View *View 24 } 25 26 // Init is the callback function for each request initialization. 27 func (c *Controller) Init(r *ghttp.Request) { 28 c.Request = r 29 c.Response = r.Response 30 c.Server = r.Server 31 c.View = NewView(r.Response) 32 c.Cookie = r.Cookie 33 c.Session = r.Session 34 } 35 36 // Shut is the callback function for each request close. 37 func (c *Controller) Shut() { 38 39 } 40 41 // Exit equals to function Request.Exit(). 42 func (c *Controller) Exit() { 43 c.Request.Exit() 44 }