00001 /** 00002 Licensed to the Apache Software Foundation (ASF) under one 00003 or more contributor license agreements. See the NOTICE file 00004 distributed with this work for additional information 00005 regarding copyright ownership. The ASF licenses this file 00006 to you under the Apache License, Version 2.0 (the 00007 "License"); you may not use this file except in compliance 00008 with the License. You may obtain a copy of the License at 00009 00010 http://www.apache.org/licenses/LICENSE-2.0 00011 00012 Unless required by applicable law or agreed to in writing, software 00013 distributed under the License is distributed on an "AS IS" BASIS, 00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 See the License for the specific language governing permissions and 00016 limitations under the License. 00017 */ 00018 /** 00019 * @file Request.h 00020 */ 00021 00022 #pragma once 00023 #ifndef ATSCPPAPI_REQUEST_H_ 00024 #define ATSCPPAPI_REQUEST_H_ 00025 00026 #include <atscppapi/Headers.h> 00027 #include <atscppapi/HttpVersion.h> 00028 #include <atscppapi/HttpMethod.h> 00029 #include <atscppapi/Url.h> 00030 #include <atscppapi/noncopyable.h> 00031 00032 namespace atscppapi { 00033 00034 class Transaction; 00035 struct RequestState; 00036 00037 /** 00038 * @brief Encapsulates a request. 00039 */ 00040 class Request: noncopyable { 00041 public: 00042 Request(); 00043 00044 /** 00045 * Constructed with an initial URL. 00046 */ 00047 Request(const std::string &url, HttpMethod method = HTTP_METHOD_GET, HttpVersion version = HTTP_VERSION_1_1); 00048 00049 /** @return HTTP method of the request */ 00050 HttpMethod getMethod() const; 00051 00052 /** @return URL of the request */ 00053 Url &getUrl(); 00054 00055 /** @return HTTP version of the request */ 00056 HttpVersion getVersion() const; 00057 00058 /** @return Headers of the request */ 00059 Headers &getHeaders() const; 00060 00061 ~Request(); 00062 private: 00063 Request(void *hdr_buf, void *hdr_loc); 00064 RequestState *state_; 00065 void init(void *hdr_buf, void *hdr_loc); 00066 friend class Transaction; 00067 friend class ClientRequest; 00068 }; 00069 00070 } 00071 00072 #endif