2014-04-26 09:18:56 +00:00
package WebContent
2014-10-19 17:19:11 +00:00
import (
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"github.com/SommerEngineering/Ocean/Shutdown"
"net/http"
"strings"
)
2014-04-26 09:18:56 +00:00
2015-06-17 15:44:52 +00:00
// The handler to deliver web framework files e.g. jQuery, Bootstrap, etc.
2014-04-26 09:18:56 +00:00
func HandlerDeliverFramework ( response http . ResponseWriter , request * http . Request ) {
2015-06-17 15:44:52 +00:00
// If the system is going down, send an error:
2014-04-26 09:18:56 +00:00
if Shutdown . IsDown ( ) {
http . NotFound ( response , request )
return
}
2015-06-17 15:44:52 +00:00
// Replace the prefix:
2014-04-26 09:18:56 +00:00
path := strings . Replace ( request . URL . Path , "/framework/" , "" , 1 )
sendError := SendContent ( response , path )
if sendError != nil {
Log . LogFull ( senderName , LM . CategorySYSTEM , LM . LevelERROR , LM . SeverityCritical , LM . ImpactCritical , LM . MessageNameWRITE , ` Was not able to send the desired web content file. ` , request . URL . Path , sendError . Error ( ) )
http . NotFound ( response , request )
}
}