HttpServletResponseWrapper.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _HTTP_SERVLET_RESPONSE_WRAPPER_
00018 #define _HTTP_SERVLET_RESPONSE_WRAPPER_
00019
00020 #include <servlet/ServletResponseWrapper.h>
00021 #include <servlet/HttpServletResponse.h>
00022
00023 namespace servlet
00024 {
00025
00042 class HttpServletResponseWrapper:
00043 public ServletResponseWrapper, public HttpServletResponse
00044 {
00045 private:
00046 HttpServletResponse* _getHttpServletResponse() {
00047 return dynamic_cast<HttpServletResponse*>(getResponse());
00048 }
00049 const HttpServletResponse* _getHttpServletResponse() const {
00050 return dynamic_cast<const HttpServletResponse*>(getResponse());
00051 }
00052
00053 public:
00058 HttpServletResponseWrapper(HttpServletResponse* response)
00059 : ServletResponseWrapper(response)
00060 {}
00061
00066 virtual void addCookie(const Cookie& cookie) {
00067 this->_getHttpServletResponse()->addCookie(cookie);
00068 }
00069
00074 virtual bool containsHeader(const std::string& name) const {
00075 return this->_getHttpServletResponse()->containsHeader(name);
00076 }
00077
00082 virtual std::string encodeURL(const std::string& url) {
00083 return this->_getHttpServletResponse()->encodeURL(url);
00084 }
00085
00090 virtual std::string encodeRedirectURL(const std::string& url) {
00091 return this->_getHttpServletResponse()->encodeRedirectURL(url);
00092 }
00093
00098 virtual void sendError(int sc, const std::string& msg) {
00099 this->_getHttpServletResponse()->sendError(sc, msg);
00100 }
00101
00107 virtual void sendError(int sc) {
00108 this->_getHttpServletResponse()->sendError(sc);
00109 }
00110
00115 virtual void sendRedirect(const std::string& location) {
00116 this->_getHttpServletResponse()->sendRedirect(location);
00117 }
00118
00123 virtual void setDateHeader(const std::string& name, long date) {
00124 this->_getHttpServletResponse()->setDateHeader(name, date);
00125 }
00126
00131 virtual void addDateHeader(const std::string& name, long date) {
00132 this->_getHttpServletResponse()->addDateHeader(name, date);
00133 }
00134
00139 virtual void setHeader(const std::string& name, const std::string& value) {
00140 this->_getHttpServletResponse()->setHeader(name, value);
00141 }
00142
00147 virtual void addHeader(const std::string& name, const std::string& value) {
00148 this->_getHttpServletResponse()->addHeader(name, value);
00149 }
00150
00155 virtual void setIntHeader(const std::string& name, int value) {
00156 this->_getHttpServletResponse()->setIntHeader(name, value);
00157 }
00158
00163 virtual void addIntHeader(const std::string& name, int value) {
00164 this->_getHttpServletResponse()->addIntHeader(name, value);
00165 }
00166
00173 virtual void setStatus(int sc) {
00174 this->_getHttpServletResponse()->setStatus(sc);
00175 }
00176 };
00177 }
00178
00179 #endif