README
HuperWebs
handlers
GZipHandler
The GZipHandler performs a gzip-operation on statis resources, saving them in the cache directory. Future requests will use that same cache file, regardless of the original resource (which may have changed).
ImageResizeHandler
The ImageResizeHandler checks for requests to JPG-images, and resizes those to the requested max-width/height. The image is saved in the cache directory, and the RequestURI is updated to reflect as such.
LanguageHandler
The LanguageHandler saves the locale-id (integer) in the context information for the given Request - for later use in the response process.
SPDYHandler
Experimental. Not yet usable.
WebPHandler
The WebPHandler converts images to webp-images when someone requests a jpeg-image and accepts image/webp. The image is saved in the cache directory. Future requests will use that same cache file, regardless of the original resource (which may have changed).
StaticHandler
An encapsulation of the GZipHandler
, ImageResizeHandler
and WebPHandler
.
DynamicHandler
An encapsulation of the http.DefaultServeMux
, LanguageHandler
and context.ClearHandler
.
Documentation
Index ¶
- func IsImageExtension(ext string) bool
- func NewDynamicHandler(o *DynamicConfig) http.Handler
- func NewExpirationHandler(h httprouter.Handle) httprouter.Handle
- func NewFailsafeHandler(h http.Handler) http.Handler
- func NewGZipDynamicHandler(h http.Handler) http.Handler
- func NewGZipHandler(h httprouter.Handle, o *GZipConfig) httprouter.Handle
- func NewImageResizeHandler(h httprouter.Handle, o *ResizeConfig) httprouter.Handle
- func NewLanguageHandler(h http.Handler, o *LanguageConfig) http.Handler
- func NewMissingExtHandler(h httprouter.Handle) httprouter.Handle
- func NewRetinaHandler(h httprouter.Handle, o *RetinaConfig) httprouter.Handle
- func NewStaticHandler(o *StaticConfig) httprouter.Handle
- func NewWebPHandler(h httprouter.Handle, c *WebPConfig) httprouter.Handle
- type DynamicConfig
- type FailsafeHandler
- type GZipConfig
- type GZipDynamicHandler
- type LanguageConfig
- type LanguageHandler
- type MissingExtHandler
- type ResizeConfig
- type RetinaConfig
- type RetinaHandler
- type StaticConfig
- type WebPConfig
Constants ¶
Variables ¶
Functions ¶
func IsImageExtension ¶
func NewDynamicHandler ¶
func NewDynamicHandler(o *DynamicConfig) http.Handler
func NewExpirationHandler ¶
func NewExpirationHandler(h httprouter.Handle) httprouter.Handle
NewMissingExtHandler creates a new handler that uses the default webp-extension for files without one
func NewGZipHandler ¶
func NewGZipHandler(h httprouter.Handle, o *GZipConfig) httprouter.Handle
func NewImageResizeHandler ¶
func NewImageResizeHandler(h httprouter.Handle, o *ResizeConfig) httprouter.Handle
func NewLanguageHandler ¶
func NewLanguageHandler(h http.Handler, o *LanguageConfig) http.Handler
NewLanguageHandler creates a new handler that handles internationalization with the given configuration
func NewMissingExtHandler ¶
func NewMissingExtHandler(h httprouter.Handle) httprouter.Handle
NewMissingExtHandler creates a new handler that uses the default webp-extension for files without one
func NewRetinaHandler ¶
func NewRetinaHandler(h httprouter.Handle, o *RetinaConfig) httprouter.Handle
NewRetinaHandler creates a new handler that handles internationalization with the given configuration
func NewStaticHandler ¶
func NewStaticHandler(o *StaticConfig) httprouter.Handle
func NewWebPHandler ¶
func NewWebPHandler(h httprouter.Handle, c *WebPConfig) httprouter.Handle
Types ¶
type DynamicConfig ¶
type DynamicConfig struct { Locales *map[string]int Language *map[int]map[string]string URLs *map[int]map[int]string DefaultLocale string ContextNameLocale string ProjectView string Mux http.Handler GetUser func(r *http.Request) authentication.User CookieStore *sessions.CookieStore LoginUrl string ErrorTemplate string ForbiddenURL string Failsafe bool }
type FailsafeHandler ¶
type FailsafeHandler struct {
// contains filtered or unexported fields
}
func (*FailsafeHandler) ServeHTTP ¶
func (f *FailsafeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type GZipConfig ¶
type GZipDynamicHandler ¶
type GZipDynamicHandler struct {
// contains filtered or unexported fields
}
func (*GZipDynamicHandler) ServeHTTP ¶
func (h *GZipDynamicHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type LanguageConfig ¶
type LanguageHandler ¶
type LanguageHandler struct {
// contains filtered or unexported fields
}
func (*LanguageHandler) ServeHTTP ¶
func (h *LanguageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MissingExtHandler ¶
type MissingExtHandler struct {
// contains filtered or unexported fields
}
type ResizeConfig ¶
type RetinaConfig ¶
type RetinaConfig struct {
ContextName string
}
type RetinaHandler ¶
type RetinaHandler struct {
// contains filtered or unexported fields
}