Пример #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
	}
}
Пример #2
0
func GetStack(c *karambie.ResponseWriterContext) (interface{}, []byte) {
	return c.Get(errInstance), c.Get(stackInstance).([]byte)
}