Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ProcessingState.cs
1using System;
3using Waher.Script;
4
6{
10 public class ProcessingState
11 {
12 private readonly HttpRequest request;
13 private readonly HttpResource resource;
14 private readonly WebApplicationFirewall firewall;
15 private RequestVariables variables;
16
25 {
26 this.request = Request;
27 this.resource = Resource;
28 this.firewall = Firewall;
29 }
30
34 public HttpRequest Request => this.request;
35
39 public HttpResource Resource => this.resource;
40
44 public WebApplicationFirewall Firewall => this.firewall;
45
49 public string ContentAsString { get; set; }
50
55 {
56 get
57 {
58 this.variables ??= new RequestVariables(this.request);
59 return this.variables;
60 }
61 }
62
70 public bool TryGetCachedObject<T>(string Key, out T Value)
71 {
72 if (this.firewall.Cache.TryGetValue(Key, out object Obj) && Obj is T TypedObj)
73 {
74 Value = TypedObj;
75 return true;
76 }
77 else
78 {
79 Value = default;
80 return false;
81 }
82 }
83
89 public void AddToCache(string Key, object Value)
90 {
91 this.firewall.Cache.Add(Key, Value);
92 }
93
100 public void AddToCache(string Key, object Value, TimeSpan Expires)
101 {
102 this.firewall.Cache.Add(Key, Value, Expires);
103 }
104
111 public void AddToCache(string Key, object Value, DateTime Expires)
112 {
113 this.firewall.Cache.Add(Key, Value, Expires);
114 }
115 }
116}
Represents an HTTP request.
Definition: HttpRequest.cs:22
Base class for all HTTP resources.
Definition: HttpResource.cs:23
Collection of variables.
Definition: Variables.cs:25
Contains the current state of a review process.
string ContentAsString
Content decoded as a string.
void AddToCache(string Key, object Value)
Adds a value to the cache.
ProcessingState(HttpRequest Request, HttpResource Resource, WebApplicationFirewall Firewall)
Contains the current state of a review process.
bool TryGetCachedObject< T >(string Key, out T Value)
Tries to get a cached object of a given type.
WebApplicationFirewall Firewall
Reference to the current Web Application Firewall object.
void AddToCache(string Key, object Value, TimeSpan Expires)
Adds a value to the cache.
HttpResource Resource
Corresponding HTTP Resource, if found.
void AddToCache(string Key, object Value, DateTime Expires)
Adds a value to the cache.
HttpRequest Request
Current HTTP Request
Request variables used in script.
Web Application Firewall for HttpServer.