Documentation ¶
Index ¶
- func AssetHandler(w http.ResponseWriter, r *http.Request)
- func ErrorPageHandler(errnum int, errmsg string, pv *appsmodel.PageVariable, w http.ResponseWriter, ...)
- func FaviconHandler(w http.ResponseWriter, r *http.Request)
- func GetWebservice() *appsmodel.Webservice
- func New(w *appsmodel.Webservice)
- func SimplePageHandler(pv *appsmodel.PageVariable, w http.ResponseWriter, r *http.Request)
- func TemplateHandler(w http.ResponseWriter, r *http.Request)
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.