Beispiel #1
0
func (this *MartiniHelper) context(rwc *karambie.ResponseWriterContext, r *http.Request) martini.Context {
	if v, ok := rwc.GetOk(contextInstance); ok {
		return v.(martini.Context)
	} else {
		c := &context{inject.New()}
		c.SetParent(this)

		c.Map(rwc)
		c.MapTo(c, (*martini.Context)(nil))
		c.MapTo(martini.NewResponseWriter(rwc), (*http.ResponseWriter)(nil))
		c.Map(r)

		rwc.Set(contextInstance, c)
		return c
	}
}
Beispiel #2
0
func newWrappedResponseWriter(w http.ResponseWriter) *wrappedResponseWriter {
	wr := &wrappedResponseWriter{ResponseWriter: martini.NewResponseWriter(w)}
	return wr
}