<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /builddir/build/BUILD/libqxt/src/web/qxtwebservicedirectory.cpp --> <head> <title>QxtWebServiceDirectory Class Reference</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://libqxt.org"><img src="images/qxt-logo.png" width="50" height="40" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="classes.html"><font color="#004faf">Classes</font></a> · <a href="namespaces.html"><font color="#004faf">Namespaces</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QxtWebServiceDirectory Class Reference<br /><span class="small-subtitle">[<a href="qxtweb.html">QxtWeb</a> module]</span> </h1> <p>The QxtWebServiceDirectory class provides Path-based web service dispatcher <a href="#details">More...</a></p> <pre> #include <QxtWebServiceDirectory></pre><p>Inherits <a href="qxtabstractwebservice.html">QxtAbstractWebService</a>.</p> <ul> <li><a href="qxtwebservicedirectory-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"></div><b><a href="qxtwebservicedirectory.html#QxtWebServiceDirectory">QxtWebServiceDirectory</a></b> ( QxtAbstractWebSessionManager * <i>sm</i>, QObject * <i>parent</i> = 0 )</li> <li><div class="fn"></div>void <b><a href="qxtwebservicedirectory.html#addService">addService</a></b> ( const QString & <i>path</i>, QxtAbstractWebService * <i>service</i> )</li> <li><div class="fn"></div>QString <b><a href="qxtwebservicedirectory.html#defaultRedirect">defaultRedirect</a></b> () const</li> <li><div class="fn"></div>void <b><a href="qxtwebservicedirectory.html#removeService">removeService</a></b> ( const QString & <i>path</i> )</li> <li><div class="fn"></div>QxtAbstractWebService * <b><a href="qxtwebservicedirectory.html#service">service</a></b> ( const QString & <i>path</i> ) const</li> <li><div class="fn"></div>void <b><a href="qxtwebservicedirectory.html#setDefaultRedirect">setDefaultRedirect</a></b> ( const QString & <i>path</i> )</li> </ul> <ul> <li><div class="fn"></div>3 public functions inherited from <a href="qxtabstractwebservice.html#public-functions">QxtAbstractWebService</a></li> <li><div class="fn"></div>29 public functions inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-functions">QObject</a></li> </ul> <a name="protected-functions"></a> <h3>Protected Functions</h3> <ul> <li><div class="fn"></div>virtual void <b><a href="qxtwebservicedirectory.html#indexRequested">indexRequested</a></b> ( QxtWebRequestEvent * <i>event</i> )</li> <li><div class="fn"></div>virtual void <b><a href="qxtwebservicedirectory.html#unknownServiceRequested">unknownServiceRequested</a></b> ( QxtWebRequestEvent * <i>event</i>, const QString & <i>name</i> )</li> </ul> <ul> <li><div class="fn"></div>7 protected functions inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#protected-functions">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li><div class="fn"></div>1 property inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#properties">QObject</a></li> <li><div class="fn"></div>1 public slot inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-slots">QObject</a></li> <li><div class="fn"></div>1 signal inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#signals">QObject</a></li> <li><div class="fn"></div>1 public type inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-variables">QObject</a></li> <li><div class="fn"></div>4 static public members inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#static-public-members">QObject</a></li> <li><div class="fn"></div>2 protected variables inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#protected-variables">QObject</a></li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QxtWebServiceDirectory class provides Path-based web service dispatcher</p> <p>QxtWebServiceDirectory allows multiple services to be associated with a single session. Selection between services is determined by the first path component in the URL. For example, the URL "/site/request?param=true" would relay the URL "/request?param=true" to the service named "site".</p> <p>This class can be used recursively to declare a hierarchy of services. For example:</p> <pre> QxtWebServiceDirectory* top = new QxtWebServiceDirectory(sm, sm); QxtWebServiceDirectory* service1 = new QxtWebServiceDirectory(sm, top); QxtWebServiceDirectory* service2 = new QxtWebServiceDirectory(sm, top); QxtWebServiceDirectory* service1a = new QxtWebServiceDirectory(sm, service1); QxtWebServiceDirectory* service1b = new QxtWebServiceDirectory(sm, service1); top->addService("1", service1); top->addService("2", service2); service1->addService("a", service1a); service1->addService("b", service1b);</pre> <p>This accepts the URLs "/1/a/", "/1/b/", and "/2/".</p> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QxtWebServiceDirectory"></a>QxtWebServiceDirectory::QxtWebServiceDirectory ( <a href="qxtabstractwebsessionmanager.html">QxtAbstractWebSessionManager</a> * <i>sm</i>, <a href="http://doc.qtsoftware.com/4.5/qobject.html">QObject</a> * <i>parent</i> = 0 )</h3> <p>Constructs a <a href="qxtwebservicedirectory.html">QxtWebServiceDirectory</a> object with the specified session manager <i>sm</i> and <i>parent</i>.</p> <p>Often, the session manager will also be the parent, but this is not a requirement.</p> <h3 class="fn"><a name="addService"></a>void QxtWebServiceDirectory::addService ( const <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> & <i>path</i>, <a href="qxtabstractwebservice.html">QxtAbstractWebService</a> * <i>service</i> )</h3> <p>Adds a <i>service</i> to the directory at the given <i>path</i>.</p> <p>See also <a href="qxtwebservicedirectory.html#removeService">removeService</a>() and <a href="qxtwebservicedirectory.html#service">service</a>().</p> <h3 class="fn"><a name="defaultRedirect"></a><a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> QxtWebServiceDirectory::defaultRedirect () const</h3> <p>Returns the path that will be used by default by the indexRequested event.</p> <p>See also <a href="qxtwebservicedirectory.html#indexRequested">indexRequested</a>() and <a href="qxtwebservicedirectory.html#setDefaultRedirect">setDefaultRedirect</a>().</p> <h3 class="fn"><a name="indexRequested"></a>void QxtWebServiceDirectory::indexRequested ( <a href="qxtwebrequestevent.html">QxtWebRequestEvent</a> * <i>event</i> ) <tt> [virtual protected]</tt></h3> <p>This <i>event</i> handler is called whenever the URL does not contain a path, that is, the URL is "/" or empty.</p> <p>The default implementation redirects to the service specified by <a href="qxtwebservicedirectory.html#setDefaultRedirect">setDefaultRedirect</a>(), or invokes <a href="qxtwebservicedirectory.html#unknownServiceRequested">unknownServiceRequested</a>() if no default redirect has been set.</p> <h3 class="fn"><a name="removeService"></a>void QxtWebServiceDirectory::removeService ( const <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> & <i>path</i> )</h3> <p>Removes the service at the given <i>path</i>.</p> <p>Note that the service object is not destroyed.</p> <h3 class="fn"><a name="service"></a><a href="qxtabstractwebservice.html">QxtAbstractWebService</a> * QxtWebServiceDirectory::service ( const <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> & <i>path</i> ) const</h3> <p>Returns the service at the given <i>path</i>.</p> <h3 class="fn"><a name="setDefaultRedirect"></a>void QxtWebServiceDirectory::setDefaultRedirect ( const <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> & <i>path</i> )</h3> <p>Sets the <i>path</i> that will be used by default by the indexRequested event.</p> <p>See also <a href="qxtwebservicedirectory.html#indexRequested">indexRequested</a>() and <a href="qxtwebservicedirectory.html#defaultRedirect">defaultRedirect</a>().</p> <h3 class="fn"><a name="unknownServiceRequested"></a>void QxtWebServiceDirectory::unknownServiceRequested ( <a href="qxtwebrequestevent.html">QxtWebRequestEvent</a> * <i>event</i>, const <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> & <i>name</i> ) <tt> [virtual protected]</tt></h3> <p>This <i>event</i> handler is called whenever the URL requests a service with <i>name</i> that has not been added to the directory.</p> <p>The default implementation returns a 404 "Service not known" error. Subclasses may reimplement this event handler to customize this behavior.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td align="left">Copyright © 2007-2010 <a href="mailto:foundation@libqxt.org">Qxt Foundation</a></td> <td align="right"><div align="right"> <a href="http://libqxt.org">Qxt</a> 0.6.1</div></td> </tr></table></div></address></body> </html>