Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
5588bfc3
authored
2014-03-29 14:55:34 +0800
by
asta.xie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
support filter to get router. get runController & runMethod
1 parent
2f4acf46
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
context/input.go
router.go
context/input.go
View file @
5588bfc
...
...
@@ -4,6 +4,7 @@ import (
"bytes"
"io/ioutil"
"net/http"
"reflect"
"strconv"
"strings"
...
...
@@ -18,6 +19,8 @@ type BeegoInput struct {
Data
map
[
interface
{}]
interface
{}
// store some values in this context when calling context in filter or controller.
Request
*
http
.
Request
RequestBody
[]
byte
RunController
reflect
.
Type
RunMethod
string
}
// NewInput return BeegoInput generated by http.Request.
...
...
router.go
View file @
5588bfc
...
...
@@ -626,7 +626,14 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
context
.
Input
.
Body
()
}
if
context
.
Input
.
RunController
!=
nil
&&
context
.
Input
.
RunMethod
{
findrouter
=
true
runMethod
=
context
.
Input
.
RunMethod
runrouter
=
context
.
Input
.
RunController
}
//first find path from the fixrouters to Improve Performance
if
!
findrouter
{
for
_
,
route
:=
range
p
.
fixrouters
{
n
:=
len
(
requestPath
)
if
requestPath
==
route
.
pattern
{
...
...
@@ -652,6 +659,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
}
}
}
}
//find regex's router
if
!
findrouter
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment