requestdispatcher.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. Copyright 2017 Herik Lima de Castro and Marcelo Medeiros Eler
  3. Distributed under MIT license, or public domain if desired and
  4. recognized in your jurisdiction.
  5. See file LICENSE for detail.
  6. */
  7. #ifndef REQUESTDISPATCHER_H
  8. #define REQUESTDISPATCHER_H
  9. #include <QString>
  10. #include "cppwebframework_global.h"
  11. CWF_BEGIN_NAMESPACE
  12. class Request;
  13. class Response;
  14. /**
  15. * @brief The RequestDispatcher class can be used to dispatch a requisition to a page.
  16. */
  17. class CPPWEBFRAMEWORKSHARED_EXPORT RequestDispatcher
  18. {
  19. QString file;
  20. public:
  21. /**
  22. * @brief This constructor receives a file name.
  23. */
  24. explicit RequestDispatcher(const QString &file) : file(file) {}
  25. /**
  26. * @brief This method will dispatch the page file specificated in path to the CSTLCompiler,
  27. * the CSTLCompiler will compile the xhtml file and returns the result.
  28. * After this, the RequestDispatcher will take the return and write it on the response.
  29. * @param CWF::Request &request : Used to process the response.
  30. * @param CWF::Response &response : Used to response.
  31. */
  32. void forward(CWF::Request &request, CWF::Response &response);
  33. };
  34. CWF_END_NAMESPACE
  35. #endif // REQUESTDISPATCHER_H