示例#1
0
func ManageSession(w http.ResponseWriter, r *http.Request) *session.JustilySession {
	if isSessionCookieAvailable(r) {
		c, _ := r.Cookie(sessionCookieName)
		if isValidSessionCookie(c) {
			return session.GetSession(c.Value)
		}
	}
	js := session.NewSession()
	cookie := &http.Cookie{Name: "sid", Value: js.Id.String()}
	http.SetCookie(w, cookie)
	return js
}
示例#2
0
文件: home.go 项目: kranthic/justily
func home(w http.ResponseWriter, r *http.Request) {
	s := session.NewSession()
	fmt.Println("blah", s)
	fmt.Fprintf(w, "Hello Kranthi!!!")
}