LLHTTPNode Class Reference

Base class which handles url traversal, response routing and support for standard LLSD services. More...

#include <llhttpnode.h>

Inheritance diagram for LLHTTPNode:

Inheritance graph
Collaboration diagram for LLHTTPNode:

Collaboration graph
List of all members.


Most subclasses override one or more of these methods to provide the service. By default, the rest of the LLHTTPNode architecture will handle requests, create the needed LLIOPump, parse the input to LLSD, and format the LLSD result to the output.

The default implementation of each of these is to call response->methodNotAllowed(); The "simple" versions can be overridden instead in those cases where the service can return an immediately computed response.

typedef LLPointer< ResponseResponsePtr
virtual LLSD get () const
virtual LLSD put (const LLSD &input) const
virtual LLSD post (const LLSD &input) const
virtual LLSD del () const
virtual LLSD del (const LLSD &context) const
virtual void get (ResponsePtr, const LLSD &context) const
virtual void put (ResponsePtr, const LLSD &context, const LLSD &input) const
virtual void post (ResponsePtr, const LLSD &context, const LLSD &input) const
virtual void del (ResponsePtr, const LLSD &context) const

Public Member Functions

 LLHTTPNode ()
virtual ~LLHTTPNode ()
virtual const LLChainIOFactorygetProtocolHandler () const
URL traversal
The tree is traversed by calling getChild() with successive path components, on successive results. When getChild() returns null, or there are no more components, the last child responds to the request.

The default behavior is generally correct, though wildcard nodes will want to implement validate().

virtual LLHTTPNodegetChild (const std::string &name, LLSD &context) const
virtual bool handles (const LLSD &remainder, LLSD &context) const
virtual bool validate (const std::string &name, LLSD &context) const
const LLHTTPNodetraverse (const std::string &path, LLSD &context) const
Child Nodes
The standard node can have any number of child nodes under fixed names, and optionally one "wildcard" node that can handle all other names.

Usually, child nodes are add through LLHTTPRegistration, not by calling this interface directly.

The added node will be now owned by the parent node.

virtual void addNode (const std::string &path, LLHTTPNode *nodeToAdd)
LLSD allNodePaths () const
 Returns an arrary of node paths at and under this node.
const LLHTTPNoderootNode () const
const LLHTTPNodefindNode (const std::string &name) const
virtual void describe (Description &) const

Private Attributes



class  Description
class  Impl
class  Response

Detailed Description

Base class which handles url traversal, response routing and support for standard LLSD services.

Users of the HTTP responder will typically derive a class from this one, implement the get(), put() and/or post() methods, and then use LLHTTPRegistration to insert it into the URL tree.

The default implementation handles servicing the request and creating the pipe fittings needed to read the headers, manage them, convert to and from LLSD, etc.

Definition at line 66 of file llhttpnode.h.

Member Typedef Documentation

typedef LLPointer<Response> LLHTTPNode::ResponsePtr

Definition at line 107 of file llhttpnode.h.

Constructor & Destructor Documentation

LLHTTPNode::LLHTTPNode (  ) 

Definition at line 76 of file llhttpnode.cpp.

Referenced by addNode().

LLHTTPNode::~LLHTTPNode (  )  [virtual]

Definition at line 82 of file llhttpnode.cpp.

References impl, LLHTTPNode::Impl::mNamedChildren, and LLHTTPNode::Impl::mWildcardChild.

Member Function Documentation

void LLHTTPNode::addNode ( const std::string &  path,
LLHTTPNode nodeToAdd 
) [virtual]

Definition at line 250 of file llhttpnode.cpp.

References end, LLHTTPNode::Impl::findNamedChild(), impl, llendl, LLHTTPNode(), llwarns, LLHTTPNode::Impl::mNamedChildren, LLHTTPNode::Impl::mParentNode, LLHTTPNode::Impl::mWildcardChild, LLHTTPNode::Impl::mWildcardKey, and LLHTTPNode::Impl::mWildcardName.

Referenced by LLHTTPRegistrar::buildAllServices(), and tut::HTTPServiceTestData::HTTPServiceTestData().

LLSD LLHTTPNode::allNodePaths (  )  const

Returns an arrary of node paths at and under this node.

Definition at line 330 of file llhttpnode.cpp.

References append_node_paths(), end, i, impl, LLHTTPNode::Impl::mNamedChildren, LLHTTPNode::Impl::mWildcardChild, and LLHTTPNode::Impl::mWildcardName.

Referenced by append_node_paths(), and LLAPIService::get().

void LLHTTPNode::del ( ResponsePtr  ,
const LLSD context 
) const [virtual]

Reimplemented in LLHTTPConfigRuntimeSingleService.

Definition at line 158 of file llhttpnode.cpp.

References del().

LLSD LLHTTPNode::del ( const LLSD context  )  const [virtual]

Definition at line 178 of file llhttpnode.cpp.

References del().

LLSD LLHTTPNode::del (  )  const [virtual]

Definition at line 172 of file llhttpnode.cpp.

Referenced by del().

void LLHTTPNode::describe ( Description  )  const [virtual]

Definition at line 395 of file llhttpnode.cpp.

References LLHTTPNode::Description::shortInfo().

Referenced by LLAPIService::get().

const LLHTTPNode * LLHTTPNode::findNode ( const std::string &  name  )  const

Definition at line 366 of file llhttpnode.cpp.

References LLHTTPNode::Impl::findNamedChild(), and impl.

Referenced by LLAPIService::followRemainder().

void LLHTTPNode::get ( ResponsePtr  ,
const LLSD context 
) const [virtual]

Reimplemented in LLHTTPConfigRuntimeSingleService, LLHTTPConfigPriorityService< PRIORITY >, LLHTTPLiveConfigService, and LLHTTPLiveConfigSingleService.

Definition at line 119 of file llhttpnode.cpp.

References get().

LLSD LLHTTPNode::get (  )  const [virtual]

Reimplemented in LLHTTPConfigService, LLHTTPConfigRuntimeService, LLHTTPHelloService, and tut::LLSDStorageNode.

Definition at line 100 of file llhttpnode.cpp.

Referenced by tut::HTTPNodeTestData::get(), and get().

LLHTTPNode * LLHTTPNode::getChild ( const std::string &  name,
LLSD context 
) const [virtual]

returns a child node, if any, at the given name default looks at children and wildcard child (see below)

Definition at line 185 of file llhttpnode.cpp.

References CONTEXT_REQUEST(), CONTEXT_WILDCARD(), get_ptr_in_map(), impl, LLHTTPNode::Impl::mNamedChildren, LLHTTPNode::Impl::mWildcardChild, LLHTTPNode::Impl::mWildcardKey, NULL, and validate().

Referenced by traverse().

const LLChainIOFactory * LLHTTPNode::getProtocolHandler (  )  const [virtual]

Return a factory object for handling wire protocols. The base class returns NULL, as it doesn't know about wire protocols at all. This is okay for most nodes as LLIOHTTPServer is smart enough to use a default wire protocol for HTTP for such nodes. Specialized subclasses that handle things like XML-RPC will want to implement this. (See LLXMLSDRPCServerFactory.)

Reimplemented in LLHTTPNodeForFactory< Factory >, LLHTTPNodeForFactory< LLXMLRPCServerFactory< Server > >, LLHTTPNodeForFactory< LLChainIOFactoryForPipe< Pipe > >, and LLHTTPNodeForFactory< LLSDRPCServerFactory< Server > >.

Definition at line 401 of file llhttpnode.cpp.

References NULL.

Referenced by LLHTTPResponder::process_impl().

bool LLHTTPNode::handles ( const LLSD remainder,
LLSD context 
) const [virtual]

return true if this node can service the remaining components; default returns true if there are no remaining components

Reimplemented in LLAPIService, and tut::AlphaNode.

Definition at line 205 of file llhttpnode.cpp.

References LLSD::size().

Referenced by traverse().

void LLHTTPNode::post ( ResponsePtr  ,
const LLSD context,
const LLSD input 
) const [virtual]

Reimplemented in LLHTTPConfigRuntimeService, LLTrustedMessageService, LLMessageHandlerBridge, LLAgentGroupDataUpdateViewerNode, LLViewerParcelVoiceInfo, and LLViewerRequiredVoiceVersion.

Definition at line 145 of file llhttpnode.cpp.

References post().

LLSD LLHTTPNode::post ( const LLSD input  )  const [virtual]

Reimplemented in LLHTTPEchoService.

Definition at line 112 of file llhttpnode.cpp.

Referenced by LLMessageSystem::dispatch(), tut::HTTPNodeTestData::post(), and post().

void LLHTTPNode::put ( ResponsePtr  ,
const LLSD context,
const LLSD input 
) const [virtual]

Reimplemented in LLHTTPConfigRuntimeSingleService.

Definition at line 132 of file llhttpnode.cpp.

References put().

LLSD LLHTTPNode::put ( const LLSD input  )  const [virtual]

Reimplemented in tut::LLSDStorageNode.

Definition at line 106 of file llhttpnode.cpp.

Referenced by put().

const LLHTTPNode * LLHTTPNode::rootNode (  )  const

Definition at line 350 of file llhttpnode.cpp.

References impl, and LLHTTPNode::Impl::mParentNode.

Referenced by LLAPIService::followRemainder(), and LLAPIService::get().

const LLHTTPNode * LLHTTPNode::traverse ( const std::string &  path,
LLSD context 
) const

find a node, if any, that can service this path set up context["request"] information

Definition at line 216 of file llhttpnode.cpp.

References LLSD::append(), CONTEXT_REQUEST(), end, getChild(), handles(), lldebugs, llendl, and NULL.

Referenced by LLMessageSystem::dispatch(), tut::HTTPNodeTestData::ensureRootTraversal(), tut::HTTPNodeTestData::get(), tut::HTTPNodeTestData::post(), and LLHTTPResponder::process_impl().

bool LLHTTPNode::validate ( const std::string &  name,
LLSD context 
) const [virtual]

called only on wildcard nodes, to check if they will handle the name; default is false; overrides will want to check name, and return true if the name will construct to a valid url. For convenience, the getChild() method above will automatically insert the name in context["request"]["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 found during traversal.

Reimplemented in LLHTTPConfigRuntimeSingleService, LLHTTPLiveConfigSingleService, LLTrustedMessageService, LLMessageHandlerBridge, and tut::IntegerNode.

Definition at line 211 of file llhttpnode.cpp.

Referenced by getChild().

Member Data Documentation

Impl& LLHTTPNode::impl [private]

Definition at line 222 of file llhttpnode.h.

Referenced by addNode(), allNodePaths(), findNode(), getChild(), rootNode(), and ~LLHTTPNode().

The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:24 2010 for Second Life Viewer by  doxygen 1.4.7