llhttpsdhandler.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * @file llhttpsdhandler.h
  3. * @brief Public-facing declarations for the HttpHandler class
  4. *
  5. * $LicenseInfo:firstyear=2012&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2012, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef _LLHTTPSDHANDLER_H_
  27. #define _LLHTTPSDHANDLER_H_
  28. #include "llcorehttpcommon.h"
  29. #include "llcorehttphandler.h"
  30. #include "llerror.h"
  31. // Handler class LLCore's HTTP library. Splitting with separate success and
  32. // failure routines and parsing the result body into LLSD on success. It is
  33. // intended to be subclassed for specific capability handling.
  34. //
  35. // *TODO: This class self deletes at the end of onCompleted method. This is
  36. // less than ideal and should be revisited.
  37. class LLHttpSDHandler : public LLCore::HttpHandler
  38. {
  39. protected:
  40. LOG_CLASS(LLHttpSDHandler);
  41. LLHttpSDHandler();
  42. virtual void onSuccess(LLCore::HttpResponse* response,
  43. const LLSD& content) = 0;
  44. virtual void onFailure(LLCore::HttpResponse* response,
  45. LLCore::HttpStatus status) = 0;
  46. public:
  47. virtual void onCompleted(LLCore::HttpHandle handle,
  48. LLCore::HttpResponse* response);
  49. };
  50. #endif