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.

Expand ▾ Collapse ▴

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsImageExtension

func IsImageExtension(ext string) bool

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 NewFailsafeHandler

    func NewFailsafeHandler(h http.Handler) http.Handler

    func NewGZipDynamicHandler

    func NewGZipDynamicHandler(h http.Handler) http.Handler

    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 GZipConfig struct {
          	ContextNameCache string
          	VerboseOutput    bool
          	ProjectRoot      string
          	PublicRoot       string
          	Cache            *helpers.CacheStorage
          }

          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 LanguageConfig struct {
          	Locales       *map[string]int
          	DefaultLocale string
          	ContextName   string
          }

          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 ResizeConfig struct {
          	ContextNameCache string
          	ContextNameRatio string
          	ParameterHeight  string
          	ParameterWidth   string
          	VerboseOutput    bool
          	ProjectRoot      string
          	ProjectCache     string
          	Cache            *helpers.CacheStorage
          }

          type RetinaConfig

          type RetinaConfig struct {
          	ContextName string
          }

          type RetinaHandler

          type RetinaHandler struct {
          	// contains filtered or unexported fields
          }

          type StaticConfig

          type StaticConfig struct {
          	ContextNameCache string
          	ContextNameRatio string
          	ParameterHeight  string
          	ParameterWidth   string
          	VerboseOutput    bool
          	PublicRoot       string
          	ProjectRoot      string
          	ProjectCache     string
          	Cache            *helpers.CacheStorage
          }

          type WebPConfig

          type WebPConfig struct {
          	ContextNameCache string
          	ParameterWidth   string
          	ParameterHeight  string
          	VerboseOutput    bool
          	ProjectRoot      string
          	ProjectCache     string
          
          	Cache *helpers.CacheStorage
          }