2 * Copyright 2001-2007 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file xmltooling/io/HTTPRequest.h
20 * Interface to HTTP requests
23 #ifndef __xmltooling_httpreq_h__
24 #define __xmltooling_httpreq_h__
26 #include <xmltooling/io/GenericRequest.h>
28 namespace xmltooling {
31 * Interface to HTTP requests.
33 * <p>To supply information from the surrounding web server environment,
34 * a shim must be supplied in the form of this interface to adapt the
35 * library to different proprietary server APIs.
37 * <p>This interface need not be threadsafe.
39 class XMLTOOL_API HTTPRequest : public GenericRequest {
43 virtual ~HTTPRequest() {}
45 bool isSecure() const {
46 return strcmp(getScheme(),"https")==0;
50 * Returns the HTTP method of the request (GET, POST, etc.)
52 * @return the HTTP method
54 virtual const char* getMethod() const=0;
57 * Returns the request URI.
59 * @return the request URI
61 virtual const char* getRequestURI() const=0;
64 * Returns the complete request URL, including scheme, host, port, and URI.
66 * @return the request URL
68 virtual const char* getRequestURL() const=0;
71 * Returns the HTTP query string appened to the request. The query
72 * string is returned without any decoding applied, everything found
73 * after the ? delimiter.
75 * @return the query string
77 virtual const char* getQueryString() const=0;
80 * Returns a request header value.
82 * @param name the name of the header to return
83 * @return the header's value, or an empty string
85 virtual std::string getHeader(const char* name) const=0;
89 #endif /* __xmltooling_httpreq_h__ */