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
1053b63b
Commit
1053b63b
authored
May 03, 2015
by
cr7pt0gr4ph7
Committed by
astaxie
May 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve documentation of filter.go.
parent
3bd6caae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
filter.go
filter.go
+9
-7
No files found.
filter.go
View file @
1053b63b
...
...
@@ -16,11 +16,12 @@ package beego
import
"github.com/astaxie/beego/context"
// FilterFunc defines
filter function type
.
// FilterFunc defines
a filter function which is invoked before the controller handler is executed
.
type
FilterFunc
func
(
*
context
.
Context
)
// FilterRouter defines filter operation before controller handler execution.
// it can match patterned url and do filter function when action arrives.
// FilterRouter defines a filter operation which is invoked before the controller handler is executed.
// It can match the URL against a pattern, and execute a filter function
// when a request with a matching URL arrives.
type
FilterRouter
struct
{
filterFunc
FilterFunc
tree
*
Tree
...
...
@@ -28,10 +29,11 @@ type FilterRouter struct {
returnOnOutput
bool
}
// ValidRouter check current request is valid for this filter.
// if matched, returns parsed params in this request by defined filter router pattern.
func
(
f
*
FilterRouter
)
ValidRouter
(
router
string
)
(
bool
,
map
[
string
]
string
)
{
isok
,
params
:=
f
.
tree
.
Match
(
router
)
// ValidRouter checks if the current request is matched by this filter.
// If the request is matched, the values of the URL parameters defined
// by the filter pattern are also returned.
func
(
f
*
FilterRouter
)
ValidRouter
(
url
string
)
(
bool
,
map
[
string
]
string
)
{
isok
,
params
:=
f
.
tree
.
Match
(
url
)
if
isok
==
nil
{
return
false
,
nil
}
...
...
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