Esempio n. 1
0
        public void Add(string key, object value)
        {
            MyValidator.ThrowIfNullOrEmpty(key, nameof(key));
            MyValidator.ThrowIfNull(value, nameof(value));

            this.values[key] = value;
        }
Esempio n. 2
0
        public ConnectionHandler(Socket client, IServerRouteConfig serverRouteConfig)
        {
            MyValidator.ThrowIfNull(client, nameof(client));
            MyValidator.ThrowIfNull(serverRouteConfig, nameof(serverRouteConfig));

            this.client            = client;
            this.serverRouteConfig = serverRouteConfig;
        }
Esempio n. 3
0
        public RoutingContext(RequestHandler handler, IEnumerable <string> parameters)
        {
            MyValidator.ThrowIfNull(handler, nameof(handler));
            MyValidator.ThrowIfNull(parameters, nameof(parameters));


            this.Handler    = handler;
            this.Parameters = parameters;
        }
Esempio n. 4
0
        public HttpCookie GetCookie(string key)
        {
            MyValidator.ThrowIfNull(key, nameof(key));

            if (!this.cookies.ContainsKey(key))
            {
                throw new InvalidOperationException($"The given key {key} is not present in the cookies collection.");
            }

            return(this.cookies[key]);
        }
Esempio n. 5
0
        public object Get(string key)
        {
            MyValidator.ThrowIfNull(key, nameof(key));

            if (!this.values.ContainsKey(key))
            {
                return(null);
            }

            return(this.values[key]);
        }
Esempio n. 6
0
        public HttpContext(IHttpRequest request)
        {
            MyValidator.ThrowIfNull(request, nameof(request));

            this.request = request;
        }
Esempio n. 7
0
        public bool ContainsKey(string key)
        {
            MyValidator.ThrowIfNull(key, nameof(key));

            return(this.cookies.ContainsKey(key));
        }
Esempio n. 8
0
        public void Add(HttpCookie cookie)
        {
            MyValidator.ThrowIfNull(cookie, nameof(cookie));

            this.cookies[cookie.Key] = cookie;
        }
Esempio n. 9
0
        public HttpHandler(IServerRouteConfig serverRouteConfig)
        {
            MyValidator.ThrowIfNull(serverRouteConfig, nameof(serverRouteConfig));

            this.serverRouteConfig = serverRouteConfig;
        }