CommonRequest.cc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/core/CommonRequest.h>
  17. using namespace AlibabaCloud;
  18. CommonRequest::CommonRequest(RequestPattern pattern):
  19. ServiceRequest("",""),
  20. domain_(),
  21. queryParams_(),
  22. httpMethod_(HttpRequest::Get),
  23. requestPattern_(pattern)
  24. {
  25. }
  26. CommonRequest::~CommonRequest()
  27. {}
  28. std::string CommonRequest::domain()const
  29. {
  30. return domain_;
  31. }
  32. void CommonRequest::setDomain(const std::string &domain)
  33. {
  34. domain_ = domain;
  35. }
  36. CommonRequest::RequestPattern CommonRequest::requestPattern() const
  37. {
  38. return requestPattern_;
  39. }
  40. void CommonRequest::setRequestPattern(RequestPattern pattern)
  41. {
  42. requestPattern_ = pattern;
  43. }
  44. void CommonRequest::setHttpMethod(HttpRequest::Method method)
  45. {
  46. httpMethod_ = method;
  47. }
  48. HttpRequest::Method CommonRequest::httpMethod() const
  49. {
  50. return httpMethod_;
  51. }
  52. CommonRequest::ParameterValueType CommonRequest::queryParameter(const ParameterNameType &name)const
  53. {
  54. return queryParams_.at(name);
  55. }
  56. CommonRequest::ParameterCollection CommonRequest::queryParameters() const
  57. {
  58. return queryParams_;
  59. }
  60. void CommonRequest::setQueryParameter(const ParameterNameType &name, const ParameterValueType &value)
  61. {
  62. queryParams_[name] = value;
  63. }
  64. CommonRequest::ParameterValueType CommonRequest::headerParameter(const ParameterNameType &name)const
  65. {
  66. return headerParams_.at(name);
  67. }
  68. CommonRequest::ParameterCollection CommonRequest::headerParameters() const
  69. {
  70. return headerParams_;
  71. }
  72. void CommonRequest::setHeaderParameter(const ParameterNameType &name, const ParameterValueType &value)
  73. {
  74. headerParams_[name] = value;
  75. }