Removed ShibTarget members.
[shibboleth/cpp-sp.git] / shibsp / AbstractSPRequest.h
1 /*
2  *  Copyright 2001-2006 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 shibsp/AbstractSPRequest.h
19  * 
20  * Abstract base for SPRequest implementations  
21  */
22
23 #ifndef __shibsp_abstreq_h__
24 #define __shibsp_abstreq_h__
25
26 #include <shibsp/exceptions.h>
27 #include <shibsp/SPRequest.h>
28
29 namespace shibsp {
30
31     class SHIBSP_API CGIParser;
32     
33     /**
34      * Abstract base for SPRequest implementations
35      */
36     class SHIBSP_API AbstractSPRequest : public virtual SPRequest
37     {
38     protected:
39         /**
40          * Constructor
41          * 
42          * @param app   pointer to effective Application, if known
43          */
44         AbstractSPRequest(const Application* app=NULL);
45         
46     public:
47         virtual ~AbstractSPRequest();
48
49         const char* getRequestURL() const {
50             return m_url.c_str();
51         }
52         
53         const Application& getSPApplication() const {
54             return *m_app;
55         }
56
57         const char* getParameter(const char* name) const;
58
59         std::vector<const char*>::size_type getParameters(const char* name, std::vector<const char*>& values) const;
60
61         const char* getCookie(const char* name) const;
62
63         const char* getHandlerURL(const char* resource=NULL) const;
64
65         void log(SPLogLevel level, const std::string& msg) const;
66
67         bool isPriorityEnabled(SPLogLevel level) const;
68
69     protected:
70         /** Holds effective Application. */
71         const Application* m_app;
72
73         /** Complete "canonical" request URL. */
74         std::string m_url;
75     
76     private:
77         void* m_log; // declared void* to avoid log4cpp header conflicts in Apache
78         mutable std::string m_handlerURL;
79         mutable std::map<std::string,std::string> m_cookieMap;
80         mutable CGIParser* m_parser;
81     };
82 };
83
84 #endif /* __shibsp_abstreq_h__ */