00001 /* 00002 * ==================================================================== 00003 * 00004 * The Apache Software License, Version 1.1 00005 * 00006 * Copyright (c) 1999-2001 The Apache Software Foundation. All rights 00007 * reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * 00016 * 2. Redistributions in binary form must reproduce the above copyright 00017 * notice, this list of conditions and the following disclaimer in 00018 * the documentation and/or other materials provided with the 00019 * distribution. 00020 * 00021 * 3. The end-user documentation included with the redistribution, if 00022 * any, must include the following acknowlegement: 00023 * "This product includes software developed by the 00024 * Apache Software Foundation (http://www.apache.org/)." 00025 * Alternately, this acknowlegement may appear in the software itself, 00026 * if and wherever such third-party acknowlegements normally appear. 00027 * 00028 * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software 00029 * Foundation" must not be used to endorse or promote products derived 00030 * from this software without prior written permission. For written 00031 * permission, please contact apache@apache.org. 00032 * 00033 * 5. Products derived from this software may not be called "Apache" 00034 * nor may "Apache" appear in their names without prior written 00035 * permission of the Apache Group. 00036 * 00037 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00038 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00039 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00040 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00041 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00042 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00043 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00044 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00045 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00046 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00047 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00048 * SUCH DAMAGE. 00049 * ==================================================================== 00050 * 00051 */ 00052 00053 00054 #include "NoBodyResponse.h" 00055 00056 namespace servlet 00057 { 00058 //-------------------------------------------------------------------- 00059 00060 NoBodyResponse::NoBodyResponse(HttpServletResponse & r) 00061 : resp(r) 00062 { 00063 } 00064 00065 //-------------------------------------------------------------------- 00066 00067 void NoBodyResponse::setContentLength() 00068 { 00069 if (!didSetContentLength) 00070 resp.setContentLength(no_body.get_context_length()); 00071 } 00072 00073 //-------------------------------------------------------------------- 00074 00075 void NoBodyResponse::setContentLength(int len) 00076 { 00077 resp.setContentLength(len); 00078 didSetContentLength = true; 00079 } 00080 00081 //-------------------------------------------------------------------- 00082 00083 void NoBodyResponse::setCharacterEncoding(const std::string & charset) 00084 { 00085 resp.setCharacterEncoding(charset); 00086 } 00087 00088 //-------------------------------------------------------------------- 00089 00090 void NoBodyResponse::setContentType(const std::string & type) 00091 { 00092 resp.setContentType(type); 00093 } 00094 00095 //-------------------------------------------------------------------- 00096 00097 std::string NoBodyResponse::getContentType() 00098 { 00099 return resp.getContentType(); 00100 } 00101 00102 //-------------------------------------------------------------------- 00103 00104 std::ostream& NoBodyResponse::getOutputStream() 00105 { 00106 return no_body; 00107 } 00108 00109 //-------------------------------------------------------------------- 00110 00111 std::string NoBodyResponse::getCharacterEncoding() 00112 { 00113 return resp.getCharacterEncoding(); 00114 } 00115 00116 //-------------------------------------------------------------------- 00117 00118 void NoBodyResponse::setBufferSize(int size) 00119 { 00120 resp.setBufferSize(size); 00121 } 00122 00123 //-------------------------------------------------------------------- 00124 00125 int NoBodyResponse::getBufferSize() 00126 { 00127 return resp.getBufferSize(); 00128 } 00129 00130 //-------------------------------------------------------------------- 00131 00132 void NoBodyResponse::reset() 00133 { 00134 resp.reset(); 00135 } 00136 00137 //-------------------------------------------------------------------- 00138 00139 bool NoBodyResponse::isCommitted() 00140 { 00141 return resp.isCommitted(); 00142 } 00143 00144 //-------------------------------------------------------------------- 00145 00146 void NoBodyResponse::flushBuffer() 00147 { 00148 resp.flushBuffer(); 00149 } 00150 00151 //-------------------------------------------------------------------- 00152 /* 00153 void NoBodyResponse::setLocale(const Locale & loc) 00154 { 00155 resp.setLocale(loc); 00156 } 00157 //-------------------------------------------------------------------- 00158 const Locale & NoBodyResponse::getLocale() 00159 { 00160 return resp.getLocale(); 00161 } 00162 */ 00163 //-------------------------------------------------------------------- 00164 00165 void NoBodyResponse::addCookie(const Cookie & cookie) 00166 { 00167 resp.addCookie(cookie); 00168 } 00169 00170 //-------------------------------------------------------------------- 00171 00172 bool NoBodyResponse::containsHeader(const std::string & name) const 00173 { 00174 return resp.containsHeader(name); 00175 } 00176 00177 //-------------------------------------------------------------------- 00178 00179 void NoBodyResponse::setStatus(int sc) 00180 { 00181 resp.setStatus(sc); 00182 } 00183 00184 //-------------------------------------------------------------------- 00185 00186 void NoBodyResponse::setHeader(const std::string & name, const std::string & value) 00187 { 00188 resp.setHeader(name, value); 00189 } 00190 00191 //-------------------------------------------------------------------- 00192 00193 void NoBodyResponse::setIntHeader(const std::string & name, int value) 00194 { 00195 resp.setIntHeader(name, value); 00196 } 00197 00198 //-------------------------------------------------------------------- 00199 00200 void NoBodyResponse::setDateHeader(const std::string & name, long date) 00201 { 00202 resp.setDateHeader(name, date); 00203 } 00204 00205 //-------------------------------------------------------------------- 00206 00207 void NoBodyResponse::sendError(int sc, const std::string & msg) 00208 { 00209 resp.sendError(sc, msg); 00210 } 00211 00212 //-------------------------------------------------------------------- 00213 00214 void NoBodyResponse::sendError(int sc) 00215 { 00216 resp.sendError(sc); 00217 } 00218 00219 //-------------------------------------------------------------------- 00220 00221 void NoBodyResponse::sendRedirect(const std::string & location) 00222 { 00223 resp.sendRedirect(location); 00224 } 00225 00226 //-------------------------------------------------------------------- 00227 00228 std::string NoBodyResponse::encodeURL(const std::string & url) 00229 { 00230 return resp.encodeURL(url); 00231 } 00232 00233 //-------------------------------------------------------------------- 00234 00235 std::string NoBodyResponse::encodeRedirectURL(const std::string & url) 00236 { 00237 return resp.encodeRedirectURL(url); 00238 } 00239 00240 //-------------------------------------------------------------------- 00241 00242 void NoBodyResponse::addHeader(const std::string & name, const std::string & value) 00243 { 00244 resp.addHeader(name, value); 00245 } 00246 00247 //-------------------------------------------------------------------- 00248 00249 void NoBodyResponse::addDateHeader(const std::string & name, long value) 00250 { 00251 resp.addDateHeader(name, value); 00252 } 00253 00254 //-------------------------------------------------------------------- 00255 00256 void NoBodyResponse::addIntHeader(const std::string & name, int value) 00257 { 00258 resp.addIntHeader(name, value); 00259 } 00260 00261 //-------------------------------------------------------------------- 00262 }