web_session.anubis
8.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/*
* Created by PyramIDE.
* User: フランスのトトロ aka (David RENÉ)
* Date: 17/02/2017
* Time: 17:18
* © David RENÉ
*/
read system/convert.anubis
read system/muscle.anubis
read xlib/database/db_types.anubis
transmit types/web_session.anubis
transmit xlib/generic/session.anubis
read xlib/web/common.anubis
read xlib/web/web_dump.anubis
reserved fields keywords
"AWS_CURRENT_PAGE_TITLE" String current web page title
"AWS_CURRENT_PAGE" String current web page
"AWS_CURRENT_APP" String current web application
"AWS_CURRENT_SPACE" String current web space in application
"AWS_CURRENT_CONTENT" String current in the web space
"AWS_CURRENT_PAGE_RENDERER" String current page renderer
"AWS_CURRENT_DICTIONARY" String current dictionary name used for the application
"AWS_WEB_SITE_PUBLIC_DIR" String
"AWS_WEB_SITE_DIR" String
//"AWS_CURRENT_LEFT_MENU" Left_Menu current left menu on the page
//"AWS_CURRENT_MENU" Menu current menu, on the top of the page
*----------------------------------------------------------------*
public define String
get_new_session_id
=
with session_id = (now, (Word32)virtual_machine_id),
to_ascii(sha1(session_id))
.
public define WEB_Session
to_WEB_Session
(
WEB_Session_No_Var _session
)=
since _session is web_session(id, language, fields, c_web_request, p_web_request, d_web_request),
web_session(id, language, to_Session_Field(fields),
web_request(c_web_request.http_info, var(c_web_request.lwa), c_web_request.is_https),
web_request(p_web_request.http_info, var(p_web_request.lwa), p_web_request.is_https),
web_request(d_web_request.http_info, var(d_web_request.lwa), d_web_request.is_https),
)
.
public define WEB_Session_No_Var
to_WEB_Session_No_Var
(
WEB_Session _session
)=
since _session is web_session(id, language, fields, c_web_request, p_web_request, d_web_request),
web_session(id, language, to_Session_Field_No_Var(*fields),
web_request(c_web_request.http_info, *c_web_request.lwa, c_web_request.is_https),
web_request(p_web_request.http_info, *p_web_request.lwa, p_web_request.is_https),
web_request(d_web_request.http_info, *d_web_request.lwa, d_web_request.is_https),
)
.
public define One replace_String(WEB_Session s, String n, String v) = replace_String(s.fields, n, v).
/************************************************/
"AWS_CURRENT_PAGE_TITLE" String current web page title
"AWS_CURRENT_PAGE" String current web page
"AWS_CURRENT_APP" String current web application
"AWS_CURRENT_SPACE" String current web space in application
"AWS_CURRENT_CONTENT" String current in the web space
"AWS_CURRENT_PAGE_RENDERER" String current page renderer
public define One set_web_site_directory(WEB_Session s, String v) = replace_String(s.fields, "AWS_WEB_SITE_DIR", v).
public define One set_web_site_directory(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_WEB_SITE_DIR", v).
public define String get_web_site_directory(WEB_Session s) = get_String (s.fields, "AWS_WEB_SITE_DIR", "").
public define One set_web_app(WEB_Session s, String v) = replace_String(s.fields, "AWS_CURRENT_APP", v).
public define One set_web_app(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_CURRENT_APP", v).
public define String get_web_app(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_APP", "").
public define One set_web_space(WEB_Session s, String v)= replace_String(s.fields, "AWS_CURRENT_SPACE", v).
public define One set_web_space(Var(List(Session_Field)) fields, String v)= replace_String(fields, "AWS_CURRENT_SPACE", v).
public define String get_web_space(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_SPACE", "").
public define One set_web_content(WEB_Session s, String v)= replace_String(s.fields, "AWS_CURRENT_CONTENT", v).
public define One set_web_content(Var(List(Session_Field)) fields, String v)= replace_String(fields, "AWS_CURRENT_CONTENT", v).
public define String get_web_content(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_CONTENT", "").
public define One set_page(WEB_Session s, String v)= replace_String(s.fields, "AWS_CURRENT_PAGE", v).
public define One set_page(Var(List(Session_Field)) fields, String v)= replace_String(fields, "AWS_CURRENT_PAGE", v).
public define String get_page(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE", "").
public define One set_page_title(WEB_Session s, String v) = replace_String(s.fields, "AWS_CURRENT_PAGE_TITLE", v).
public define One set_page_title(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_CURRENT_PAGE_TITLE", v).
public define String get_page_title(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_TITLE", "").
public define One set_renderer(WEB_Session s, String v) = replace_String(s.fields, "AWS_CURRENT_PAGE_RENDERER", v).
public define One set_renderer(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_CURRENT_PAGE_RENDERER", v).
public define String get_renderer(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_RENDERER", "").
public define One put_Serialized_type(WEB_Session s, String n, $T type) = put_Serialized_type(s.fields, n, type).
public define One replace_Serialized_type(WEB_Session s, String n, $T type) = replace_Serialized_type(s.fields, n, type).
public define Maybe($T) get_Serialized_type(WEB_Session s, String n) = get_Serialized_type(s.fields, n).
public define $T get_Serialized_type(WEB_Session s, String n, $T default) = get_Serialized_type(s.fields, n, default).
public define One remove_Serialized_type(WEB_Session s, String n) = remove_Serialized_type(s.fields, n).
public define String
dump_WEB_Session_Fields
(
List(Session_Field) _fields,
String indent
)=
"\n"+
indent+"-- BEGIN Fields of Session:---------------- \n"+
join("\n", map((Session_Field _field) |-> dump_Session_Field(_field, indent), _fields))+
"\n"+indent+"-- END Fields of Session:---------------- \n"
.
public define String
dump_WEB_Session_Fields
(
List(Session_Field) _fields
)=
dump_WEB_Session_Fields(_fields, "")
.
public define String
dump_WEB_Session_Fields
(
Var(List(Session_Field)) _fields,
String indent
)=
dump_WEB_Session_Fields(*_fields, indent)
.
public define String
dump_WEB_Session_Fields
(
Var(List(Session_Field)) _fields
)=
dump_WEB_Session_Fields(*_fields, "")
.
*---------------------- DUMP ------------------*
String language,
List(WEB_Session_Field) fields,
WEB_Request web_request,
WEB_Request previous_web_request
public define String
dump
(
WEB_Session _session
)=
since _session is web_session(id, language, fields, web_request, previous_web_request, draw_web_request),
"WEB Session Dump: \n"+
"----------------- \n"+
"Session ID : ["+id+"]\n"+
"Language : ["+language+"]\n\n"+
dump_WEB_Session_Fields(*fields, "")+
"-----------------------------------------------------------------------------\n"+
"Current WEB REQUEST:\n"+
"-----------------------------------------------------------------------------\n"+
"http_info:\n"+
dump_http_info(web_request.http_info)+"\n"+
"web arguments:"+
dump_web_arg_values(*web_request.lwa)+"\n\n"+
"-----------------------------------------------------------------------------\n"+
"Previous WEB REQUEST:\n"+
"-----------------------------------------------------------------------------\n"+
"is https "+to_String(previous_web_request.is_https)+"\n"+
"http_info:\n"+
dump_http_info(previous_web_request.http_info)+"\n"+
"web arguments:"+
dump_web_arg_values(*previous_web_request.lwa)+"\n\n"+
"-----------------------------------------------------------------------------\n"+
"Draw WEB REQUEST:\n"+
"-----------------------------------------------------------------------------\n"+
"is https "+to_String(draw_web_request.is_https)+"\n"+
"http_info:\n"+
dump_http_info(draw_web_request.http_info)+"\n"+
"web arguments:"+
dump_web_arg_values(*draw_web_request.lwa)+"\n"
.