resource_mon_page.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "resource_mon_page.h"
  2. using namespace NMonitoring;
  3. void TResourceMonPage::Output(NMonitoring::IMonHttpRequest& request) {
  4. IOutputStream& out = request.Output();
  5. switch (ResourceType) {
  6. case TEXT:
  7. out << HTTPOKTEXT;
  8. break;
  9. case JSON:
  10. out << HTTPOKJSON;
  11. break;
  12. case CSS:
  13. out << (IsCached ? HTTPOKCSS_CACHED : HTTPOKCSS);
  14. break;
  15. case JAVASCRIPT:
  16. out << (IsCached ? HTTPOKJAVASCRIPT_CACHED : HTTPOKJAVASCRIPT);
  17. break;
  18. case FONT_EOT:
  19. out << (IsCached ? HTTPOKFONTEOT_CACHED : HTTPOKFONTEOT);
  20. break;
  21. case FONT_TTF:
  22. out << (IsCached ? HTTPOKFONTTTF_CACHED : HTTPOKFONTTTF);
  23. break;
  24. case FONT_WOFF:
  25. out << (IsCached ? HTTPOKFONTWOFF_CACHED : HTTPOKFONTWOFF);
  26. break;
  27. case FONT_WOFF2:
  28. out << (IsCached ? HTTPOKFONTWOFF2_CACHED : HTTPOKFONTWOFF2);
  29. break;
  30. case PNG:
  31. out << HTTPOKPNG;
  32. break;
  33. case SVG:
  34. out << HTTPOKSVG;
  35. break;
  36. default:
  37. out << HTTPOKBIN;
  38. break;
  39. }
  40. out << NResource::Find(ResourceName);
  41. }
  42. void TResourceMonPage::NotFound(NMonitoring::IMonHttpRequest& request) const {
  43. IOutputStream& out = request.Output();
  44. out << HTTPNOTFOUND;
  45. out.Flush();
  46. }