Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
a62ed10a
Commit
a62ed10a
authored
Sep 28, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add supoort AppController
http://play.golang.org/p/MZptHZeYUx
parent
e79d756d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
controller.go
controller.go
+13
-11
router.go
router.go
+1
-0
No files found.
controller.go
View file @
a62ed10a
...
...
@@ -22,16 +22,17 @@ import (
)
type
Controller
struct
{
Ctx
*
context
.
Context
Data
map
[
interface
{}]
interface
{}
ChildName
string
TplNames
string
Layout
string
TplExt
string
_xsrf_token
string
gotofunc
string
CruSession
session
.
SessionStore
XSRFExpire
int
Ctx
*
context
.
Context
Data
map
[
interface
{}]
interface
{}
ChildName
string
TplNames
string
Layout
string
TplExt
string
_xsrf_token
string
gotofunc
string
CruSession
session
.
SessionStore
XSRFExpire
int
AppController
interface
{}
}
type
ControllerInterface
interface
{
...
...
@@ -48,13 +49,14 @@ type ControllerInterface interface {
Render
()
error
}
func
(
c
*
Controller
)
Init
(
ctx
*
context
.
Context
,
childName
string
)
{
func
(
c
*
Controller
)
Init
(
ctx
*
context
.
Context
,
childName
string
,
app
interface
{}
)
{
c
.
Data
=
make
(
map
[
interface
{}]
interface
{})
c
.
Layout
=
""
c
.
TplNames
=
""
c
.
ChildName
=
childName
c
.
Ctx
=
ctx
c
.
TplExt
=
"tpl"
c
.
AppController
=
app
}
func
(
c
*
Controller
)
Prepare
()
{
...
...
router.go
View file @
a62ed10a
...
...
@@ -448,6 +448,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
in
:=
make
([]
reflect
.
Value
,
2
)
in
[
0
]
=
reflect
.
ValueOf
(
context
)
in
[
1
]
=
reflect
.
ValueOf
(
runrouter
.
controllerType
.
Name
())
in
[
2
]
=
reflect
.
ValueOf
(
vc
.
Interface
())
method
.
Call
(
in
)
//if XSRF is Enable then check cookie where there has any cookie in the request's cookie _csrf
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment