Beispiel #1
0
 public RequestHandler(StartTypes startType, ILogWriter logWriter)
 {
     Logger.Setup(logWriter);
     Logger.Debug("Starting up VueJS Request Handler");
     _startType    = startType;
     _typeChecks   = new Dictionary <Type, ASecurityCheck[]>();
     _methodChecks = new Dictionary <Type, Dictionary <MethodInfo, ASecurityCheck[]> >();
     AssemblyAdded();
 }
 /*
  * This function will start the request handler, it does this by first validating 
  * all located models, and will react according to the starttype specified.
  * It will also assign jquery,json and backbone urls as specified.
  * It will then create the url check regex, locat all load,loadalls, and select list methods
  * as well as specify types to urls, once complete it flags running to allow for handling requests.
  */
 public static void Start(StartTypes startType,string jqueryURL,string jsonURL,string backboneURL,ILogWriter logWriter)
 {
     Logger.Setup(logWriter);
     Logger.Debug("Starting up BackBone request handler");
     _startType = startType;
     _loadedTypes = new List<Type>();
     _LoadAlls = new Dictionary<string, MethodInfo>();
     _Loads = new Dictionary<string, MethodInfo>();
     _ExposedMethods = new Dictionary<string, List<MethodInfo>>();
     _SelectLists = new Dictionary<string, List<sModelListCall>>();
     _CachedJScript = new Dictionary<string, CachedItemContainer>();
     _TypeMaps = new Dictionary<string, Type>();
     _cacheTimer = new Timer(new TimerCallback(_CleanJSCache), null, 0, _CACHE_TIMER_PERIOD);
     _ModelListCalls = new List<sModelListCall>();
     _DeleteMethods = new Dictionary<Type, MethodInfo>();
     _SaveMethods = new Dictionary<Type, MethodInfo>();
     _UpdateMethods = new Dictionary<Type, MethodInfo>();
     _RPC_URL = new RequestPathChecker();
     _RPC_SELECT = new RequestPathChecker();
     _jqueryURL = jqueryURL;
     _jsonURL = jsonURL;
     _backboneURL = backboneURL;
     if (_jqueryURL != null)
     {
         _jqueryURL = (!_jqueryURL.StartsWith("/") ? "/" + _jqueryURL : _jqueryURL);
         _RPC_URL.AddMethod("GET", "*", _jqueryURL);
     }
     if (_jsonURL != null)
     {
         _jsonURL = (!_jsonURL.StartsWith("/") ? "/" + _jsonURL : _jsonURL);
         _RPC_URL.AddMethod("GET", "*", _jsonURL);
     }
     if (_backboneURL != null)
     {
         _backboneURL = (!_backboneURL.StartsWith("/") ? "/" + _backboneURL : _backboneURL);
         _RPC_URL.AddMethod("GET", "*", _backboneURL);
     }
     Logger.Debug("Backbone request handler successfully started");
     AssemblyAdded();
 }