From 6b8c814df3141fa705b9921ba0a73aeaa3fe63b6 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 19 Mar 2015 17:01:21 -0700 Subject: Adding new HTTP handling for material manager. --- indra/llmessage/llhttpsdhandler.h | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 indra/llmessage/llhttpsdhandler.h (limited to 'indra/llmessage/llhttpsdhandler.h') diff --git a/indra/llmessage/llhttpsdhandler.h b/indra/llmessage/llhttpsdhandler.h new file mode 100644 index 0000000000..7b7da61b3c --- /dev/null +++ b/indra/llmessage/llhttpsdhandler.h @@ -0,0 +1,56 @@ +/** +* @file llhttpsdhandler.h +* @brief Public-facing declarations for the HttpHandler class +* +* $LicenseInfo:firstyear=2012&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2012, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef _LLHTTPSDHANDLER_H_ +#define _LLHTTPSDHANDLER_H_ +#include "httpcommon.h" +#include "httphandler.h" +#include "lluri.h" + +/// +/// +class LLHttpSDHandler : public LLCore::HttpHandler +{ +public: + LLHttpSDHandler(const LLURI &uri); + + virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); + + inline const LLURI &getUri() const + { + return mUri; + } + +protected: + virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content) = 0; + virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) = 0; + +private: + LLURI mUri; +}; + + +#endif \ No newline at end of file -- cgit v1.2.3 From 97b93179692b764aba7eee571f1b557f6f8070db Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 26 Mar 2015 13:32:09 -0700 Subject: Create trivial handler for SD Messages, method in LLAgent for posting HTTP requests. --- indra/llmessage/llhttpsdhandler.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'indra/llmessage/llhttpsdhandler.h') diff --git a/indra/llmessage/llhttpsdhandler.h b/indra/llmessage/llhttpsdhandler.h index 7b7da61b3c..b3eb7d6145 100644 --- a/indra/llmessage/llhttpsdhandler.h +++ b/indra/llmessage/llhttpsdhandler.h @@ -30,8 +30,12 @@ #include "httphandler.h" #include "lluri.h" +/// Handler class LLCore's HTTP library. Splitting with separate success and +/// failure routines and parsing the result body into LLSD on success. It +/// is intended to be subclassed for specific capability handling. /// -/// +// *TODO: This class self deletes at the end of onCompleted method. This is +// less than ideal and should be revisited. class LLHttpSDHandler : public LLCore::HttpHandler { public: @@ -52,5 +56,19 @@ private: LLURI mUri; }; +/// A trivial implementation of LLHttpSDHandler. This success and failure +/// methods log the action taken, the URI accessed and the status code retuned +/// in the response. +class LLHttpSDGenericHandler : public LLHttpSDHandler +{ +public: + LLHttpSDGenericHandler(const LLURI &uri, const std::string &action); + +protected: + virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content); + virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status); +private: + std::string mCaps; +}; #endif \ No newline at end of file -- cgit v1.2.3 From 735364038767694ea29d9b6a168410e6482cc9c2 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 27 Mar 2015 17:00:02 -0700 Subject: first set of chnages from code review from Nat --- indra/llmessage/llhttpsdhandler.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llmessage/llhttpsdhandler.h') diff --git a/indra/llmessage/llhttpsdhandler.h b/indra/llmessage/llhttpsdhandler.h index b3eb7d6145..a2598c9709 100644 --- a/indra/llmessage/llhttpsdhandler.h +++ b/indra/llmessage/llhttpsdhandler.h @@ -49,7 +49,7 @@ public: } protected: - virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content) = 0; + virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content) = 0; virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) = 0; private: @@ -65,7 +65,7 @@ public: LLHttpSDGenericHandler(const LLURI &uri, const std::string &action); protected: - virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content); + virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content); virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status); private: -- cgit v1.2.3 From edc1439bd633bdac183fbecc131edd55074b5442 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 1 Apr 2015 16:37:00 -0700 Subject: Added AvatarNameCache as coroutine, with LLCore::HttpHandler to respond correctly to Event Pumps. Added get/setRequestURL() to LLCore::HttpResponse Removed URI from the HttpSDHandler. --- indra/llmessage/llhttpsdhandler.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'indra/llmessage/llhttpsdhandler.h') diff --git a/indra/llmessage/llhttpsdhandler.h b/indra/llmessage/llhttpsdhandler.h index a2598c9709..7c28dbcab6 100644 --- a/indra/llmessage/llhttpsdhandler.h +++ b/indra/llmessage/llhttpsdhandler.h @@ -39,21 +39,14 @@ class LLHttpSDHandler : public LLCore::HttpHandler { public: - LLHttpSDHandler(const LLURI &uri); + LLHttpSDHandler(); virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); - inline const LLURI &getUri() const - { - return mUri; - } - protected: virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content) = 0; virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) = 0; -private: - LLURI mUri; }; /// A trivial implementation of LLHttpSDHandler. This success and failure @@ -62,7 +55,7 @@ private: class LLHttpSDGenericHandler : public LLHttpSDHandler { public: - LLHttpSDGenericHandler(const LLURI &uri, const std::string &action); + LLHttpSDGenericHandler(const std::string &action); protected: virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content); -- cgit v1.2.3 From da32de179d50d85cd815c545282d274d18c9dc3e Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 28 Apr 2015 09:39:47 -0700 Subject: Converting llmediaclient to new order. Temp disable llmediaclient's unit tests for link issues. --- indra/llmessage/llhttpsdhandler.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'indra/llmessage/llhttpsdhandler.h') diff --git a/indra/llmessage/llhttpsdhandler.h b/indra/llmessage/llhttpsdhandler.h index 7c28dbcab6..814d1c22b5 100644 --- a/indra/llmessage/llhttpsdhandler.h +++ b/indra/llmessage/llhttpsdhandler.h @@ -36,32 +36,37 @@ /// // *TODO: This class self deletes at the end of onCompleted method. This is // less than ideal and should be revisited. -class LLHttpSDHandler : public LLCore::HttpHandler +class LLHttpSDHandler : public LLCore::HttpHandler //, +// public std::enable_shared_from_this { public: - LLHttpSDHandler(); virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); protected: + LLHttpSDHandler(bool selfDelete = true); + virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content) = 0; virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) = 0; +private: + bool mSelfDelete; + }; /// A trivial implementation of LLHttpSDHandler. This success and failure -/// methods log the action taken, the URI accessed and the status code retuned +/// methods log the action taken, the URI accessed and the status code returned /// in the response. class LLHttpSDGenericHandler : public LLHttpSDHandler { public: - LLHttpSDGenericHandler(const std::string &action); + LLHttpSDGenericHandler(const std::string &name, bool selfDelete = true); protected: virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content); virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status); private: - std::string mCaps; + std::string mName; }; #endif \ No newline at end of file -- cgit v1.2.3 From 4a4470af3210153e0909eb75d51de461d14a3128 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 17 Jun 2015 13:53:28 -0700 Subject: Coding policy fixes --- indra/llmessage/llhttpsdhandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llmessage/llhttpsdhandler.h') diff --git a/indra/llmessage/llhttpsdhandler.h b/indra/llmessage/llhttpsdhandler.h index 814d1c22b5..3b81dc66b9 100644 --- a/indra/llmessage/llhttpsdhandler.h +++ b/indra/llmessage/llhttpsdhandler.h @@ -69,4 +69,4 @@ protected: private: std::string mName; }; -#endif \ No newline at end of file +#endif -- cgit v1.2.3