Documentation ¶
Overview ¶
Package http provides a HTTP Handler for an Image Server.
Index ¶
- func NewParamsHashETagFunc(newHashFunc func() hash.Hash) func(params imageserver.Params) string
- func ParseQueryBool(param string, req *http.Request, params imageserver.Params) error
- func ParseQueryFloat(param string, req *http.Request, params imageserver.Params) error
- func ParseQueryInt(param string, req *http.Request, params imageserver.Params) error
- func ParseQueryString(param string, req *http.Request, params imageserver.Params)
- type CacheControlPublicHandler
- type Error
- type ExpiresHandler
- type Handler
- type ListParser
- type Parser
- type SourceParser
- type SourcePathParser
- type SourcePrefixParser
- type SourceTransformParser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewParamsHashETagFunc ¶
func NewParamsHashETagFunc(newHashFunc func() hash.Hash) func(params imageserver.Params) string
NewParamsHashETagFunc returns a function that hashes the params and returns an ETag value.
func ParseQueryBool ¶
ParseQueryBool takes the param from the query string, parse it as an bool and add it to params.
func ParseQueryFloat ¶
ParseQueryFloat takes the param from the query string, parse it as a float64 and add it to params.
func ParseQueryInt ¶
ParseQueryInt takes the param from the query string, parse it as an int and add it to params.
func ParseQueryString ¶
func ParseQueryString(param string, req *http.Request, params imageserver.Params)
ParseQueryString takes the param from the query string and add it to params.
Types ¶
type CacheControlPublicHandler ¶
CacheControlPublicHandler is a net/http.Handler implementation that sets the "Cache-Control" header to "public". It only sets the header if the status code is StatusOK/204 or StatusNotModified/304.
func (*CacheControlPublicHandler) ServeHTTP ¶
func (h *CacheControlPublicHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP implements http.Handler.
type Error ¶
Error is a HTTP error.
func NewErrorDefaultText ¶
NewErrorDefaultText creates an Error with the message associated with the code.
type ExpiresHandler ¶
ExpiresHandler is a HTTP Handler that sets "Expires" header. It only sets the header if the status code is StatusOK/204 or StatusNotModified/304.
func (*ExpiresHandler) ServeHTTP ¶
func (eh *ExpiresHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP implements http.Handler.
type Handler ¶
type Handler struct { Parser Parser // parse request to Params Server imageserver.Server // handle image requests ETagFunc func(params imageserver.Params) string // optional ErrorFunc func(err error, req *http.Request) // allows to handle internal errors, optional }
Handler is a HTTP Handler for imageserver.Server.
Only GET and HEAD methods are supported.
Supports ETag/If-None-Match (status code 304). It doesn't check if the image really exists.
type ListParser ¶
type ListParser []Parser
ListParser is a list of HTTP Parser.
func (ListParser) Parse ¶
func (lp ListParser) Parse(req *http.Request, params imageserver.Params) error
Parse implements Parser.
func (ListParser) Resolve ¶
func (lp ListParser) Resolve(param string) string
Resolve implements Parser.
type Parser ¶
type Parser interface { // Parse parses a Request and fill Params. Parse(*http.Request, imageserver.Params) error // Resolve resolves a param to a HTTP param. // It returns the resolved HTTP param, or an empty string. Resolve(param string) (httpParam string) }
Parser represents a HTTP Request parser.
type SourceParser ¶
type SourceParser struct{}
SourceParser is a HTTP Parser that takes the "source" param from the query.
func (*SourceParser) Parse ¶
func (parser *SourceParser) Parse(req *http.Request, params imageserver.Params) error
Parse implements Parser.
func (*SourceParser) Resolve ¶
func (parser *SourceParser) Resolve(param string) string
Resolve implements Parser.
type SourcePathParser ¶
type SourcePathParser struct{}
SourcePathParser is a HTTP Parser that takes the "source" param from the path.
func (*SourcePathParser) Parse ¶
func (parser *SourcePathParser) Parse(req *http.Request, params imageserver.Params) error
Parse implements Parser.
func (*SourcePathParser) Resolve ¶
func (parser *SourcePathParser) Resolve(param string) string
Resolve implements Parser.
type SourcePrefixParser ¶
SourcePrefixParser is a HTTP Parser that adds a prefix to the "source" param.
func (*SourcePrefixParser) Parse ¶
func (ps *SourcePrefixParser) Parse(req *http.Request, params imageserver.Params) error
Parse implements Parser.
type SourceTransformParser ¶
SourceTransformParser is a HTTP Parser that transforms the "source" param.
func (*SourceTransformParser) Parse ¶
func (ps *SourceTransformParser) Parse(req *http.Request, params imageserver.Params) error
Parse implements Parser.
Directories ¶
Path | Synopsis |
---|---|
Package gamma provides a imageserver/http.Parser implementation for imageserver/image/gamma.CorrectionProcessor.
|
Package gamma provides a imageserver/http.Parser implementation for imageserver/image/gamma.CorrectionProcessor. |
Package gift provides a GIFT HTTP Parser
|
Package gift provides a GIFT HTTP Parser |
Package graphicsmagick provides a GraphicsMagick HTTP Parser.
|
Package graphicsmagick provides a GraphicsMagick HTTP Parser. |
Package image provides imageserver/http.Parser implementations for imageserver/image.
|
Package image provides imageserver/http.Parser implementations for imageserver/image. |
Package nfntresize provides a nfnt resize HTTP Parser.
|
Package nfntresize provides a nfnt resize HTTP Parser. |