CPPSERV


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

ServletResponseWrapper.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 _SERVLET_RESPONSE_WRAPPER_H_
00018 #define _SERVLET_RESPONSE_WRAPPER_H_
00019 
00020 #include <servlet/ServletResponse.h>
00021 #include <servlet/IllegalArgumentException.h>
00022 
00023 namespace servlet
00024 {
00025 
00041 class ServletResponseWrapper: virtual public ServletResponse
00042 {
00043 private:
00044     ServletResponse* response;
00045 public:
00050     ServletResponseWrapper(ServletResponse* response) {
00051         if (response == 0) {
00052             throw IllegalArgumentException("Response cannot be null");
00053         }
00054         this->response = response;
00055     }
00056 
00061     virtual ServletResponse* getResponse() {
00062         return response;
00063     }
00064     virtual const ServletResponse* getResponse() const {
00065         return response;
00066     }
00067 
00073     virtual void setResponse(ServletResponse* response) {
00074         if (response == 0) {
00075             throw IllegalArgumentException("Response cannot be null");
00076         }
00077         this->response = response;
00078     }
00079 
00087     virtual void setCharacterEncoding(const std::string& charset) {
00088         response->setCharacterEncoding(charset);
00089     }
00090 
00096     virtual std::ostream& getOutputStream() {
00097         return this->response->getOutputStream();
00098     }
00099       
00104     virtual void setContentLength(int len) {
00105         this->response->setContentLength(len);
00106     }
00107 
00113     virtual void setContentType(const std::string& type) {
00114         this->response->setContentType(type);
00115     }
00116 
00124     virtual std::string getContentType() {
00125         return this->response->getContentType();
00126     }
00127 
00132     virtual void setBufferSize(int size) {
00133         this->response->setBufferSize(size);
00134     }
00135 
00140     virtual int getBufferSize() {
00141         return this->response->getBufferSize();
00142     }
00143 
00149     virtual void flushBuffer() {
00150         this->response->flushBuffer();
00151     }
00152 
00157     virtual bool isCommitted() {
00158         return this->response->isCommitted();
00159     }
00160 
00166     virtual void reset() {
00167         this->response->reset();
00168     }
00169 
00175     virtual std::string getCharacterEncoding() {
00176         return this->response->getCharacterEncoding();
00177     }
00178 
00179 };
00180 
00181 }
00182 
00183 #endif

SourceForge.net Logo