[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/utils/kpws/httpd
From:       Vitor Boshi da Silva <vitorboschi () gmail ! com>
Date:       2010-08-18 18:54:50
Message-ID: 20100818185450.98FDDAC855 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1165290 by vitorboschi:

written apidox

 M  +52 -1     khttpserver.h  


--- trunk/playground/utils/kpws/httpd/khttpserver.h #1165289:1165290
@@ -30,26 +30,77 @@
 class Client;
 class QTcpServer;
 class AbstractContent;
+class HttpRequest;
 
+/** @brief this class provides an embedded HTTP server. 
+*/
 class KHttpServer : public QObject {
 	Q_OBJECT
 	public:
+
+		/** constructor
+		 * @p parent the parent QObject
+		*/
 		KHttpServer(QObject *parent=0);
+
+		/** destructor */
 		~KHttpServer();
+
+		/** checks whether the server is listening or not
+		 * @return true = listening, false = not listening
+		*/
 		bool isListening() const;
+
+		/** add new content to the server
+		 * includes a new resource to be served. If the url is already in use, the old \
content will be destroyed and the server will begin to serve the new one. +		 * @p \
url the url of the content +		 * @p content the content generator object. KHttpServer \
will take ownership of it. +		 * @return true = content included, false = content \
could not be included TODO: change the return type to bool +		*/
 		int addContent(const QString &url, AbstractContent *content);
+
+		/** returns a pointer to a server content
+		 * note: the returned AbstractContent is owned by KHttpServer.
+		 * @p url the url of the desired content
+		 * @return a pointer to the content, or 0 if it is not found
+		*/
 		AbstractContent* getContent(const QString &url) const;
+
+		/** stops serving a resource and destroys it
+		 * @p url the url of the content to be removed
+		 * @return true = content removed, false = there was no content associated with \
given url +		*/
 		int removeContent(const QString &url);
+
+		/** begins listening and serving data
+		 * @p address the address in which the server will bind. Defaults to \
QHostAddress::Any +		 * @p port port number to listen. Defaults to 8080. Note: ports \
< 1024 may require root privileges +		 * @return true = the server is now listening \
for requests, false = an error ocurred and the server is not listening TODO: add a \
method to retrieve the error number +		*/
 		bool listen(const QHostAddress & address = QHostAddress::Any, quint16 port = 8080 \
); /* this operation may fail because of lack of permissions (port number < 1024) or \
port already in use. */ +
+		/** stops listening and serving requests. */
 		void close();
+
+		/* retrieves the current address in which the server is listening
+		 * @return the address in which the server is bound
+		*/
 		QHostAddress serverAddress () const;
+
+		/* retrieves the current port in which the server is listening
+		 * @return the port in which the server is bound
+		*/
 		quint16 serverPort() const;
+
+		/* retrieves the current error in human readable form
+		 * @return the error string
+		*/
 		QString errorString() const;
 
 signals:
 		void clientConnected(const Client &client);
 		void clientDisconnected(const Client &client);
-		void contentRequested();
+		void contentRequested(const HttpRequest &request);
 	private:
 		QTcpServer *m_server;
 		QMap< QString, AbstractContent* > *m_contentMap;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic