CPPSERV


Home Projects Jobs Clientele Contact
CPPSERV Documentation Download TODO Mailing lists Bug tracker News RSS Feed Browse source

HttpServletRequestWrapper.h

Go to the documentation of this file.
00001 /*
00002 * Copyright 2004 The Apache Software Foundation
00003 *
00004 * Licensed under the Apache License, Version 2.0 (the "License");
00005 * you may not use this file except in compliance with the License.
00006 * You may obtain a copy of the License at
00007 *
00008 *     http://www.apache.org/licenses/LICENSE-2.0
00009 *
00010 * Unless required by applicable law or agreed to in writing, software
00011 * distributed under the License is distributed on an "AS IS" BASIS,
00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 * See the License for the specific language governing permissions and
00014 * limitations under the License.
00015 */
00016 
00017 #ifndef _HTTP_SERVLET_REQUEST_WRAPPER_H_
00018 #define _HTTP_SERVLET_REQUEST_WRAPPER_H_
00019 
00020 #include <servlet/ServletRequestWrapper.h>
00021 #include <servlet/HttpServletRequest.h>
00022 
00023 namespace servlet
00024 {
00039 class HttpServletRequestWrapper:
00040     public ServletRequestWrapper, public HttpServletRequest
00041 {
00042 private:
00043     HttpServletRequest* _getHttpServletRequest() {
00044         return dynamic_cast<HttpServletRequest*>(getRequest());
00045     }
00046     const HttpServletRequest* _getHttpServletRequest() const {
00047         return dynamic_cast<const HttpServletRequest*>(getRequest());
00048     }
00049 
00050 public:
00055     HttpServletRequestWrapper(HttpServletRequest* request)
00056         : ServletRequestWrapper(request)
00057     {}
00058 
00064     virtual std::string getAuthType() const {
00065     return this->_getHttpServletRequest()->getAuthType();
00066     }
00067    
00072     virtual std::auto_ptr< cookielist_t > getCookies() const {
00073     return this->_getHttpServletRequest()->getCookies();
00074     }
00075 
00080     virtual long getDateHeader(const std::string& name) const {
00081     return this->_getHttpServletRequest()->getDateHeader(name);
00082     }
00083             
00088     virtual std::string getHeader(const std::string& name) const {
00089     return this->_getHttpServletRequest()->getHeader(name);
00090     }
00091     
00096     virtual std::auto_ptr< std::vector<std::string> > getHeaders(const std::string& name) const {
00097     return this->_getHttpServletRequest()->getHeaders(name);
00098     }  
00099 
00105     virtual std::auto_ptr< std::vector<std::string> > getHeaderNames() const {
00106     return this->_getHttpServletRequest()->getHeaderNames();
00107     }
00108     
00114      virtual int getIntHeader(const std::string& name) const {
00115     return this->_getHttpServletRequest()->getIntHeader(name);
00116     }
00117     
00122     virtual std::string getMethod() const {
00123     return this->_getHttpServletRequest()->getMethod();
00124     }
00125     
00130     virtual std::string getPathInfo() const {
00131     return this->_getHttpServletRequest()->getPathInfo();
00132     }
00133 
00139      virtual std::string getPathTranslated() const {
00140     return this->_getHttpServletRequest()->getPathTranslated();
00141     }
00142 
00147     virtual std::string getContextPath() const {
00148     return this->_getHttpServletRequest()->getContextPath();
00149     }
00150     
00155     virtual std::string getQueryString() const {
00156     return this->_getHttpServletRequest()->getQueryString();
00157     }
00158     
00163     virtual std::string getRemoteUser() const {
00164     return this->_getHttpServletRequest()->getRemoteUser();
00165     }
00166     
00167  
00172     virtual bool isUserInRole(const std::string& role) const {
00173     return this->_getHttpServletRequest()->isUserInRole(role);
00174     }
00175 
00180     virtual std::string getRequestedSessionId() const {
00181     return this->_getHttpServletRequest()->getRequestedSessionId();
00182     }
00183     
00188     virtual std::string getRequestURI() const {
00189     return this->_getHttpServletRequest()->getRequestURI();
00190     }
00195     virtual std::string getRequestURL() const {
00196     return this->_getHttpServletRequest()->getRequestURL();
00197     }
00198     
00199     
00204     virtual std::string getServletPath() const {
00205     return this->_getHttpServletRequest()->getServletPath();
00206     }
00207     
00208     
00213     virtual HttpSession* getSession(bool create = true) {
00214     return this->_getHttpServletRequest()->getSession(create);
00215     }
00216 
00222     virtual bool isRequestedSessionIdValid() const {
00223     return this->_getHttpServletRequest()->isRequestedSessionIdValid();
00224     }
00225 
00230     virtual bool isRequestedSessionIdFromCookie() const {
00231     return this->_getHttpServletRequest()->isRequestedSessionIdFromCookie();
00232     }
00233     
00238     virtual bool isRequestedSessionIdFromURL() const {
00239     return this->_getHttpServletRequest()->isRequestedSessionIdFromURL();
00240     }
00241     virtual UploadedFile* getUploadedFile(const std::string& name) {
00242     return this->_getHttpServletRequest()->getUploadedFile(name);
00243     }
00244 
00245 };
00246 
00247 }
00248 #endif

SourceForge.net Logo