diff options
author | Rider Linden <none@none> | 2015-03-26 13:32:09 -0700 |
---|---|---|
committer | Rider Linden <none@none> | 2015-03-26 13:32:09 -0700 |
commit | 97b93179692b764aba7eee571f1b557f6f8070db (patch) | |
tree | 73b3d56746f86542833513fd315abc6e575b6e65 /indra/llmessage | |
parent | f6ba7514d2392bfb5bbbe8b003b4b860118fddc5 (diff) |
Create trivial handler for SD Messages, method in LLAgent for posting HTTP requests.
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llhttpsdhandler.cpp | 21 | ||||
-rw-r--r-- | indra/llmessage/llhttpsdhandler.h | 20 |
2 files changed, 40 insertions, 1 deletions
diff --git a/indra/llmessage/llhttpsdhandler.cpp b/indra/llmessage/llhttpsdhandler.cpp index 18daf443ee..0d385d6497 100644 --- a/indra/llmessage/llhttpsdhandler.cpp +++ b/indra/llmessage/llhttpsdhandler.cpp @@ -82,3 +82,24 @@ void LLHttpSDHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons delete this; } +//======================================================================== +LLHttpSDGenericHandler::LLHttpSDGenericHandler(const LLURI &uri, const std::string &caps) : + LLHttpSDHandler(uri), + mCaps(caps) +{ +} + +void LLHttpSDGenericHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content) +{ + LL_DEBUGS() << mCaps << " Success." << LL_ENDL; +} + +void LLHttpSDGenericHandler::onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) +{ + LL_WARNS() + << "\n--------------------------------------------------------------------------\n" + << mCaps << " Error[" << status.toULong() << "] cannot access cap with url '" + << getUri() << "' because " << status.toString() + << "\n--------------------------------------------------------------------------" + << LL_ENDL; +} 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 |