Groups
Groups
Sign in
Groups
Groups
goweb
Conversations
About
Send feedback
Help
Change Formatters to Handlers?
17 views
Skip to first unread message
matryer
unread,
Oct 21, 2011, 10:06:46 AM
10/21/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to goweb
Should we change Formatters so that instead of returning the output,
it writes it? Since it's writing headers too.
We could rename them to Handlers - which might fit in nicer with other
paradigms.
An interface might look like:
type Handler interface {
// handle it
Handle(*Context) os.Error
// Should this handler be used for the specified context?
UseForContext(*Context) bool
}
I wonder also about how we are passing the 'object' to be handled...
perhaps we could set this as a common 'Data' property on the context.
i.e.
context.Data = myObject
handler := GetHandlerForContext(context)
handler.Handle(context)
Mat
Reply all
Reply to author
Forward
0 new messages