Documentation ¶
Index ¶
- Constants
- Variables
- func AccessAdapter(config string) func(http.Handler) http.Handler
- func DeleteUserCookie(w http.ResponseWriter)
- func FileHandler_(srv *Server, host bool) http.Handlerdeprecated
- func UserCookie() *securecookie.Obj
- func UserCookieValue(r *http.Request) string
- type Request
- type Server
- func (srv *Server) DynamicHandler(host bool) http.HandlerFunc
- func (srv *Server) DynamicHandlerFn(host bool, fs *fn.FNode) http.HandlerFunc
- func (srv *Server) LoginAdapter(host bool, userdb string) func(http.Handler) http.Handler
- func (srv *Server) Serve(secure bool, timeout int, router fr.Router)
- func (srv *Server) StaticFileHandler(host, userspace bool) http.HandlerFunc
- func (srv *Server) StaticFileHandlerFn(host bool, fs *fn.FNode) http.HandlerFunc
Constants ¶
const ( FileDir = "file" TmpDir = ".tmp" )
Variables ¶
var TplExtensions []string = []string{".htm", ".txt", ".csv", ".json", ".g", ".ogdl", ".xml", ".xlsx", ".svg"}
Functions ¶
func DeleteUserCookie ¶
func DeleteUserCookie(w http.ResponseWriter)
func FileHandler_
deprecated
Deprecated: FileHandler returns a handler that processes all paths that exist in the file system starting from the root directory, whether they are static files or templates or markdown.
NOTE This handler needs context information (access to Server{}) NOTE See https://github.com/bpowers/seshcookie TODO serve files with http.ServeContent (handles large files with Range requests)
func UserCookie ¶
func UserCookie() *securecookie.Obj
func UserCookieValue ¶
Types ¶
type Request ¶
type Request struct { HttpRequest *http.Request User string Context *ogdl.Graph Params *ogdl.Graph Path string File *fn.FNode Mime string }
func ConvertRequest ¶
type Server ¶
type Server struct { Host string SecureHost string Hosts []string Config *ogdl.Graph HostContexts map[string]*ogdl.Graph Context *ogdl.Graph Root *fn.FNode DocRoot string UploadDir string Sessions session.Manager Plugins []string Login login ContextService contextService DomainConfig domainConfig Templates map[string]*ogdl.Graph Multi bool }
func New ¶
New prepares a Server{} structure initialized with configuration information and a base context that will be the initial context of each request.
func NewMulti ¶
New prepares a Server{} structure initialized with configuration information and a base context that will be the initial context of each request.
func (*Server) DynamicHandler ¶
func (srv *Server) DynamicHandler(host bool) http.HandlerFunc
DynamicHandler ...
NOTE See https://github.com/bpowers/seshcookie TODO serve files with http.ServeContent (handles large files with Range requests)
func (*Server) DynamicHandlerFn ¶
DynamicHandler ...
NOTE See https://github.com/bpowers/seshcookie TODO serve files with http.ServeContent (handles large files with Range requests)
func (*Server) LoginAdapter ¶
LoginAdapter handles "Login" and "Logout"
Login: sets r.Form["user"] to the authenticated user name. Logout: removes the session Other: do nothing
func (*Server) StaticFileHandler ¶
func (srv *Server) StaticFileHandler(host, userspace bool) http.HandlerFunc
StaticFileHandler returns a handler that processes static files.
if host is true, the hostname is prepended to the path if userspace is true, the first element of a path is taken as a user
func (*Server) StaticFileHandlerFn ¶
StaticFileHandler returns a handler that processes static files.
if host is true, the hostname is prepended to the path