MCPcopy
hub / github.com/OpenNHP/opennhp / NewHttpServerHelper

Method NewHttpServerHelper

endpoints/server/httpserver.go:441–468  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

439}
440
441func (hs *HttpServer) NewHttpServerHelper() *plugins.HttpServerPluginHelper {
442 h := &plugins.HttpServerPluginHelper{}
443 h.StopSignal = hs.signals.stop
444
445 h.AuthWithHttpCallbackFunc = func(req *common.HttpKnockRequest, res *common.ResourceData) (*common.ServerKnockAckMsg, error) {
446 return hs.handleHttpOpenResource(req, res)
447 }
448
449 // Session helper functions for plugins
450 h.SessionGet = func(ctx *gin.Context, key string) interface{} {
451 session := sessions.Default(ctx)
452 return session.Get(key)
453 }
454 h.SessionSet = func(ctx *gin.Context, key string, val interface{}) {
455 session := sessions.Default(ctx)
456 session.Set(key, val)
457 }
458 h.SessionSave = func(ctx *gin.Context) error {
459 session := sessions.Default(ctx)
460 return session.Save()
461 }
462 h.SessionClear = func(ctx *gin.Context) {
463 session := sessions.Default(ctx)
464 session.Clear()
465 }
466
467 return h
468}
469
470// FindPluginHandler returns the plugin handler for the given ASP ID
471// It delegates the task to the underlying UDP server's FindPluginHandler method.

Callers 1

doAuthWithPluginMethod · 0.95

Calls 5

SetMethod · 0.80
SaveMethod · 0.80
ClearMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected