CPPSERV


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

ServletOutputStream.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004-2006 by Ilya A. Volynets-Evenbakh                  *
00003  *   ilya@total-knowledge.com                                              *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #include <ServletOutputStream.h>
00021 #include <HttpServletResponseImpl.h>
00022 
00023 namespace container {
00024 
00025 ServletOutputStream::ServletOutputStream(Connection& con, HttpServletResponseImpl& resp)
00026  : std::ostream(&m_buf)
00027  , m_buf(con,resp)
00028 {
00029 }
00030 
00031 
00032 ServletOutputStream::~ServletOutputStream()
00033 {
00034 }
00035 
00036 void ServletOutputStream::setBufferSize(size_t)
00037 {
00041     return;
00042 }
00043 size_t ServletOutputStream::getBufferSize()
00044 {
00045     return m_buf.getBufSize();
00046 }
00047 
00048 }
00049 
00050 
00054 std::streambuf* container::ServletOutputStreamBuf::setbuf(char* s,std::streamsize n)
00055 {
00056     m_bufSz=n;
00057     return m_con.setbuf(s,n);
00058 }
00059 
00063 int container::ServletOutputStreamBuf::sync()
00064 {
00065     if(!m_resp.isCommitted())
00066         m_resp.sendHeaders(m_con);
00067     return m_con.sync();
00068 }
00069 
00070 int container::ServletOutputStreamBuf::pbackfail()
00071 {
00072     if(!m_resp.isCommitted())
00073         m_resp.sendHeaders(m_con);
00074     return m_con.pbackfail();
00075 }
00076 
00077 std::streamsize container::ServletOutputStreamBuf::xsputn(const char* s,std::streamsize n)
00078 {
00079     if(!m_resp.isCommitted())
00080         m_resp.sendHeaders(m_con);
00081     return m_con.xsputn(s,n);
00082 }
00083 
00084 int container::ServletOutputStreamBuf::overflow(int c)
00085 {
00086     if(!m_resp.isCommitted())
00087         m_resp.sendHeaders(m_con);
00088     return m_con.overflow(c);
00089 }

SourceForge.net Logo