Files
Ocean/System/InitHandlers.go
T

73 lines
2.8 KiB
Go
Raw Normal View History

2014-04-26 11:18:56 +02:00
package System
2014-10-19 19:19:11 +02:00
import (
2015-01-30 17:45:30 +01:00
"github.com/SommerEngineering/Ocean/BinaryAssets"
2014-10-19 19:19:11 +02:00
"github.com/SommerEngineering/Ocean/ConfigurationDB"
2014-11-06 17:49:04 +01:00
"github.com/SommerEngineering/Ocean/Handlers"
2014-10-19 19:19:11 +02:00
"github.com/SommerEngineering/Ocean/ICCC"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
2015-02-03 21:40:29 +01:00
"github.com/SommerEngineering/Ocean/Log/Web"
2014-10-19 19:19:11 +02:00
"github.com/SommerEngineering/Ocean/Robots"
"github.com/SommerEngineering/Ocean/StaticFiles"
"github.com/SommerEngineering/Ocean/WebContent"
)
2014-04-26 11:18:56 +02:00
2015-06-17 17:44:52 +02:00
// Init the system and then the system's handlers.
2014-04-26 11:18:56 +02:00
func InitHandlers() {
initSystem()
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Register now all system handlers.`)
2015-06-17 17:44:52 +02:00
//
2014-11-17 13:04:34 +01:00
// Public Handlers:
2015-06-17 17:44:52 +02:00
//
// Handler for the web frameworks like e.g. jQuery, Bootstrap, etc.
2014-11-06 17:49:04 +01:00
Handlers.AddPublicHandler(`/framework/`, WebContent.HandlerDeliverFramework)
2015-06-17 17:44:52 +02:00
// Handler for other static files:
2014-11-06 17:49:04 +01:00
Handlers.AddPublicHandler(`/staticFiles/`, StaticFiles.HandlerStaticFiles)
2015-06-17 17:44:52 +02:00
// Handler for the robots.txt:
2014-11-06 17:49:04 +01:00
Handlers.AddPublicHandler(`/robots.txt`, Robots.HandlerRobots)
2015-06-17 17:44:52 +02:00
// Handler for the ICCC to the public:
2014-11-06 17:49:04 +01:00
Handlers.AddPublicHandler(`/ICCC`, ICCC.ICCCHandler)
2014-04-26 11:18:56 +02:00
2015-06-17 17:44:52 +02:00
//
2014-11-17 13:04:34 +01:00
// Private Handlers:
2015-06-17 17:44:52 +02:00
//
// Handler for the web frameworks like e.g. jQuery, Bootstrap, etc.
2014-11-17 13:04:34 +01:00
Handlers.AddAdminHandler(`/framework/`, WebContent.HandlerDeliverFramework)
2015-06-17 17:44:52 +02:00
// Handler for other static files:
2014-11-17 13:04:34 +01:00
Handlers.AddAdminHandler(`/staticFiles/`, StaticFiles.HandlerStaticFiles)
2015-06-17 17:44:52 +02:00
// Handler for the ICCC to the private side:
2014-11-17 13:04:34 +01:00
Handlers.AddAdminHandler(`/ICCC`, ICCC.ICCCHandler)
2015-06-17 17:44:52 +02:00
// Handler for binary assets, used for the admin pages:
2015-01-30 17:45:30 +01:00
Handlers.AddAdminHandler(`/binaryAssets/`, BinaryAssets.HandlerBinaryAssets)
2015-06-17 17:44:52 +02:00
// Handler for the web logging:
2015-02-04 07:58:23 +01:00
Handlers.AddAdminHandler(`/log`, Web.HandlerWebLog)
2015-06-17 17:44:52 +02:00
// Handler for the web logging's CSS and JS:
2015-02-03 21:40:29 +01:00
Handlers.AddAdminHandler(`/log/css/normalize.css`, Web.HandlerCSSNormalize)
Handlers.AddAdminHandler(`/log/css/webflow.css`, Web.HandlerCSSWebflow)
Handlers.AddAdminHandler(`/log/css/log.css`, Web.HandlerCSSLog)
Handlers.AddAdminHandler(`/log/js/modernizr.js`, Web.HandlerJSModernizr)
Handlers.AddAdminHandler(`/log/js/jquery.min.js`, Web.HandlerJSjQuery)
Handlers.AddAdminHandler(`/log/js/jquery.min.map`, Web.HandlerJSjQueryMap)
Handlers.AddAdminHandler(`/log/js/webflow.js`, Web.HandlerJSWebflow)
2014-11-17 13:04:34 +01:00
2015-06-17 17:44:52 +02:00
// Are the static files mapped to the public?
2014-04-26 11:18:56 +02:00
if ConfigurationDB.Read(`MapStaticFiles2Root`) == "true" {
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `The static files are mapped to the root.`)
2014-11-06 17:49:04 +01:00
Handlers.AddPublicHandler(`/`, StaticFiles.HandlerMapStaticFiles2Root)
2014-04-26 11:18:56 +02:00
}
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameSTARTUP, `Done with registering all system handler.`)
}