Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
二次元的罪恶王冠
beego
提交
ce332713
B
beego
项目概览
二次元的罪恶王冠
/
beego
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
beego
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ce332713
编写于
12月 20, 2013
作者:
傅
傅小黑
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gofmt commented go files
上级
b459cf23
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
50 deletion
+50
-50
app.go
app.go
+1
-1
config.go
config.go
+40
-40
controller.go
controller.go
+9
-9
未找到文件。
app.go
浏览文件 @
ce332713
...
...
@@ -10,7 +10,7 @@ import (
"github.com/astaxie/beego/context"
)
// Fi
tl
erFunc defines filter function type.
// Fi
lt
erFunc defines filter function type.
type
FilterFunc
func
(
*
context
.
Context
)
// App defines beego application with a new PatternServeMux.
...
...
config.go
浏览文件 @
ce332713
...
...
@@ -15,76 +15,76 @@ import (
var
(
// beego application
BeeApp
*
App
BeeApp
*
App
// application configurations
AppName
string
AppPath
string
AppConfigPath
string
StaticDir
map
[
string
]
string
AppName
string
AppPath
string
AppConfigPath
string
StaticDir
map
[
string
]
string
// template caching map
TemplateCache
map
[
string
]
*
template
.
Template
TemplateCache
map
[
string
]
*
template
.
Template
// files with should be compressed with gzip (.js,.css,etc)
StaticExtensionsToGzip
[]
string
// http server configurations
HttpAddr
string
HttpPort
int
HttpTLS
bool
HttpCertFile
string
HttpKeyFile
string
HttpAddr
string
HttpPort
int
HttpTLS
bool
HttpCertFile
string
HttpKeyFile
string
// flag of auto recover panic
RecoverPanic
bool
RecoverPanic
bool
// flag of render template automatically
AutoRender
bool
ViewsPath
string
AutoRender
bool
ViewsPath
string
// run mode, "dev" or "prod"
RunMode
string
AppConfig
config
.
ConfigContainer
RunMode
string
AppConfig
config
.
ConfigContainer
// global session mananger
GlobalSessions
*
session
.
Manager
GlobalSessions
*
session
.
Manager
// flag of starting session auto. default is false.
SessionOn
bool
SessionOn
bool
// default session provider, memory, mysql , redis ,etc.
SessionProvider
string
SessionProvider
string
// the cookie name when saving session id into cookie.
SessionName
string
SessionName
string
// session gc time for auto cleaning expired session.
SessionGCMaxLifetime
int64
SessionGCMaxLifetime
int64
// if use mysql/redis/file provider, define save path to connection info.
SessionSavePath
string
SessionSavePath
string
// session hash generation func.
SessionHashFunc
string
SessionHashFunc
string
// session hash salt string.
SessionHashKey
string
SessionHashKey
string
// the life time of session id in cookie.
SessionCookieLifeTime
int
UseFcgi
bool
MaxMemory
int64
// flag of enable gzip
EnableGzip
bool
EnableGzip
bool
// flag of display directory index. default is false.
DirectoryIndex
bool
DirectoryIndex
bool
// flag of hot update checking in app self. default is false.
EnableHotUpdate
bool
HttpServerTimeOut
int64
EnableHotUpdate
bool
HttpServerTimeOut
int64
// flag of show errors in page. if true, show error and trace info in page rendered with error template.
ErrorsShow
bool
ErrorsShow
bool
// xsrf hash salt string.
XSRFKEY
string
XSRFKEY
string
// flag of enable xsrf.
EnableXSRF
bool
EnableXSRF
bool
// the expiry of xsrf value.
XSRFExpire
int
XSRFExpire
int
// flag of copy raw request body in context.
CopyRequestBody
bool
TemplateLeft
string
TemplateRight
string
CopyRequestBody
bool
TemplateLeft
string
TemplateRight
string
// beego server name exported in response header.
BeegoServerName
string
BeegoServerName
string
// flag of enable admin module to log every request info.
EnableAdmin
bool
EnableAdmin
bool
// http server configurations for admin module.
AdminHttpAddr
string
AdminHttpPort
int
AdminHttpAddr
string
AdminHttpPort
int
)
func
init
()
{
...
...
@@ -127,7 +127,7 @@ func init() {
UseFcgi
=
false
MaxMemory
=
1
<<
26
//64MB
MaxMemory
=
1
<<
26
//64MB
EnableGzip
=
false
...
...
controller.go
浏览文件 @
ce332713
...
...
@@ -144,15 +144,15 @@ func (c *Controller) RenderBytes() ([]byte, error) {
//if the controller has set layout, then first get the tplname's content set the content to the layout
if
c
.
Layout
!=
""
{
if
c
.
TplNames
==
""
{
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
}
if
RunMode
==
"dev"
{
BuildTemplate
(
ViewsPath
)
}
newbytes
:=
bytes
.
NewBufferString
(
""
)
if
_
,
ok
:=
BeeTemplates
[
c
.
TplNames
];
!
ok
{
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
}
err
:=
BeeTemplates
[
c
.
TplNames
]
.
ExecuteTemplate
(
newbytes
,
c
.
TplNames
,
c
.
Data
)
if
err
!=
nil
{
...
...
@@ -171,15 +171,15 @@ func (c *Controller) RenderBytes() ([]byte, error) {
return
icontent
,
nil
}
else
{
if
c
.
TplNames
==
""
{
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
c
.
TplNames
=
strings
.
ToLower
(
c
.
controllerName
)
+
"/"
+
strings
.
ToLower
(
c
.
actionName
)
+
"."
+
c
.
TplExt
}
if
RunMode
==
"dev"
{
BuildTemplate
(
ViewsPath
)
}
ibytes
:=
bytes
.
NewBufferString
(
""
)
if
_
,
ok
:=
BeeTemplates
[
c
.
TplNames
];
!
ok
{
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
}
err
:=
BeeTemplates
[
c
.
TplNames
]
.
ExecuteTemplate
(
ibytes
,
c
.
TplNames
,
c
.
Data
)
if
err
!=
nil
{
...
...
@@ -219,7 +219,7 @@ func (c *Controller) UrlFor(endpoint string, values ...string) string {
return
""
}
if
endpoint
[
0
]
==
'.'
{
return
UrlFor
(
reflect
.
Indirect
(
reflect
.
ValueOf
(
c
.
AppController
))
.
Type
()
.
Name
()
+
endpoint
,
values
...
)
return
UrlFor
(
reflect
.
Indirect
(
reflect
.
ValueOf
(
c
.
AppController
))
.
Type
()
.
Name
()
+
endpoint
,
values
...
)
}
else
{
return
UrlFor
(
endpoint
,
values
...
)
}
...
...
@@ -327,7 +327,7 @@ func (c *Controller) SaveToFile(fromfile, tofile string) error {
return
err
}
defer
file
.
Close
()
f
,
err
:=
os
.
OpenFile
(
tofile
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
0666
)
f
,
err
:=
os
.
OpenFile
(
tofile
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
0666
)
if
err
!=
nil
{
return
err
}
...
...
@@ -464,7 +464,7 @@ func (c *Controller) CheckXsrfCookie() bool {
// XsrfFormHtml writes an input field contains xsrf token value.
func
(
c
*
Controller
)
XsrfFormHtml
()
string
{
return
"<input type=
\"
hidden
\"
name=
\"
_xsrf
\"
value=
\"
"
+
c
.
_xsrf_token
+
"
\"
/>"
c
.
_xsrf_token
+
"
\"
/>"
}
// GetControllerAndAction gets the executing controller name and action name.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录