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
8d797a4a
authored
2014-11-03 16:14:40 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
file the static filter
1 parent
10db97b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
router.go
router.go
View file @
8d797a4
...
...
@@ -72,11 +72,31 @@ var (
"SetSecureCookie"
,
"XsrfToken"
,
"CheckXsrfCookie"
,
"XsrfFormHtml"
,
"GetControllerAndAction"
}
url_placeholder
=
"{{placeholder}}"
FilterRouterLog
func
(
*
beecontext
.
Context
)
bool
url_placeholder
=
"{{placeholder}}"
DefaultLogFilter
FilterHandler
=
&
logFilter
{}
)
type
FilterHandler
interface
{
Filter
(
*
beecontext
.
Context
)
bool
}
// default log filter static file will not show
type
logFilter
struct
{
}
func
(
l
*
logFilter
)
Filter
(
ctx
*
beecontext
.
Context
)
bool
{
requestPath
:=
path
.
Clean
(
ctx
.
Input
.
Request
.
URL
.
Path
)
if
requestPath
==
"/favicon.ico"
||
requestPath
==
"/robots.txt"
{
return
true
}
for
prefix
,
_
:=
range
StaticDir
{
if
strings
.
HasPrefix
(
requestPath
,
prefix
)
{
return
true
}
}
return
false
}
// To append a slice's value into "exceptMethod", for controller's methods shouldn't reflect to AutoRouter
func
ExceptMethodAppend
(
action
string
)
{
exceptMethod
=
append
(
exceptMethod
,
action
)
...
...
@@ -815,7 +835,7 @@ Admin:
}
else
{
devinfo
=
fmt
.
Sprintf
(
"| % -10s | % -40s | % -16s | % -10s |"
,
r
.
Method
,
r
.
URL
.
Path
,
timeend
.
String
(),
"notmatch"
)
}
if
FilterRouterLog
==
nil
||
!
FilterRouterLog
(
context
)
{
if
DefaultLogFilter
==
nil
||
!
DefaultLogFilter
.
Filter
(
context
)
{
Debug
(
devinfo
)
}
}
...
...
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