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 shibsp/AbstractSPRequest.h
20 * Abstract base for SPRequest implementations
23 #ifndef __shibsp_abstreq_h__
24 #define __shibsp_abstreq_h__
26 #include <shibsp/exceptions.h>
27 #include <shibsp/SPRequest.h>
28 #include <shibsp/util/CGIParser.h>
32 #if defined (_MSC_VER)
33 #pragma warning( push )
34 #pragma warning( disable : 4251 )
38 * Abstract base for SPRequest implementations
40 class SHIBSP_API AbstractSPRequest : public virtual SPRequest
46 * @param category logging category to use
48 AbstractSPRequest(const char* category);
51 * Stores a normalized request URI to ensure it contains no %-encoded characters
52 * or other undesirable artifacts, such as ;jsessionid appendage.
54 * @param uri the request URI as obtained from the client
56 void setRequestURI(const char* uri);
59 virtual ~AbstractSPRequest();
61 const ServiceProvider& getServiceProvider() const {
65 RequestMapper::Settings getRequestSettings() const;
67 const Application& getApplication() const;
69 Session* getSession(bool checkTimeout=true, bool ignoreAddress=false, bool cache=true);
71 const char* getRequestURI() const {
75 const char* getRequestURL() const;
77 std::string getRemoteAddr() const;
79 const char* getParameter(const char* name) const;
81 std::vector<const char*>::size_type getParameters(const char* name, std::vector<const char*>& values) const;
83 const char* getHandlerURL(const char* resource=NULL) const;
85 void log(SPLogLevel level, const std::string& msg) const;
87 bool isPriorityEnabled(SPLogLevel level) const;
90 ServiceProvider* m_sp;
91 mutable RequestMapper* m_mapper;
92 mutable RequestMapper::Settings m_settings;
93 mutable const Application* m_app;
94 mutable bool m_sessionTried;
95 mutable Session* m_session;
97 mutable std::string m_url;
98 void* m_log; // declared void* to avoid log4cpp header conflicts in Apache
99 mutable std::string m_handlerURL;
100 mutable CGIParser* m_parser;
103 #if defined (_MSC_VER)
104 #pragma warning( pop )
109 #endif /* __shibsp_abstreq_h__ */