Documentation ¶
Overview ¶
This module contains the webserver whcih deals with processing requests from the user, presenting him with the interface of the application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InternalErrorOnErrorHandler ¶
func InternalErrorOnErrorHandler(writer http.ResponseWriter, req *http.Request, fnc func(http.ResponseWriter, *http.Request) error)
Used to wrap around handlers-like functions which just return error. This function actually writes the HTTP error and renders the error in the html
Types ¶
type AlbumHandler ¶
type AlbumHandler struct {
// contains filtered or unexported fields
}
Will find and serve a zip of the album by the album ID
func NewAlbumHandler ¶
func NewAlbumHandler(lib library.Library) *AlbumHandler
Returns a new Album handler. It needs a library to search in
func (AlbumHandler) ServeHTTP ¶
func (fh AlbumHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request)
This method is required by the http.Handler's interface
type BasicAuthHandler ¶
type BasicAuthHandler struct {
// contains filtered or unexported fields
}
Handler wrapper used for basic authenticate. Its only job is to do the authentication and then pass the work to the Handler it wraps around
func (BasicAuthHandler) ServeHTTP ¶
func (hl BasicAuthHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request)
Implements the http.Handler interface and does the actual basic authenticate check for every request
type FileHandler ¶
type FileHandler struct {
// contains filtered or unexported fields
}
Will find and serve a file by its ID
func NewFileHandler ¶
func NewFileHandler(lib library.Library) *FileHandler
Returns a new File handler will will be resposible for serving a file from the library identified from its ID.
func (FileHandler) ServeHTTP ¶
func (fh FileHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request)
This method is required by the http.Handler's interface
type GzipHandler ¶
type GzipHandler struct {
// contains filtered or unexported fields
}
Gzips our output using a custom Writer. It will check if gzip is among the accepted encodings and gzip if so. Otherwise it will do nothing.
func (GzipHandler) ServeHTTP ¶
func (gzh GzipHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request)
type SearchHandler ¶
type SearchHandler struct {
// contains filtered or unexported fields
}
Handler responsible for search requests. It will use the Library to return a list of matched files to the interface.
func NewSearchHandler ¶
func NewSearchHandler(lib library.Library) *SearchHandler
Returns a new SearchHandler for processing search queries. They will be run agains the supplied library
func (SearchHandler) ServeHTTP ¶
func (sh SearchHandler) ServeHTTP(writer http.ResponseWriter, req *http.Request)
This method is required by the http.Handler's interface
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Represends our webserver. It will be controlled from here
func NewServer ¶
Returns a new Server using the supplied configuration cfg. The returned server is ready and calling its Serve method will start it.