本文整理汇总了Golang中github.com/revel/revel.InterceptFunc函数的典型用法代码示例。如果您正苦于以下问题:Golang InterceptFunc函数的具体用法?Golang InterceptFunc怎么用?Golang InterceptFunc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InterceptFunc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
// Filters is the default set of global filters.
revel.Filters = []revel.Filter{
revel.PanicFilter, // Recover from panics and display an error page instead.
revel.I18nFilter, // Resolve the requested language
revel.RouterFilter, // Use the routing table to select the right Action
revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
revel.ParamsFilter, // Parse parameters into Controller.Params.
revel.SessionFilter, // Restore and write the session cookie.
csrf.CSRFFilter,
revel.FlashFilter, // Restore and write the flash cookie.
revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
HeaderFilter, // Add xnsome security based headers
revel.InterceptorFilter, // Run interceptors around the action.
revel.CompressFilter, // Compress the result.
revel.ActionInvoker, // Invoke the action.
}
revel.OnAppStart(models.InitDB)
revel.InterceptFunc(setNickname, revel.BEFORE, &pages.ShopPage{})
revel.InterceptFunc(setNickname, revel.BEFORE, &pages.Authentication{})
revel.InterceptFunc(setNickname, revel.BEFORE, &pages.Admin{})
revel.InterceptFunc(redirectAuthenticationPageForAdmin, revel.BEFORE, &pages.Admin{})
// register startup functions with OnAppStart
// ( order dependent )
// revel.OnAppStart(InitDB)
// revel.OnAppStart(FillCache)
}
开发者ID:randyumi,项目名称:kuchikommi,代码行数:28,代码来源:init.go
示例2: init
func init() {
// Filters is the default set of global filters.
revel.Filters = []revel.Filter{
revel.PanicFilter, // Recover from panics and display an error page instead.
revel.RouterFilter, // Use the routing table to select the right Action
revel.FilterConfiguringFilter, // A hook for adding or removing per-Action filters.
revel.ParamsFilter, // Parse parameters into Controller.Params.
revel.SessionFilter, // Restore and write the session cookie.
revel.FlashFilter, // Restore and write the flash cookie.
revel.ValidationFilter, // Restore kept validation errors and save new ones from cookie.
revel.I18nFilter, // Resolve the requested language
HeaderFilter, // Add some security based headers
revel.InterceptorFilter, // Run interceptors around the action.
revel.CompressFilter, // Compress the result.
revel.ActionInvoker, // Invoke the action.
}
// register startup functions with OnAppStart
// ( order dependent )
// revel.OnAppStart(InitDB)
// revel.OnAppStart(FillCache)
// 注册模板里的字符串相加函数
revel.TemplateFuncs["sp2bk"] = func(a string) string {
return strings.Replace(a, " ", " ", -1)
}
// 对访问者身份进行验证
revel.InterceptFunc(checkRole, revel.BEFORE, &controllers.Admin{})
revel.InterceptFunc(checkRole, revel.BEFORE, &controllers.Picture{})
}
开发者ID:xausee,项目名称:symbol,代码行数:30,代码来源:init.go
示例3: init
func init() {
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &MemberIndex{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &MemberUser{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &MemberBlog{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &MemberGroup{})
revel.OnAppStart(func() {
})
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:8,代码来源:init.go
示例4: init
func init() {
revel.OnAppStart(InitDB)
revel.InterceptFunc(checkUser, revel.BEFORE, &Post{})
revel.InterceptFunc(checkUser, revel.BEFORE, &Profile{})
revel.InterceptFunc(checkUser, revel.BEFORE, &Asset{})
revel.InterceptFunc(adminOnly, revel.BEFORE, &Contributor{})
revel.InterceptFunc(adminOnly, revel.BEFORE, &SiteInfo{})
//revel.InterceptFunc(adminOnly, revel.BEFORE, &Category{})
revel.InterceptMethod((*GormController).Begin, revel.BEFORE)
revel.InterceptMethod((*GormController).Commit, revel.AFTER)
revel.InterceptMethod((*GormController).RollBack, revel.FINALLY)
revel.TemplateFuncs["config"] = func(key string) string {
return revel.Config.StringDefault(key, "")
}
}
开发者ID:bertzzie,项目名称:obrolansubuh-backend,代码行数:17,代码来源:init.go
示例5: init
func init() {
// interceptor
// revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Index{}) // Index.Note自己校验
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Notebook{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Note{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Share{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &User{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &File{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Blog{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &NoteContentHistory{})
// service
userService = &service.UserService{}
noteService = &service.NoteService{}
trashService = &service.TrashService{}
notebookService = &service.NotebookService{}
noteContentHistoryService = &service.NoteContentHistoryService{}
authService = &service.AuthService{}
shareService = &service.ShareService{}
blogService = &service.BlogService{}
tagService = &service.TagService{}
pwdService = &service.PwdService{}
tokenService = &service.TokenService{}
suggestionService = &service.SuggestionService{}
revel.OnAppStart(func() {
leanoteUserId, _ = revel.Config.String("adminUsername")
siteUrl, _ = revel.Config.String("site.url")
openRegister, _ = revel.Config.Bool("register.open")
})
}
开发者ID:hello-kukoo,项目名称:leanote,代码行数:32,代码来源:init.go
示例6: init
func init() {
revel.InterceptFunc(CheckUserAuth, revel.BEFORE, revel.ALL_CONTROLLERS)
revel.OnAppStart(func() {
ServersMap, ServersLastError = models.LoadServers()
if ServersLastError != nil {
revel.ERROR.Print(ServersLastError)
}
})
}
开发者ID:digideskio,项目名称:watchdog_ui,代码行数:10,代码来源:app.go
示例7: init
func init() {
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Admin{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &AdminSetting{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &AdminUser{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &AdminBlog{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &AdminEmail{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &AdminUpgrade{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &AdminData{})
}
开发者ID:ClaudeXin,项目名称:leanote,代码行数:9,代码来源:init.go
示例8: init
func init() {
// interceptor
// revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Index{}) // Index.Note自己校验
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Notebook{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Note{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Share{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &User{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Album{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &File{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Attach{})
// revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &Blog{})
revel.InterceptFunc(AuthInterceptor, revel.BEFORE, &NoteContentHistory{})
revel.OnAppStart(func() {
// 博客初始化模板
blog.Init()
})
}
开发者ID:ClaudeXin,项目名称:leanote,代码行数:18,代码来源:init.go
示例9: init
func init() {
revel.OnAppStart(Bootstrap)
//检测是否登陆
revel.InterceptFunc(CheckLogin, revel.BEFORE, revel.ALL_CONTROLLERS)
}
开发者ID:JREAMLU,项目名称:GoCMS,代码行数:6,代码来源:init.go
示例10: init
func init() {
revel.InterceptFunc(CheckLogin, revel.BEFORE, &Cmds{})
}
开发者ID:11101171,项目名称:whale,代码行数:3,代码来源:cmds.go
示例11: InitControllers
func InitControllers() {
revel.InterceptMethod(CheckCourseraMode, revel.BEFORE)
revel.InterceptMethod(PublicApplication.AddUser, revel.BEFORE)
revel.InterceptMethod(CheckWorker, revel.BEFORE)
revel.InterceptFunc(CheckUser, revel.BEFORE, &SecuredApplication{})
if CourseraMode {
revel.InterceptFunc(CheckUser, revel.BEFORE, &CourseraApplication{})
}
revel.TemplateFuncs["rfc3339"] = func(t time.Time) string {
return t.Format(time.RFC3339)
}
revel.TemplateFuncs["lower"] = func(s string) string {
return strings.ToLower(s)
}
revel.TemplateFuncs["plus"] = func(x int, y int) int {
return x + y
}
revel.TemplateFuncs["shorten"] = func(s string) string {
if len(s) > 60 {
bs := []byte(s)
return string(bs[:60]) + "..."
} else {
return s
}
}
revel.TemplateFuncs["percentageToInt"] = func(f float32) int {
return int(f * 100)
}
revel.TemplateFuncs["splitComma"] = func(str string) []string {
return strings.Split(str, ",")
}
revel.TemplateFuncs["positiveQ"] = func(i int) bool {
return i > 0
}
revel.TemplateFuncs["notEmpty"] = func(xs interface{}) bool {
vxs := reflect.ValueOf(xs)
return vxs.Len() > 0
}
revel.TemplateFuncs["loggerClass"] = func(s string) (class string) {
switch s {
case "Fatal":
case "Error":
class = "danger"
case "Warn":
class = "warning"
case "Info":
case "Debug":
class = "active"
default:
class = ""
}
return
}
revel.TemplateFuncs["milliSeconds"] = func(t int64) float64 {
return float64(t) / 1000000.0
}
MPFileDirectory = filepath.Join(revel.BasePath, "mp")
createBigCodeDatabaseMutex = &sync.Mutex{}
if CourseraMode {
InitCourseraController()
}
if IsMaster {
InitAdminController()
}
}
开发者ID:thnguyn2,项目名称:WebGPU,代码行数:68,代码来源:controllers.go
示例12: init
func init() {
revel.InterceptFunc(checkDataTypeParam, revel.BEFORE, &Synchronization{})
}
开发者ID:rtm7777,项目名称:rozklad_cdtu,代码行数:3,代码来源:synchronization.go
示例13: init
func init() {
revel.InterceptFunc(defaultRenderArgs, revel.BEFORE, &App{})
}
开发者ID:jastkand,项目名称:rssify,代码行数:3,代码来源:app.go
示例14: init
func init() {
revel.InterceptFunc(setuser, revel.BEFORE, &App{})
}
开发者ID:bancek,项目名称:youtube-to-koofr,代码行数:3,代码来源:app.go
示例15: init
func init() {
revel.InterceptFunc(CheckLoginAdmin, revel.BEFORE, &Users{})
}
开发者ID:11101171,项目名称:whale,代码行数:3,代码来源:users.go
注:本文中的github.com/revel/revel.InterceptFunc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论