summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llhttpsdhandler.cpp21
-rw-r--r--indra/llmessage/llhttpsdhandler.h20
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