Update copyright.
[shibboleth/cpp-opensaml.git] / saml / binding / HTTPRequest.h
1 /*
2  *  Copyright 2001-2007 Internet2
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
17 /**
18  * @file saml/binding/HTTPRequest.h
19  * 
20  * Interface to HTTP requests 
21  */
22
23 #ifndef __saml_httpreq_h__
24 #define __saml_httpreq_h__
25
26 #include <saml/binding/GenericRequest.h>
27
28 namespace opensaml {
29     
30     /**
31      * Interface to caller-supplied shim for accessing HTTP request context.
32      * 
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.
36      * 
37      * <p>This interface need not be threadsafe.
38      */
39     class SAML_API HTTPRequest : public GenericRequest {
40         MAKE_NONCOPYABLE(HTTPRequest);
41     protected:
42         HTTPRequest() {}
43     public:
44         virtual ~HTTPRequest() {}
45
46         bool isSecure() const {
47             return strcmp(getScheme(),"https")==0;
48         }
49           
50         /**
51          * Returns the HTTP method of the request (GET, POST, etc.)
52          * 
53          * @return the HTTP method
54          */
55         virtual const char* getMethod() const=0;
56         
57         /**
58          * Returns the request URI.
59          * 
60          * @return the request URI
61          */
62         virtual const char* getRequestURI() const=0;
63         
64         /**
65          * Returns the complete request URL, including scheme, host, port, and URI.
66          * 
67          * @return the request URL
68          */
69         virtual const char* getRequestURL() const=0;
70
71         /**
72          * Returns the HTTP query string appened to the request. The query
73          * string is returned without any decoding applied, everything found
74          * after the ? delimiter. 
75          * 
76          * @return the query string
77          */
78         virtual const char* getQueryString() const=0;
79
80         /**
81          * Returns a request header value.
82          * 
83          * @param name  the name of the header to return
84          * @return the header's value, or an empty string
85          */
86         virtual std::string getHeader(const char* name) const=0;
87     };
88 };
89
90 #endif /* __saml_httpreq_h__ */