/thirdparty/qxt/qxtweb-standalone/qxtweb/qxthttpsessionmanager.h

http://github.com/tomahawk-player/tomahawk · C Header · 91 lines · 49 code · 18 blank · 24 comment · 0 complexity · 0a6249737d37fee5914c766cf4c79b9b MD5 · raw file

  1. /****************************************************************************
  2. **
  3. ** Copyright (C) Qxt Foundation. Some rights reserved.
  4. **
  5. ** This file is part of the QxtWeb module of the Qxt library.
  6. **
  7. ** This library is free software; you can redistribute it and/or modify it
  8. ** under the terms of the Common Public License, version 1.0, as published
  9. ** by IBM, and/or under the terms of the GNU Lesser General Public License,
  10. ** version 2.1, as published by the Free Software Foundation.
  11. **
  12. ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY
  13. ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
  14. ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
  15. ** FITNESS FOR A PARTICULAR PURPOSE.
  16. **
  17. ** You should have received a copy of the CPL and the LGPL along with this
  18. ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files
  19. ** included with the source distribution for more information.
  20. ** If you did not receive a copy of the licenses, contact the Qxt Foundation.
  21. **
  22. ** <http://libqxt.org> <foundation@libqxt.org>
  23. **
  24. ****************************************************************************/
  25. #ifndef QXTHTTPSESSIONMANAGER_H
  26. #define QXTHTTPSESSIONMANAGER_H
  27. #include "qxtabstractwebsessionmanager.h"
  28. #include "qxtabstracthttpconnector.h"
  29. #include <QHostAddress>
  30. #include <QHttpHeader>
  31. #include <QSharedPointer>
  32. class QxtWebEvent;
  33. class QxtWebContent;
  34. class QxtHttpSessionManagerPrivate;
  35. class QXT_WEB_EXPORT QxtHttpSessionManager : public QxtAbstractWebSessionManager
  36. {
  37. friend class QxtAbstractHttpConnector;
  38. Q_OBJECT
  39. public:
  40. enum Connector { HttpServer, Scgi, Fcgi };
  41. QxtHttpSessionManager(QObject* parent = 0);
  42. virtual void postEvent(QxtWebEvent*);
  43. QHostAddress listenInterface() const;
  44. void setListenInterface(const QHostAddress& iface);
  45. quint16 port() const;
  46. void setPort(quint16 port);
  47. QByteArray sessionCookieName() const;
  48. void setSessionCookieName(const QByteArray& name);
  49. bool autoCreateSession() const;
  50. void setAutoCreateSession(bool enable);
  51. QxtAbstractWebService* staticContentService() const;
  52. void setStaticContentService(QxtAbstractWebService* service);
  53. void setConnector(QxtAbstractHttpConnector* connector);
  54. void setConnector(Connector connector);
  55. QxtAbstractHttpConnector* connector() const;
  56. virtual bool start();
  57. protected:
  58. virtual int newSession();
  59. virtual void incomingRequest(quint32 requestID, const QHttpRequestHeader& header, QxtWebContent* device);
  60. protected Q_SLOTS:
  61. virtual void processEvents();
  62. private Q_SLOTS:
  63. void closeConnection(int requestID);
  64. void chunkReadyRead(int requestID);
  65. void sendNextChunk(int requestID);
  66. void sendEmptyChunk(int requestID);
  67. void blockReadyRead(int requestID);
  68. void sendNextBlock(int requestID);
  69. private:
  70. void disconnected(QIODevice* device);
  71. QXT_DECLARE_PRIVATE(QxtHttpSessionManager)
  72. };
  73. #endif