FileServlet.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /***************************************************************************
  2. * Copyright (C) 2009, 2010 by Axel Jaeger <axeljaeger@googlemail.com> *
  3. * *
  4. * This file is part of Glowworm. *
  5. * *
  6. * Glowworm is free software: you can redistribute it and/or modify *
  7. * it under the terms of the GNU General Public License as published by *
  8. * the Free Software Foundation, version 3 of the License. *
  9. * *
  10. * Glowworm is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with Glowworm. If not, see <http://www.gnu.org/licenses/>. *
  17. ***************************************************************************/
  18. #ifndef FILESERVLET_H
  19. #define FILESERVLET_H
  20. #include "AbstractServlet.h"
  21. #include <QDir>
  22. #include <QFileInfo>
  23. class FileServlet : public AbstractServlet
  24. {
  25. public:
  26. explicit FileServlet(HttpServer* parent = NULL);
  27. ~FileServlet();
  28. void request(HttpRequest* request, HttpResponse* response);
  29. static QString mimeTypeForFile(const QFileInfo & file);
  30. QDir wwwRoot() const;
  31. void setWwwRoot(const QDir & dir);
  32. protected:
  33. private:
  34. QDir m_wwwRoot;
  35. };
  36. #endif // FILESERVLET_H