Version: v0.0.0-...-a7a9960 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2015 License: LGPL-3.0, GPL-2.0 Imports: 11 Imported by: 0



Trama is a simple web server for Golang forked from Handy ( Like Handy, it has the concept of interceptors that can be freely plugged in the pipeline of a request handling, allowing making libraries of small reusable pieces of funcionality. Also like Handy, it uses the handler to carry state across the entire request, what enables injecting arbitrary type-safe contextual information to the pipeline.




This section is empty.


View Source
var (
	ErrRouteAlreadyExists = errors.New("Route already exists")
	ErrRouteNotFound      = errors.New("Route not found")
	ErrWildcardConflict   = errors.New("Wildcard node cannot have siblings")


func New

func New(log func(error)) *trama


type AJAXInterceptor

type AJAXInterceptor interface {
	Before(w http.ResponseWriter, r *http.Request)
	After(w http.ResponseWriter, r *http.Request)

type AJAXInterceptorChain

type AJAXInterceptorChain []AJAXInterceptor

func NewAJAXInterceptorChain

func NewAJAXInterceptorChain(is ...AJAXInterceptor) AJAXInterceptorChain

func (AJAXInterceptorChain) Chain

type BufferedResponseWriter

type BufferedResponseWriter struct {
	Body *bytes.Buffer
	// contains filtered or unexported fields

func NewBufferedResponseWriter

func NewBufferedResponseWriter(w http.ResponseWriter) *BufferedResponseWriter

func (*BufferedResponseWriter) Flush

func (rw *BufferedResponseWriter) Flush()

func (*BufferedResponseWriter) Header

func (rw *BufferedResponseWriter) Header() http.Header

Header returns the response headers.

func (*BufferedResponseWriter) Status

func (rw *BufferedResponseWriter) Status() int

func (*BufferedResponseWriter) Write

func (rw *BufferedResponseWriter) Write(buf []byte) (int, error)

Write always succeeds and writes to rw.Body, if not nil.

func (*BufferedResponseWriter) WriteHeader

func (rw *BufferedResponseWriter) WriteHeader(code int)

type DefaultAJAXHandler

type DefaultAJAXHandler struct {

func (*DefaultAJAXHandler) Delete

func (*DefaultAJAXHandler) Get

func (*DefaultAJAXHandler) Head

func (*DefaultAJAXHandler) Patch

func (*DefaultAJAXHandler) Post

func (*DefaultAJAXHandler) Put

type DefaultWebHandler

type DefaultWebHandler struct {

func (*DefaultWebHandler) Get

func (*DefaultWebHandler) Post

func (*DefaultWebHandler) Templates

func (d *DefaultWebHandler) Templates() TemplateGroupSet

type NopAJAXInterceptor

type NopAJAXInterceptor struct{}

func (*NopAJAXInterceptor) After

func (*NopAJAXInterceptor) Before

type NopAJAXInterceptorChain

type NopAJAXInterceptorChain struct{}

func (*NopAJAXInterceptorChain) Interceptors

type NopWebInterceptor

type NopWebInterceptor struct{}

func (*NopWebInterceptor) After

func (n *NopWebInterceptor) After(Response, *http.Request)

func (*NopWebInterceptor) Before

func (n *NopWebInterceptor) Before(Response, *http.Request)

type NopWebInterceptorChain

type NopWebInterceptorChain struct{}

func (*NopWebInterceptorChain) Interceptors

func (n *NopWebInterceptorChain) Interceptors() WebInterceptorChain

type Response

type Response interface {
	SetTemplateGroup(name string)
	SetCookie(cookie *http.Cookie)
	Redirect(url string, statusCode int)
	ExecuteTemplate(name string, data interface{})
	TemplateName() string

type TemplateGroup

type TemplateGroup struct {
	Name  string
	Files []string
	// contains filtered or unexported fields

type TemplateGroupSet

type TemplateGroupSet struct {
	FuncMap template.FuncMap
	// contains filtered or unexported fields

func NewTemplateGroupSet

func NewTemplateGroupSet(f template.FuncMap) TemplateGroupSet

func (*TemplateGroupSet) Insert

func (t *TemplateGroupSet) Insert(g TemplateGroup) error

type WebHandler

type WebHandler interface {
	Get(Response, *http.Request)
	Post(Response, *http.Request)
	Interceptors() WebInterceptorChain
	Templates() TemplateGroupSet

type WebInterceptor

type WebInterceptor interface {
	Before(Response, *http.Request)
	After(Response, *http.Request)

type WebInterceptorChain

type WebInterceptorChain []WebInterceptor

func NewWebInterceptorChain

func NewWebInterceptorChain(is ...WebInterceptor) WebInterceptorChain

func (WebInterceptorChain) Chain

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL