Documentation ¶
Overview ¶
package www implements HTTP handlers for the whosonfirst-browser web application.
Index ¶
- func AppendAssetHandlers(mux *http.ServeMux, opts *BrowserOptions) error
- func AppendResourcesHandler(next http.Handler, opts *BrowserOptions) http.Handler
- func CreateFeatureHandler(opts *CreateFeatureHandlerOptions) (http.Handler, error)
- func CustomValidationWasmHandler(opts *CustomValidationWasmHandlerOptions) (http.Handler, error)
- func DataHandler(root string) (http.Handler, error)
- func DefaultRasterSizes() map[string]RasterSize
- func DefaultSVGSizes() map[string]SVGSize
- func EditGeometryHandler(opts *EditGeometryHandlerOptions) (http.Handler, error)
- func GeoJSONHandler(opts *GeoJSONHandlerOptions) (http.Handler, error)
- func GeoJSONLDHandler(opts *GeoJSONLDHandlerOptions) (http.Handler, error)
- func IDHandler(opts IDHandlerOptions) (http.Handler, error)
- func IndexHandler(opts IndexHandlerOptions) (http.Handler, error)
- func NavPlaceHandler(opts *NavPlaceHandlerOptions) (http.Handler, error)
- func NewNullHandler() http.Handler
- func RasterHandler(opts *RasterHandlerOptions) (http.Handler, error)
- func RenderTemplate(rsp gohttp.ResponseWriter, t *template.Template, vars interface{})
- func SPRHandler(opts *SPRHandlerOptions) (http.Handler, error)
- func SVGHandler(opts *SVGHandlerOptions) (http.Handler, error)
- func SearchHandler(opts SearchHandlerOptions) (http.Handler, error)
- func SelectHandler(opts *SelectHandlerOptions) (http.Handler, error)
- func URIsHandler(opts *URIsHandlerOptions) (http.Handler, error)
- func WebfingerHandler(opts *WebfingerHandlerOptions) (http.Handler, error)
- type Assets
- type BrowserOptions
- func (opts *BrowserOptions) Clone() *BrowserOptions
- func (opts *BrowserOptions) WithCreateHandlerAssets() *BrowserOptions
- func (opts *BrowserOptions) WithCreateHandlerResources() *BrowserOptions
- func (opts *BrowserOptions) WithGeometryHandlerAssets() *BrowserOptions
- func (opts *BrowserOptions) WithGeometryHandlerResources() *BrowserOptions
- func (opts *BrowserOptions) WithIdHandlerAssets() *BrowserOptions
- func (opts *BrowserOptions) WithIdHandlerResources() *BrowserOptions
- type CreateFeatureHandlerOptions
- type CreateFeatureVars
- type CustomValidationWasmHandlerOptions
- type EditGeometryHandlerOptions
- type EditGeometryVars
- type ErrorVars
- type GeoJSONHandlerOptions
- type GeoJSONLDHandlerOptions
- type IDHandlerOptions
- type IDVars
- type IndexHandlerOptions
- type IndexVars
- type NavPlaceHandlerOptions
- type NotFoundVars
- type RasterHandlerOptions
- type RasterSize
- type SPRHandlerOptions
- type SVGHandlerOptions
- type SVGSize
- type SearchHandlerOptions
- type SearchVars
- type SelectHandlerOptions
- type URIsHandlerOptions
- type URIsHandlerVars
- type WebfingerHandlerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendAssetHandlers ¶
func AppendAssetHandlers(mux *http.ServeMux, opts *BrowserOptions) error
Append all the files in the net/http FS instance containing the embedded Browser assets to an *http.ServeMux instance.
func AppendResourcesHandler ¶
func AppendResourcesHandler(next http.Handler, opts *BrowserOptions) http.Handler
AppendResourcesHandlerWithPrefix will rewrite any HTML produced by previous handler to include the necessary markup to load Browser JavaScript files and related assets ensuring that all URIs are prepended with a prefix.
func CreateFeatureHandler ¶
func CreateFeatureHandler(opts *CreateFeatureHandlerOptions) (http.Handler, error)
func CustomValidationWasmHandler ¶
func CustomValidationWasmHandler(opts *CustomValidationWasmHandlerOptions) (http.Handler, error)
func DefaultRasterSizes ¶
func DefaultRasterSizes() map[string]RasterSize
func DefaultSVGSizes ¶
func EditGeometryHandler ¶
func EditGeometryHandler(opts *EditGeometryHandlerOptions) (http.Handler, error)
func GeoJSONHandler ¶
func GeoJSONHandler(opts *GeoJSONHandlerOptions) (http.Handler, error)
func GeoJSONLDHandler ¶
func GeoJSONLDHandler(opts *GeoJSONLDHandlerOptions) (http.Handler, error)
func IndexHandler ¶
func IndexHandler(opts IndexHandlerOptions) (http.Handler, error)
func NavPlaceHandler ¶
func NavPlaceHandler(opts *NavPlaceHandlerOptions) (http.Handler, error)
NavPlaceHandler will return a given record as a FeatureCollection for use by the IIIF navPlace extension, specifically as navPlace "reference" objects.
func NewNullHandler ¶
func RasterHandler ¶
func RasterHandler(opts *RasterHandlerOptions) (http.Handler, error)
func RenderTemplate ¶
func RenderTemplate(rsp gohttp.ResponseWriter, t *template.Template, vars interface{})
func SPRHandler ¶
func SPRHandler(opts *SPRHandlerOptions) (http.Handler, error)
func SVGHandler ¶
func SVGHandler(opts *SVGHandlerOptions) (http.Handler, error)
func SearchHandler ¶
func SearchHandler(opts SearchHandlerOptions) (http.Handler, error)
func SelectHandler ¶
func SelectHandler(opts *SelectHandlerOptions) (http.Handler, error)
func URIsHandler ¶
func URIsHandler(opts *URIsHandlerOptions) (http.Handler, error)
func WebfingerHandler ¶
func WebfingerHandler(opts *WebfingerHandlerOptions) (http.Handler, error)
Types ¶
type BrowserOptions ¶
type BrowserOptions struct { JS []string CSS []string DataAttributes map[string]string // AppendJavaScriptAtEOF is a boolean flag to append JavaScript markup at the end of an HTML document // rather than in the <head> HTML element. Default is false AppendJavaScriptAtEOF bool RollupAssets bool JSRollupURI []string CSSRollupURI []string Prefix string Logger *log.Logger // contains filtered or unexported fields }
BrowserOptions provides a list of JavaScript and CSS link to include with HTML output.
func DefaultBrowserOptions ¶
func DefaultBrowserOptions() *BrowserOptions
Return a *BrowserOptions struct with default paths and URIs.
func (*BrowserOptions) Clone ¶
func (opts *BrowserOptions) Clone() *BrowserOptions
func (*BrowserOptions) WithCreateHandlerAssets ¶
func (opts *BrowserOptions) WithCreateHandlerAssets() *BrowserOptions
func (*BrowserOptions) WithCreateHandlerResources ¶
func (opts *BrowserOptions) WithCreateHandlerResources() *BrowserOptions
func (*BrowserOptions) WithGeometryHandlerAssets ¶
func (opts *BrowserOptions) WithGeometryHandlerAssets() *BrowserOptions
func (*BrowserOptions) WithGeometryHandlerResources ¶
func (opts *BrowserOptions) WithGeometryHandlerResources() *BrowserOptions
func (*BrowserOptions) WithIdHandlerAssets ¶
func (opts *BrowserOptions) WithIdHandlerAssets() *BrowserOptions
func (*BrowserOptions) WithIdHandlerResources ¶
func (opts *BrowserOptions) WithIdHandlerResources() *BrowserOptions
type CreateFeatureHandlerOptions ¶
type CreateFeatureHandlerOptions struct { Reader reader.Reader Authenticator auth.Authenticator Logger *log.Logger Template *template.Template MapProvider string URIs *uris.URIs Capabilities *capabilities.Capabilities CustomProperties []browser_properties.CustomProperty }
type CreateFeatureVars ¶
type CreateFeatureVars struct { MapProvider string Paths *uris.URIs Capabilities *capabilities.Capabilities CustomProperties []browser_properties.CustomProperty URIPrefix string Account *auth.Account }
type CustomValidationWasmHandlerOptions ¶
type CustomValidationWasmHandlerOptions struct {
CustomValidationWasm *browser_custom.CustomValidationWasm
}
type EditGeometryHandlerOptions ¶
type EditGeometryHandlerOptions struct { Reader reader.Reader Authenticator auth.Authenticator Logger *log.Logger Template *template.Template MapProvider string URIs *uris.URIs Capabilities *capabilities.Capabilities }
type EditGeometryVars ¶
type EditGeometryVars struct { MapProvider string Id int64 Paths *uris.URIs Capabilities *capabilities.Capabilities // To do: Support alternate geometries URIPrefix string Account *auth.Account }
type GeoJSONHandlerOptions ¶
type GeoJSONLDHandlerOptions ¶
type IDHandlerOptions ¶
type IDHandlerOptions struct { Authenticator auth.Authenticator Templates *template.Template Reader reader.Reader Logger *log.Logger MapProvider string URIs *uris.URIs Capabilities *capabilities.Capabilities }
type IDVars ¶
type IDVars struct { SPR spr.StandardPlacesResult URI string URIArgs *uri.URIArgs IsAlternate bool LastModified string Paths *uris.URIs Capabilities *capabilities.Capabilities MapProvider string URIPrefix string Account *auth.Account }
type IndexHandlerOptions ¶
type IndexHandlerOptions struct { Templates *template.Template URIs *uris.URIs Capabilities *capabilities.Capabilities }
type IndexVars ¶
type IndexVars struct { Paths *uris.URIs Capabilities *capabilities.Capabilities }
type NavPlaceHandlerOptions ¶
type NavPlaceHandlerOptions struct {}
type NotFoundVars ¶
type RasterHandlerOptions ¶
type RasterHandlerOptions struct { Format string Sizes map[string]RasterSize Reader reader.Reader Logger *log.Logger }
type RasterSize ¶
type SPRHandlerOptions ¶
type SVGHandlerOptions ¶
type SearchHandlerOptions ¶
type SearchHandlerOptions struct { Templates *template.Template Database fulltext.FullTextDatabase MapProvider string URIs *uris.URIs Capabilities *capabilities.Capabilities }
type SearchVars ¶
type SearchVars struct { Paths *uris.URIs Capabilities *capabilities.Capabilities Query string Results []spr.StandardPlacesResult }
type SelectHandlerOptions ¶
type URIsHandlerOptions ¶
type URIsHandlerVars ¶
type URIsHandlerVars struct {
URIs string
}
type WebfingerHandlerOptions ¶
type WebfingerHandlerOptions struct { Reader reader.Reader Logger *log.Logger Hostname string URIs *uris.URIs Capabilities *capabilities.Capabilities }