Documentation ¶
Index ¶
- Constants
- Variables
- func Instance() *flamel
- func ParseAccept(accept []string) []contentSpecification
- func ParseJSONInputs(ctx context.Context) (map[string]interface{}, error)
- type Application
- type Authenticator
- type BlobRenderer
- type Config
- type ContentOfferer
- type Controller
- type DefaultRouter
- func (router *DefaultRouter) RouteForPath(ctx context.Context, path string) (context.Context, error, Controller)
- func (router *DefaultRouter) SetRoute(url string, handler func(ctx context.Context) Controller, ...)
- func (router *DefaultRouter) SetRoutes(urls []string, handler func(ctx context.Context) Controller, ...)
- type DownloadRenderer
- type ErrorRenderer
- type HttpResponse
- type JSONRenderer
- type MissingInputError
- type Renderer
- type RequestInputs
- func (ins RequestInputs) GetFloat(key string) (float64, error)
- func (ins RequestInputs) GetFloatWithFormat(key string, size int) (float64, error)
- func (ins RequestInputs) GetInt(key string) (int64, error)
- func (ins RequestInputs) GetIntWithFormat(key string, base int, size int) (int64, error)
- func (ins RequestInputs) GetString(key string) (string, error)
- func (ins RequestInputs) GetUint(key string) (uint64, error)
- func (ins RequestInputs) GetUintWithFormat(key string, base int, size int) (uint64, error)
- func (ins RequestInputs) Has(key string) bool
- func (ins RequestInputs) MustFloat(key string) float64
- func (ins RequestInputs) MustInt(key string) int64
- func (ins RequestInputs) MustString(key string) string
- func (ins RequestInputs) MustUint(key string) uint64
- type ResponseOutput
- type Router
- type Service
- type TemplateRenderer
- type TextRenderer
Constants ¶
View Source
const ( //request related special vars KeyRequestInputs = "__flamel_request_inputs__" KeyRequestMethod = "__flamel__method__" KeyRequestIPV4 = "__flamel_remote_address__" KeyRequestJSON = "__flamel_json__" KeyRequestURL = "__flamel_URL__" KeyRequestScheme = "__flamel_scheme__" KeyRequestQuery = "__flamel_query__" KeyRequestHost = "__flamel_host__" KeyNegotiatedContent = "__flamel_negotiated_content__" )
Variables ¶
View Source
var ErrNoInputs = errors.New("request has no inputs")
Functions ¶
func ParseAccept ¶ added in v0.6.0
func ParseAccept(accept []string) []contentSpecification
parses the "Accept" header value. e.g: "text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8"
Types ¶
type Application ¶
type Authenticator ¶
type BlobRenderer ¶
Renders a file as returned from the BlobStore
func (*BlobRenderer) Render ¶
func (renderer *BlobRenderer) Render(w http.ResponseWriter) error
type Config ¶
type Config struct { //true if the server suport Cross Origin Request CORS *cors.Cors EnforceHostnameRedirect string MaxFileUploadSize int64 ContentOfferer ContentOfferer Router }
func DefaultConfig ¶
func DefaultConfig() Config
type ContentOfferer ¶ added in v0.6.0
type Controller ¶
type Controller interface { //the page logic is executed here //Process method consumes the context -> context variations, i.e. appengine.Namespace //can be used INSIDE the Process function Process(ctx context.Context, out *ResponseOutput) HttpResponse //called to release resources OnDestroy(ctx context.Context) }
type DefaultRouter ¶
func NewDefaultRouter ¶
func NewDefaultRouter() *DefaultRouter
func (*DefaultRouter) RouteForPath ¶
func (router *DefaultRouter) RouteForPath(ctx context.Context, path string) (context.Context, error, Controller)
func (*DefaultRouter) SetRoute ¶
func (router *DefaultRouter) SetRoute(url string, handler func(ctx context.Context) Controller, authenticator Authenticator)
func (*DefaultRouter) SetRoutes ¶
func (router *DefaultRouter) SetRoutes(urls []string, handler func(ctx context.Context) Controller, authenticator Authenticator)
type DownloadRenderer ¶ added in v0.6.0
func (*DownloadRenderer) Render ¶ added in v0.6.0
func (renderer *DownloadRenderer) Render(w http.ResponseWriter) error
type ErrorRenderer ¶
type ErrorRenderer struct {
Data error
}
func (*ErrorRenderer) Render ¶
func (renderer *ErrorRenderer) Render(w http.ResponseWriter) error
type HttpResponse ¶
type JSONRenderer ¶
type JSONRenderer struct {
Data interface{}
}
Returns the data as JSON object(s)
func (*JSONRenderer) Render ¶
func (renderer *JSONRenderer) Render(w http.ResponseWriter) error
type MissingInputError ¶ added in v0.6.1
type MissingInputError struct {
// contains filtered or unexported fields
}
func (MissingInputError) Error ¶ added in v0.6.1
func (e MissingInputError) Error() string
type Renderer ¶
type Renderer interface {
Render(w http.ResponseWriter) error
}
type RequestInputs ¶
type RequestInputs map[string]requestInput
inputs related definitions and methods
func InputsFromContext ¶
func InputsFromContext(ctx context.Context) RequestInputs
func RoutingParams ¶
func RoutingParams(ctx context.Context) RequestInputs
func (RequestInputs) GetFloat ¶ added in v0.6.1
func (ins RequestInputs) GetFloat(key string) (float64, error)
func (RequestInputs) GetFloatWithFormat ¶ added in v0.6.1
func (ins RequestInputs) GetFloatWithFormat(key string, size int) (float64, error)
float related methods
func (RequestInputs) GetInt ¶ added in v0.6.1
func (ins RequestInputs) GetInt(key string) (int64, error)
func (RequestInputs) GetIntWithFormat ¶ added in v0.6.1
func (RequestInputs) GetString ¶ added in v0.6.1
func (ins RequestInputs) GetString(key string) (string, error)
func (RequestInputs) GetUint ¶ added in v0.6.1
func (ins RequestInputs) GetUint(key string) (uint64, error)
func (RequestInputs) GetUintWithFormat ¶ added in v0.6.1
Uint related methods
func (RequestInputs) Has ¶ added in v0.6.1
func (ins RequestInputs) Has(key string) bool
func (RequestInputs) MustFloat ¶ added in v0.6.1
func (ins RequestInputs) MustFloat(key string) float64
func (RequestInputs) MustInt ¶ added in v0.6.1
func (ins RequestInputs) MustInt(key string) int64
func (RequestInputs) MustString ¶ added in v0.6.1
func (ins RequestInputs) MustString(key string) string
func (RequestInputs) MustUint ¶ added in v0.6.1
func (ins RequestInputs) MustUint(key string) uint64
type ResponseOutput ¶
type ResponseOutput struct { Renderer Renderer // contains filtered or unexported fields }
func (*ResponseOutput) AddCookie ¶
func (out *ResponseOutput) AddCookie(cookie http.Cookie)
func (*ResponseOutput) AddHeader ¶
func (out *ResponseOutput) AddHeader(key string, value string)
func (*ResponseOutput) RemoveCookie ¶
func (out *ResponseOutput) RemoveCookie(name string)
func (*ResponseOutput) SetCookie ¶ added in v0.6.1
func (out *ResponseOutput) SetCookie(cookie http.Cookie)
type Router ¶
type Router interface { SetRoute(url string, handler func(ctx context.Context) Controller, authenticator Authenticator) // Utility method. Calls @SetRoute on each element of @urls SetRoutes(urls []string, handler func(ctx context.Context) Controller, authenticator Authenticator) RouteForPath(ctx context.Context, path string) (context.Context, error, Controller) }
type Service ¶
type Service interface { Name() string // used to set the service up Initialize() // called everytime a request is being processed OnStart(ctx context.Context) context.Context // called once the request has been processed OnEnd(ctx context.Context) // called once the main function returns. The service should implement its destruction code here. Destroy() }
type TemplateRenderer ¶
Renders a GO HTML template
func (*TemplateRenderer) Render ¶
func (renderer *TemplateRenderer) Render(w http.ResponseWriter) error
type TextRenderer ¶
type TextRenderer struct {
Data string
}
Renders plain text
func (*TextRenderer) Render ¶
func (renderer *TextRenderer) Render(w http.ResponseWriter) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.