Versions in this module Expand all Collapse all v1 v1.0.0 Mar 23, 2015 Changes in this version + var AccessLogFilename = "/tmp/access.log" + var AfterErrorFunc func(Context, *AppError) + var ContentDir string + var ErrorLogFilename = "/tmp/error.log" + var NotifyRequestTime func(elapsed time.Duration, path string) + var SessionCookieLifetimeSeconds = 3600 * 24 * 14 + var TokenSecret = []byte("CHANGEME") + func HandleContext(pattern string, handler ContextHandlerFunc, builder ContextBuilder) + func HandleContextGzip(pattern string, handler ContextHandlerFunc, builder ContextBuilder) + func HandleFiles(path string) + func HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request, *Session)) + func HandleReflect(pattern string, handler interface{}, builder ContextBuilder) + func IsHttps(r *http.Request) bool + func ListenAndServe(addr string) + func LogAccess(req *http.Request, elapsed time.Duration) + func LogError(req *http.Request, err *AppError) + func LogReload() + func Register(name string) error + func RegisterAlt(name string) error + func RegisterLayout(name, header, footer string) error + func RegisterLayoutAlt(name, header, footer string) error + func RegisterMulti(name string, filenames ...string) error + func RegisterNotFound(name string) error + func RegisterServerError(name string) error + func RegisterString(name, content string) error + func RemoveCookie(w http.ResponseWriter, name string) + func SetCookie(w http.ResponseWriter, name, value string) + func SetCookieWithExpiration(w http.ResponseWriter, name, value string, seconds int) + func WantsJSON(r *http.Request) bool + func WriteSessionCookie(w http.ResponseWriter, s *Session) + type AppError struct + Code int + Err error + Message string + func NewServerError(msg string) *AppError + func NotFoundErr() *AppError + func Redirect(c Context, path string) *AppError + func RedirectToHttps(c Context) *AppError + func Render(layout, template string, data interface{}, c Context) *AppError + func RenderAtom(template string, data interface{}, context Context) *AppError + func RenderCSV(c Context, records [][]string, filename string) *AppError + func RenderJS(c Context, js string) *AppError + func RenderJSON(c Context, obj interface{}) *AppError + func RenderJSONP(c Context, obj interface{}, jsonpCallback string) *AppError + func RenderMulti(layout, name, innerName string, data interface{}, c Context) *AppError + func RenderNoLayout(template string, data interface{}, c Context) *AppError + func RenderNoLayoutNoContext(template string, data interface{}, w http.ResponseWriter, s *Session) *AppError + func RenderNoLayoutToHTML(template string, data interface{}) (htemplate.HTML, *AppError) + func RenderNoLayoutToString(template string, data interface{}) (string, *AppError) + func RenderString(c Context, content string) *AppError + func RenderToString(layout, template string, data interface{}) (string, *AppError) + func ServerError(err error, msg string) *AppError + func StoreAndRedirect(c Context, path string) *AppError + type Context interface + After func() + Before func() (bool, error) + Request func() *http.Request + ResultData func(title string) TemplateData + Session func() *Session + Writer func() http.ResponseWriter + type ContextBuilder func(*http.Request, http.ResponseWriter, *Session) Context + type ContextHandlerFunc func(Context) *AppError + type Env int + const EnvDevel + const EnvProduction + const EnvTesting + var Environment Env + type GPath []string + func Path(r *http.Request, prefixLen int) GPath + func (p GPath) Basename() string + func (p GPath) Extension() string + type Session struct + func (s *Session) AddErrMsg(msg string) + func (s *Session) AddFlash(msg string) + func (s *Session) AddRecent(key, val string) + func (s *Session) Get(key string) (val string, ok bool) + func (s *Session) GetAndResetErrMsgs() []string + func (s *Session) GetAndResetFlash() []string + func (s *Session) GetList(key string) []string + func (s *Session) HasErrMsgs() bool + func (s *Session) HasFlash() bool + func (s *Session) Push(key, val string) + func (s *Session) Remove(key string) + func (s *Session) Set(key, val string) + func (s Session) Token() string + func (s Session) ValidToken(t string) bool + type TemplateData map[string]interface + type TemplatePool interface + Register func(name string, leftDelim, rightDelim string) error + RegisterLayout func(name, header, footer string, leftDelim, rightDelim string) error + RegisterMulti func(name, leftDelim, rightDelim string, filenames ...string) error + RegisterString func(name, content string) error + Render func(layout, name string, data interface{}, wr io.Writer) error + RenderMulti func(layout, name, innerName string, data interface{}, wr io.Writer) error + RenderNoLayout func(name string, data interface{}, wr io.Writer) error + var DefaultPool TemplatePool