github.com/zhongdalu/gf@v1.0.0/g/net/ghttp/ghttp_server_config_cookie.go (about) 1 // Copyright 2017 gf Author(https://github.com/zhongdalu/gf). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/zhongdalu/gf. 6 7 package ghttp 8 9 import ( 10 "github.com/zhongdalu/gf/g/os/glog" 11 ) 12 13 // 设置http server参数 - CookieMaxAge 14 func (s *Server) SetCookieMaxAge(age int) { 15 if s.Status() == SERVER_STATUS_RUNNING { 16 glog.Error(gCHANGE_CONFIG_WHILE_RUNNING_ERROR) 17 return 18 } 19 s.config.CookieMaxAge = age 20 } 21 22 // 设置http server参数 - CookiePath 23 func (s *Server) SetCookiePath(path string) { 24 if s.Status() == SERVER_STATUS_RUNNING { 25 glog.Error(gCHANGE_CONFIG_WHILE_RUNNING_ERROR) 26 return 27 } 28 s.config.CookiePath = path 29 } 30 31 // 设置http server参数 - CookieDomain 32 func (s *Server) SetCookieDomain(domain string) { 33 if s.Status() == SERVER_STATUS_RUNNING { 34 glog.Error(gCHANGE_CONFIG_WHILE_RUNNING_ERROR) 35 return 36 } 37 s.config.CookieDomain = domain 38 } 39 40 // 获取http server参数 - CookieMaxAge 41 func (s *Server) GetCookieMaxAge() int { 42 return s.config.CookieMaxAge 43 } 44 45 // 获取http server参数 - CookiePath 46 func (s *Server) GetCookiePath() string { 47 return s.config.CookiePath 48 } 49 50 // 获取http server参数 - CookieDomain 51 func (s *Server) GetCookieDomain() string { 52 return s.config.CookieDomain 53 }