defaulthandlers

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: GPL-3.0 Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetHandler

func AssetHandler(w http.ResponseWriter, r *http.Request)

AssetHandler handles asset requests.

It takes in an http.ResponseWriter and an http.Request as parameters.

func ErrorPageHandler

func ErrorPageHandler(errnum int, errmsg string, pv *appsmodel.PageVariable, w http.ResponseWriter, r *http.Request)

func FaviconHandler

func FaviconHandler(w http.ResponseWriter, r *http.Request)

FaviconHandler serves the favicon for the current website.

It takes in an http.ResponseWriter and an http.Request as parameters. The function retrieves the current website's Webservice, constructs the path to the favicon, and serves the favicon file using http.ServeFile.

func GetWebservice

func GetWebservice() *appsmodel.Webservice

GetWebservice returns the current instance of the Webservice struct.

No parameters. Returns a pointer to the Webservice struct.

func New

func New(w *appsmodel.Webservice)

New initializes a new instance of the Webservice struct and assigns it to the global variable currws.

Parameters: - w: a pointer to a Webservice struct.

func SimplePageHandler

func SimplePageHandler(pv *appsmodel.PageVariable, w http.ResponseWriter, r *http.Request)

func TemplateHandler

func TemplateHandler(w http.ResponseWriter, r *http.Request)

TemplateHandler handles template requests.

It takes in an http.ResponseWriter and an http.Request as parameters. It retrieves the webservice and sets up allowed assets. It retrieves the device from the request context and extracts the filename and extension. It checks if the asset can be accessed based on its extension. If it cannot be accessed, it writes an error message to the http.ResponseWriter. It checks if there is an asset created for mobile or tablet. If there is, it modifies the filename and checks if the asset exists. If the asset exists, it checks if the asset exists. If it does not exist, it writes an error message to the http.ResponseWriter. It loads the asset and serves it to the client. If there is an error loading the asset, it writes an error message to the http.ResponseWriter.

Types

This section is empty.

Jump to

Keyboard shortcuts

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