handlers

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2017 License: BSD-3-Clause Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// BasePath defines the path path for all requests.
	BasePath = "/"

	// TagPathPrefix defines the prefix for tag-routes.
	TagPathPrefix = "/tags.html#"

	// TagmapHandlerRoute defines the route for tagmap-handler requests.
	TagmapHandlerRoute = "/tags.html"

	// ThemeRoutePrefix defines the route-prefix for theme files.
	ThemeRoutePrefix = "/theme"

	// ThemeHandlerRoute defines the route for thumbnails.
	ThemeHandlerRoute = fmt.Sprintf("%s/{path:.*$}", ThemeRoutePrefix)

	// ThumbnailRoutePrefix defines the route-prefix for thumbnails.
	ThumbnailRoutePrefix = "/thumbnails"

	// ThumbnailHandlerRoute defines the route for thumbnails.
	ThumbnailHandlerRoute = fmt.Sprintf("%s/{path:.*$}", ThumbnailRoutePrefix)

	// PrintHandlerRoute defines the route for print-handler requests.
	PrintHandlerRoute = `/{path:.+\.print$|print$}`

	// JSONHandlerRoute defines the route for JSON-handler requests.
	JSONHandlerRoute = `/{path:.+\.json$|json$}`

	// MarkdownHandlerRoute defines the route for Markdown-handler requests.
	MarkdownHandlerRoute = `/{path:.+\.markdown$|markdown$}`

	// LatestHandlerRoute defines the route for latest-handler requests.
	LatestHandlerRoute = `/{path:.+\.latest$|latest$}`

	// DOCXHandlerRoute defines the route for rich-text-handler requests.
	DOCXHandlerRoute = `/{path:.+\.docx$|docx$}`

	// UpdateHandlerRoute defines the route for update-handler requests.
	UpdateHandlerRoute = `/{path:.+\.ws$|ws$}`

	// ItemHandlerRoute defines the route for item-handler requests.
	ItemHandlerRoute = "/{path:.*$}"

	// SitemapHandlerRoute defines the route for sitemap-handler requests.
	SitemapHandlerRoute = "/sitemap.html"

	// XMLSitemapHandlerRoute defines the route for xml-sitemap-handler requests.
	XMLSitemapHandlerRoute = "/sitemap.xml"

	// RSSHandlerRoute defines the route for RSS-feed-handler requests.
	RSSHandlerRoute = "/feed.rss"

	// RobotsTxtHandlerRoute defines the route for robotstxt-handler requests.
	RobotsTxtHandlerRoute = "/robots.txt"

	// SearchHandlerRoute defines the route for search-handler requests.
	SearchHandlerRoute = "/search"

	// OpenSearchDescriptionHandlerRoute defines the route for opensearch-descriptiption-handler requests.
	OpenSearchDescriptionHandlerRoute = "/opensearch.xml"

	// TypeAheadSearchHandlerRoute defines the route for typeahead-search-handler requests.
	TypeAheadSearchHandlerRoute = "/search.json"

	// TypeAheadTitlesHandlerRoute defines the route for typeahead-titles-handler requests.
	TypeAheadTitlesHandlerRoute = "/titles.json"

	// RedirectHandlerRoute defines the route for redirect-handler requests.
	RedirectHandlerRoute = "/{path:.*$}"

	// AliasLookupHandlerRoute defines the route for alias-lookup-handler requests.
	AliasLookupHandlerRoute = "/!{alias:.+$}"

	// AliasIndexHandlerRoute defines the route for alias-lookup-handler requests.
	AliasIndexHandlerRoute = "/!"
)

Functions

func AddETAgToStaticFileHandler

func AddETAgToStaticFileHandler(staticFileHandler http.Handler, headerWriter header.HeaderWriter, baseFolder, requestPrefixToStripFromRequestURI string) http.Handler

AddETAgToStaticFileHandler wraps the given staticFileHandler and adds an ETag header.

func AliasIndex

func AliasIndex(
	headerWriter header.HeaderWriter,
	navigationOrchestrator *orchestrator.NavigationOrchestrator,
	aliasIndexOrchestrator *orchestrator.AliasIndexOrchestrator,
	templateProvider templates.Provider) http.Handler

AliasIndex creates a http handler which displays an index of all aliases.

func AliasLookup

func AliasLookup(
	headerWriter header.HeaderWriter,
	viewModelOrchestrator *orchestrator.ViewModelOrchestrator,
	fallbackHandler http.Handler) http.Handler

AliasLookup creates a http handler which redirects aliases to their documents.

func CompressResponses

func CompressResponses(baseHandler http.Handler) http.Handler

func DOCX

func DOCX(logger logger.Logger,
	conversionToolPath string,
	conversionEndpointHostname string,
	headerWriter header.HeaderWriter,
	converterModelOrchestrator *orchestrator.ConversionModelOrchestrator,
	templateProvider templates.Provider,
	error404Handler http.Handler) http.Handler

func Error

func Error(headerWriter header.HeaderWriter, templateProvider templates.Provider, navigationOrchestrator *orchestrator.NavigationOrchestrator) http.Handler

func InMemoryTheme

func InMemoryTheme(themeFolderPath string, headerWriter header.HeaderWriter, error404Handler http.Handler) http.Handler

InMemoryTheme creates a theme-handler that serves the theme-files from memory.

func Item

func Item(logger logger.Logger,
	headerWriter header.HeaderWriter,
	fileOrchestrator *orchestrator.FileOrchestrator,
	viewModelOrchestrator *orchestrator.ViewModelOrchestrator,
	templateProvider templates.Provider,
	error404Handler http.Handler) http.Handler

func JSON

func JSON(headerWriter header.HeaderWriter, viewModelOrchestrator *orchestrator.ViewModelOrchestrator, fallbackHandler http.Handler) http.Handler

func Latest

func Latest(logger logger.Logger, headerWriter header.HeaderWriter, viewModelOrchestrator *orchestrator.ViewModelOrchestrator, fallbackHandler http.Handler) http.Handler

func LogRequests

func LogRequests(baseHandler http.Handler) http.Handler

func Markdown

func Markdown(headerWriter header.HeaderWriter, viewModelOrchestrator *orchestrator.ViewModelOrchestrator, fallbackHandler http.Handler) http.Handler

Markdown returns a http handler which returns the markdown content of the requested item.

func OpenSearchDescription

func OpenSearchDescription(headerWriter header.HeaderWriter,
	openSearchDescriptionOrchestrator *orchestrator.OpenSearchDescriptionOrchestrator,
	templateProvider templates.Provider) http.Handler

OpenSearchDescription returns a opensearch description http handler.

func Print

func Print(logger logger.Logger,
	headerWriter header.HeaderWriter,
	conversionModelOrchestrator *orchestrator.ConversionModelOrchestrator,
	templateProvider templates.Provider,
	error404Handler http.Handler) http.Handler

func RSS

func RSS(headerWriter header.HeaderWriter,
	feedOrchestrator *orchestrator.FeedOrchestrator,
	templateProvider templates.Provider,
	error404Handler http.Handler) http.Handler

RSS cretes a new RSS-Feed handler.

func Redirect

func Redirect(logger logger.Logger, baseURITarget string) http.Handler

func RequireDigestAuthentication

func RequireDigestAuthentication(logger logger.Logger, baseHandler http.Handler, secretProvider auth.SecretProvider) http.Handler

RequireDigestAuthentication forces digest access authentication for the given handler.

func RobotsTxt

func RobotsTxt(headerWriter header.HeaderWriter, templateProvider templates.Provider) http.Handler

RobotsTxt creates a http handler for serving the robots.txt.

func Search(headerWriter header.HeaderWriter,
	navigationOrchestrator *orchestrator.NavigationOrchestrator,
	searchOrchestrator *orchestrator.SearchOrchestrator,
	templateProvider templates.Provider,
	error404Handler http.Handler) http.Handler

func Sitemap

func Sitemap(headerWriter header.HeaderWriter,
	navigationOrchestrator *orchestrator.NavigationOrchestrator,
	sitemapOrchestrator *orchestrator.SitemapOrchestrator,
	templateProvider templates.Provider) http.Handler

func Static

func Static(directory, prefix string) http.Handler

Static creates a static http handler for the given directory.

func Tags

func Tags(headerWriter header.HeaderWriter,
	navigationOrchestrator *orchestrator.NavigationOrchestrator,
	tagsOrchestrator *orchestrator.TagsOrchestrator,
	templateProvider templates.Provider) http.Handler

func Titles

func Titles(headerWriter header.HeaderWriter, titlesOrchestrator *orchestrator.TitlesOrchestrator) http.Handler

func TypeAhead

func TypeAhead(headerWriter header.HeaderWriter, typeAheadOrchestrator *orchestrator.TypeAheadOrchestrator) http.Handler

func Update

func Update(logger logger.Logger,
	headerWriter header.HeaderWriter,
	templateProvider templates.Provider,
	updateOrchestrator *orchestrator.UpdateOrchestrator) websocket.Handler

func XMLSitemap

func XMLSitemap(headerWriter header.HeaderWriter,
	xmlSitemapOrchestrator *orchestrator.XmlSitemapOrchestrator,
	templateProvider templates.Provider) http.Handler

Types

type HandlerList

type HandlerList []RouteAndHandler

HandlerList is a list of routes and http-handlers.

func GetBaseHandlers

func GetBaseHandlers(logger logger.Logger, config config.Config, templateProvider templates.Provider, orchestratorFactory orchestrator.Factory, headerWriterFactory header.WriterFactory) HandlerList

GetBaseHandlers returns a full-list of all http-handlers in this package.

func GetRedirectHandlers

func GetRedirectHandlers(logger logger.Logger, baseURITarget string, baseHandler http.Handler) HandlerList

GetRedirectHandlers returns a list of redirect handlers.

func (*HandlerList) Add

func (list *HandlerList) Add(route string, handler http.Handler)

Add the specified route and http handler to the current list.

type RouteAndHandler

type RouteAndHandler struct {
	Route   string
	Handler http.Handler
}

RouteAndHandler combines routes and http-handlers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL