proxygen
HTTPErrorPage.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
12 #include <memory>
13 #include <string>
14 
15 namespace folly {
16 class IOBuf;
17 }
18 
19 namespace proxygen {
20 
26 public:
27  struct Page {
28  Page(const std::string& pageContentType,
29  std::unique_ptr<folly::IOBuf> pageContent) :
30  contentType(pageContentType), content(std::move(pageContent)) {}
31 
32  Page(Page&& other) noexcept :
33  contentType(other.contentType),
34  content(std::move(other.content)) {
35  }
36 
38  std::unique_ptr<folly::IOBuf> content;
39  };
40 
41  virtual ~HTTPErrorPage() {}
42 
43  virtual Page generate(uint64_t requestID,
44  unsigned httpStatusCode,
45  const std::string& reason,
46  std::unique_ptr<folly::IOBuf> body,
47  const std::string& detailReason) const = 0;
48 };
49 
54 public:
55  explicit HTTPStaticErrorPage(
56  std::unique_ptr<folly::IOBuf> content,
57  const std::string& contentType = "text/html; charset=utf-8");
58 
59  Page generate(uint64_t requestID,
60  unsigned httpStatusCode,
61  const std::string& reason,
62  std::unique_ptr<folly::IOBuf> body,
63  const std::string& detailReason) const override;
64 
65 private:
66  std::unique_ptr<folly::IOBuf> content_;
68 };
69 
70 } // proxygen
std::unique_ptr< folly::IOBuf > content_
Definition: HTTPErrorPage.h:66
Page(Page &&other) noexcept
Definition: HTTPErrorPage.h:32
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
STL namespace.
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
const std::string contentType
Definition: HTTPErrorPage.h:37
requires E e noexcept(noexcept(s.error(std::move(e))))
const char * string
Definition: Conv.cpp:212
std::unique_ptr< folly::IOBuf > content
Definition: HTTPErrorPage.h:38
Page(const std::string &pageContentType, std::unique_ptr< folly::IOBuf > pageContent)
Definition: HTTPErrorPage.h:28