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
[legend]
Collaboration diagram for LLHTTPNode:

Collaboration graph
[legend]

List of all members.

Responses

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 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

Implimpl

Classes

class  Description
class  Impl
class  Response


Detailed Description

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

These classes represent the HTTP framework: The URL tree, and the LLSD REST interface that such nodes implement.

To implement a service, in most cases, subclass LLHTTPNode, implement get() or post(), and create a global instance of LLHTTPRegistration<>. This can all be done in a .cpp file, with no publically declared parts.

To implement a server see lliohttpserver.h

See also:
LLHTTPWireServer
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

Definition at line 106 of file llhttpnode.h.


Constructor & Destructor Documentation

LLHTTPNode::LLHTTPNode (  ) 

Definition at line 76 of file llhttpnode.cpp.

Referenced by addNode().

Here is the caller graph for this function:

LLHTTPNode::~LLHTTPNode (  )  [virtual]


Member Function Documentation

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().

Here is the caller graph for this function:

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

Reimplemented in tut::LLSDStorageNode.

Definition at line 106 of file llhttpnode.cpp.

Referenced by put().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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

Definition at line 172 of file llhttpnode.cpp.

Referenced by del().

Here is the caller graph for this function:

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

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

Reimplemented in LLHTTPConfigRuntimeSingleService.

Definition at line 132 of file llhttpnode.cpp.

References put().

Here is the call graph for this function:

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

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

Reimplemented in LLHTTPConfigRuntimeSingleService.

Definition at line 158 of file llhttpnode.cpp.

References del().

Here is the call graph for this function:

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 179 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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 199 of file llhttpnode.cpp.

References LLSD::size().

Referenced by traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

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 205 of file llhttpnode.cpp.

Referenced by getChild().

Here is the caller graph for this function:

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 210 of file llhttpnode.cpp.

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

LLSD LLHTTPNode::allNodePaths (  )  const

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

Definition at line 324 of file llhttpnode.cpp.

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

Referenced by append_node_paths().

Here is the call graph for this function:

Here is the caller graph for this function:

const LLHTTPNode * LLHTTPNode::rootNode (  )  const

Definition at line 344 of file llhttpnode.cpp.

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

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

Definition at line 360 of file llhttpnode.cpp.

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

Referenced by LLAPIService::followRemainder().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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 395 of file llhttpnode.cpp.

References NULL.

Referenced by LLHTTPResponder::process_impl().

Here is the caller graph for this function:


Member Data Documentation

Impl& LLHTTPNode::impl [private]

Definition at line 221 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 Fri May 16 08:49:05 2008 for SecondLife by  doxygen 1.5.5