diff options
Diffstat (limited to 'indra/llmessage/llhttpnode.h')
-rwxr-xr-x[-rw-r--r--] | indra/llmessage/llhttpnode.h | 68 |
1 files changed, 40 insertions, 28 deletions
diff --git a/indra/llmessage/llhttpnode.h b/indra/llmessage/llhttpnode.h index 915aacb7cc..1144d88be1 100644..100755 --- a/indra/llmessage/llhttpnode.h +++ b/indra/llmessage/llhttpnode.h @@ -2,31 +2,25 @@ * @file llhttpnode.h * @brief Declaration of classes for generic HTTP/LSL/REST handling. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, 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. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -37,6 +31,17 @@ #include "llrefcount.h" #include "llsd.h" +// common strings use for populating the context. basically 'request', +// 'wildcard', and 'headers'. +extern const std::string CONTEXT_HEADERS; +extern const std::string CONTEXT_PATH; +extern const std::string CONTEXT_QUERY_STRING; +extern const std::string CONTEXT_REQUEST; +extern const std::string CONTEXT_RESPONSE; +extern const std::string CONTEXT_VERB; +extern const std::string CONTEXT_WILDCARD; + + class LLChainIOFactory; /** @@ -66,6 +71,8 @@ class LLChainIOFactory; */ class LLHTTPNode { +protected: + LOG_CLASS(LLHTTPNode); public: LLHTTPNode(); virtual ~LLHTTPNode(); @@ -106,7 +113,12 @@ public: /** * @brief return status code and message with headers. */ - virtual void extendedResult(S32 code, const std::string& message, const LLSD& headers) = 0; + virtual void extendedResult(S32 code, const std::string& message, const LLSD& headers = LLSD()) = 0; + + /** + * @brief return status code and LLSD result with headers. + */ + virtual void extendedResult(S32 code, const LLSD& result, const LLSD& headers = LLSD()) = 0; /** * @brief return status code and reason string on http header, @@ -124,7 +136,7 @@ public: virtual void methodNotAllowed(); /** - * @breif Add a name: value http header. + * @brief Add a name: value http header. * * No effort is made to ensure the response is a valid http * header. @@ -193,15 +205,15 @@ public: name, and return true if the name will construct to a valid url. For convenience, the <code>getChild()</code> method above will automatically insert the name in - context["request"]["wildcard"][key] if this method returns true. + context[CONTEXT_REQUEST][CONTEXT_WILDCARD][key] if this method returns true. For example, the node "agent/<agent_id>/detail" will set - context["request"]["wildcard"]["agent_id"] eqaul to the value + context[CONTEXT_REQUEST][CONTEXT_WILDCARD]["agent_id"] eqaul to the value found during traversal. */ const LLHTTPNode* traverse(const std::string& path, LLSD& context) const; /**< find a node, if any, that can service this path - set up context["request"] information + set up context[CONTEXT_REQUEST] information */ //@} @@ -293,7 +305,7 @@ public: void result(const LLSD& result); void extendedResult(S32 code, const std::string& body, const LLSD& headers); - + void extendedResult(S32 code, const LLSD& result, const LLSD& headers); void status(S32 code, const std::string& message); void print(std::ostream& out) const; @@ -305,7 +317,7 @@ protected: ~LLSimpleResponse(); private: - LLSimpleResponse() {;} // Must be accessed through LLPointer. + LLSimpleResponse() : mCode(0) {} // Must be accessed through LLPointer. }; std::ostream& operator<<(std::ostream& out, const LLSimpleResponse& resp); |