mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-27 06:07:14 +01:00
Added a way to get all available marameter keys to WebServerRequest.
This commit is contained in:
parent
e5719c991b
commit
a781853b2b
@ -135,6 +135,41 @@ void SimpleWebServerRequest::set_header_parameter(const String &key, const Strin
|
|||||||
_header_parameters[key] = value;
|
_header_parameters[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PoolStringArray SimpleWebServerRequest::get_header_parameter_keys() const {
|
||||||
|
PoolStringArray ks;
|
||||||
|
|
||||||
|
for (const HashMap<String, String>::Element *E = _header_parameters.front(); E; E = E->next) {
|
||||||
|
ks.push_back(E->key());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ks;
|
||||||
|
}
|
||||||
|
PoolStringArray SimpleWebServerRequest::get_parameter_keys() const {
|
||||||
|
PoolStringArray g = get_get_parameter_keys();
|
||||||
|
|
||||||
|
g.append_array(get_post_parameter_keys());
|
||||||
|
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
PoolStringArray SimpleWebServerRequest::get_post_parameter_keys() const {
|
||||||
|
PoolStringArray ks;
|
||||||
|
|
||||||
|
for (const HashMap<String, String>::Element *E = _post_parameters.front(); E; E = E->next) {
|
||||||
|
ks.push_back(E->key());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ks;
|
||||||
|
}
|
||||||
|
PoolStringArray SimpleWebServerRequest::get_get_parameter_keys() const {
|
||||||
|
PoolStringArray ks;
|
||||||
|
|
||||||
|
for (const HashMap<String, String>::Element *E = _get_parameters.front(); E; E = E->next) {
|
||||||
|
ks.push_back(E->key());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ks;
|
||||||
|
}
|
||||||
|
|
||||||
void SimpleWebServerRequest::send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code) {
|
void SimpleWebServerRequest::send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code) {
|
||||||
ERR_FAIL_COND(!_server);
|
ERR_FAIL_COND(!_server);
|
||||||
|
|
||||||
|
@ -76,6 +76,11 @@ public:
|
|||||||
virtual String get_header_parameter(const String &key) const;
|
virtual String get_header_parameter(const String &key) const;
|
||||||
virtual void set_header_parameter(const String &key, const String &value);
|
virtual void set_header_parameter(const String &key, const String &value);
|
||||||
|
|
||||||
|
virtual PoolStringArray get_header_parameter_keys() const;
|
||||||
|
virtual PoolStringArray get_parameter_keys() const;
|
||||||
|
virtual PoolStringArray get_post_parameter_keys() const;
|
||||||
|
virtual PoolStringArray get_get_parameter_keys() const;
|
||||||
|
|
||||||
virtual void send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code = HTTPServerEnums::HTTP_STATUS_CODE_302_FOUND);
|
virtual void send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code = HTTPServerEnums::HTTP_STATUS_CODE_302_FOUND);
|
||||||
virtual void send();
|
virtual void send();
|
||||||
virtual void send_file(const String &p_file_path);
|
virtual void send_file(const String &p_file_path);
|
||||||
|
@ -290,6 +290,19 @@ String WebServerRequest::get_header_parameter(const String &key) const {
|
|||||||
void WebServerRequest::set_header_parameter(const String &key, const String &value) {
|
void WebServerRequest::set_header_parameter(const String &key, const String &value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PoolStringArray WebServerRequest::get_header_parameter_keys() const {
|
||||||
|
return PoolStringArray();
|
||||||
|
}
|
||||||
|
PoolStringArray WebServerRequest::get_parameter_keys() const {
|
||||||
|
return PoolStringArray();
|
||||||
|
}
|
||||||
|
PoolStringArray WebServerRequest::get_post_parameter_keys() const {
|
||||||
|
return PoolStringArray();
|
||||||
|
}
|
||||||
|
PoolStringArray WebServerRequest::get_get_parameter_keys() const {
|
||||||
|
return PoolStringArray();
|
||||||
|
}
|
||||||
|
|
||||||
HTTPServerEnums::HTTPStatusCode WebServerRequest::get_status_code() const {
|
HTTPServerEnums::HTTPStatusCode WebServerRequest::get_status_code() const {
|
||||||
return _status_code;
|
return _status_code;
|
||||||
}
|
}
|
||||||
@ -651,6 +664,11 @@ void WebServerRequest::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("get_header_parameter", "key"), &WebServerRequest::get_header_parameter);
|
ClassDB::bind_method(D_METHOD("get_header_parameter", "key"), &WebServerRequest::get_header_parameter);
|
||||||
ClassDB::bind_method(D_METHOD("set_header_parameter", "key", "value"), &WebServerRequest::set_header_parameter);
|
ClassDB::bind_method(D_METHOD("set_header_parameter", "key", "value"), &WebServerRequest::set_header_parameter);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_header_parameter_keys"), &WebServerRequest::get_header_parameter_keys);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_parameter_keys"), &WebServerRequest::get_parameter_keys);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_post_parameter_keys"), &WebServerRequest::get_post_parameter_keys);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_get_parameter_keys"), &WebServerRequest::get_get_parameter_keys);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_status_code"), &WebServerRequest::get_status_code);
|
ClassDB::bind_method(D_METHOD("get_status_code"), &WebServerRequest::get_status_code);
|
||||||
ClassDB::bind_method(D_METHOD("set_status_code", "val"), &WebServerRequest::set_status_code);
|
ClassDB::bind_method(D_METHOD("set_status_code", "val"), &WebServerRequest::set_status_code);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "status_code"), "set_status_code", "get_status_code");
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "status_code"), "set_status_code", "get_status_code");
|
||||||
|
@ -128,6 +128,11 @@ public:
|
|||||||
virtual String get_header_parameter(const String &key) const;
|
virtual String get_header_parameter(const String &key) const;
|
||||||
virtual void set_header_parameter(const String &key, const String &value);
|
virtual void set_header_parameter(const String &key, const String &value);
|
||||||
|
|
||||||
|
virtual PoolStringArray get_header_parameter_keys() const;
|
||||||
|
virtual PoolStringArray get_parameter_keys() const;
|
||||||
|
virtual PoolStringArray get_post_parameter_keys() const;
|
||||||
|
virtual PoolStringArray get_get_parameter_keys() const;
|
||||||
|
|
||||||
HTTPServerEnums::HTTPStatusCode get_status_code() const;
|
HTTPServerEnums::HTTPStatusCode get_status_code() const;
|
||||||
void set_status_code(const HTTPServerEnums::HTTPStatusCode status_code);
|
void set_status_code(const HTTPServerEnums::HTTPStatusCode status_code);
|
||||||
|
|
||||||
|
@ -92,6 +92,19 @@ void WebServerRequestScriptable::set_header_parameter(const String &key, const S
|
|||||||
call("_set_header_parameter", key, value);
|
call("_set_header_parameter", key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PoolStringArray WebServerRequestScriptable::get_header_parameter_keys() const {
|
||||||
|
return const_cast<WebServerRequestScriptable *>(this)->call("_get_header_parameter_keys");
|
||||||
|
}
|
||||||
|
PoolStringArray WebServerRequestScriptable::get_parameter_keys() const {
|
||||||
|
return const_cast<WebServerRequestScriptable *>(this)->call("_get_parameter_keys");
|
||||||
|
}
|
||||||
|
PoolStringArray WebServerRequestScriptable::get_post_parameter_keys() const {
|
||||||
|
return const_cast<WebServerRequestScriptable *>(this)->call("_get_post_parameter_keys");
|
||||||
|
}
|
||||||
|
PoolStringArray WebServerRequestScriptable::get_get_parameter_keys() const {
|
||||||
|
return const_cast<WebServerRequestScriptable *>(this)->call("_get_get_parameter_keys");
|
||||||
|
}
|
||||||
|
|
||||||
void WebServerRequestScriptable::send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code) {
|
void WebServerRequestScriptable::send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code) {
|
||||||
call("_send_redirect", location, status_code);
|
call("_send_redirect", location, status_code);
|
||||||
}
|
}
|
||||||
@ -186,6 +199,19 @@ String WebServerRequestScriptable::_get_header_parameter(const String &key) cons
|
|||||||
void WebServerRequestScriptable::_set_header_parameter(const String &key, const String &value) {
|
void WebServerRequestScriptable::_set_header_parameter(const String &key, const String &value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PoolStringArray WebServerRequestScriptable::_get_header_parameter_keys() const {
|
||||||
|
return PoolStringArray();
|
||||||
|
}
|
||||||
|
PoolStringArray WebServerRequestScriptable::_get_parameter_keys() const {
|
||||||
|
return PoolStringArray();
|
||||||
|
}
|
||||||
|
PoolStringArray WebServerRequestScriptable::_get_post_parameter_keys() const {
|
||||||
|
return PoolStringArray();
|
||||||
|
}
|
||||||
|
PoolStringArray WebServerRequestScriptable::_get_get_parameter_keys() const {
|
||||||
|
return PoolStringArray();
|
||||||
|
}
|
||||||
|
|
||||||
void WebServerRequestScriptable::_send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code) {
|
void WebServerRequestScriptable::_send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,6 +313,11 @@ void WebServerRequestScriptable::_bind_methods() {
|
|||||||
BIND_VMETHOD(MethodInfo("_get_header_parameter", PropertyInfo(Variant::STRING, "key")));
|
BIND_VMETHOD(MethodInfo("_get_header_parameter", PropertyInfo(Variant::STRING, "key")));
|
||||||
BIND_VMETHOD(MethodInfo("_set_header_parameter", PropertyInfo(Variant::STRING, "key"), PropertyInfo(Variant::STRING, "value")));
|
BIND_VMETHOD(MethodInfo("_set_header_parameter", PropertyInfo(Variant::STRING, "key"), PropertyInfo(Variant::STRING, "value")));
|
||||||
|
|
||||||
|
BIND_VMETHOD(MethodInfo(Variant::POOL_STRING_ARRAY, "_get_header_parameter_keys"));
|
||||||
|
BIND_VMETHOD(MethodInfo(Variant::POOL_STRING_ARRAY, "_get_parameter_keys"));
|
||||||
|
BIND_VMETHOD(MethodInfo(Variant::POOL_STRING_ARRAY, "_get_post_parameter_keys"));
|
||||||
|
BIND_VMETHOD(MethodInfo(Variant::POOL_STRING_ARRAY, "_get_get_parameter_keys"));
|
||||||
|
|
||||||
BIND_VMETHOD(MethodInfo("_send_redirect", PropertyInfo(Variant::STRING, "location"), PropertyInfo(Variant::INT, "status_code")));
|
BIND_VMETHOD(MethodInfo("_send_redirect", PropertyInfo(Variant::STRING, "location"), PropertyInfo(Variant::INT, "status_code")));
|
||||||
|
|
||||||
BIND_VMETHOD(MethodInfo("_compile_body"));
|
BIND_VMETHOD(MethodInfo("_compile_body"));
|
||||||
@ -323,6 +354,11 @@ void WebServerRequestScriptable::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("_get_header_parameter", "key"), &WebServerRequestScriptable::_get_header_parameter);
|
ClassDB::bind_method(D_METHOD("_get_header_parameter", "key"), &WebServerRequestScriptable::_get_header_parameter);
|
||||||
ClassDB::bind_method(D_METHOD("_set_header_parameter", "key", "value"), &WebServerRequestScriptable::_set_header_parameter);
|
ClassDB::bind_method(D_METHOD("_set_header_parameter", "key", "value"), &WebServerRequestScriptable::_set_header_parameter);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("_get_header_parameter_keys"), &WebServerRequestScriptable::_get_header_parameter_keys);
|
||||||
|
ClassDB::bind_method(D_METHOD("_get_parameter_keys"), &WebServerRequestScriptable::_get_parameter_keys);
|
||||||
|
ClassDB::bind_method(D_METHOD("_get_post_parameter_keys"), &WebServerRequestScriptable::_get_post_parameter_keys);
|
||||||
|
ClassDB::bind_method(D_METHOD("_get_get_parameter_keys"), &WebServerRequestScriptable::_get_get_parameter_keys);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("_send_redirect", "location", "status_code"), &WebServerRequestScriptable::_send_redirect);
|
ClassDB::bind_method(D_METHOD("_send_redirect", "location", "status_code"), &WebServerRequestScriptable::_send_redirect);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("_compile_body"), &WebServerRequestScriptable::_compile_body);
|
ClassDB::bind_method(D_METHOD("_compile_body"), &WebServerRequestScriptable::_compile_body);
|
||||||
|
@ -75,6 +75,11 @@ public:
|
|||||||
virtual String get_header_parameter(const String &key) const;
|
virtual String get_header_parameter(const String &key) const;
|
||||||
virtual void set_header_parameter(const String &key, const String &value);
|
virtual void set_header_parameter(const String &key, const String &value);
|
||||||
|
|
||||||
|
virtual PoolStringArray get_header_parameter_keys() const;
|
||||||
|
virtual PoolStringArray get_parameter_keys() const;
|
||||||
|
virtual PoolStringArray get_post_parameter_keys() const;
|
||||||
|
virtual PoolStringArray get_get_parameter_keys() const;
|
||||||
|
|
||||||
virtual void send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code = HTTPServerEnums::HTTP_STATUS_CODE_302_FOUND);
|
virtual void send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code = HTTPServerEnums::HTTP_STATUS_CODE_302_FOUND);
|
||||||
virtual void compile_body();
|
virtual void compile_body();
|
||||||
virtual void compile_and_send_body();
|
virtual void compile_and_send_body();
|
||||||
@ -111,6 +116,11 @@ public:
|
|||||||
virtual String _get_header_parameter(const String &key) const;
|
virtual String _get_header_parameter(const String &key) const;
|
||||||
virtual void _set_header_parameter(const String &key, const String &value);
|
virtual void _set_header_parameter(const String &key, const String &value);
|
||||||
|
|
||||||
|
virtual PoolStringArray _get_header_parameter_keys() const;
|
||||||
|
virtual PoolStringArray _get_parameter_keys() const;
|
||||||
|
virtual PoolStringArray _get_post_parameter_keys() const;
|
||||||
|
virtual PoolStringArray _get_get_parameter_keys() const;
|
||||||
|
|
||||||
void _send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code);
|
void _send_redirect(const String &location, const HTTPServerEnums::HTTPStatusCode status_code);
|
||||||
void _compile_body();
|
void _compile_body();
|
||||||
void _compile_and_send_body();
|
void _compile_and_send_body();
|
||||||
|
Loading…
Reference in New Issue
Block a user