OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimHttpResponse.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // License: See top level LICENSE.txt file
4 //
5 // Author: Garrett Potts
6 //
7 // Description: This is an initial cut at an http response object. The HttpResponse is
8 // returned from the HttpRequest base object.
9 //----------------------------------------------------------------------------
10 // $Id$
11 #ifndef ossimHttpResponse_HEADER
12 #define ossimHttpResponse_HEADER
13 
14 #include <iostream>
18 #include <ossim/base/ossimString.h>
20 
22 {
23 public:
25  :m_headerStream(&m_headerBuffer),
26  m_bodyStream(&m_bodyBuffer)
27  {
28  clear();
29  }
30 
31  ossimByteStreamBuffer& headerBuffer(){return m_headerBuffer;}
32  const ossimByteStreamBuffer& headerBuffer()const{return m_headerBuffer;}
33  ossimByteStreamBuffer& bodyBuffer(){return m_bodyBuffer;}
34  const ossimByteStreamBuffer& bodyBuffer()const{return m_bodyBuffer;}
35 
36  std::iostream& headerStream(){return m_headerStream;}
37  std::iostream& bodyStream(){return m_bodyStream;}
38 
40  {return static_cast<std::istream*>(&m_bodyStream);}
41 
45  virtual void clear()
46  {
47  m_headerBuffer.clear();
48  m_bodyBuffer.clear();
49  m_headerKwl.clear();
50  m_statusLine = "";
51  m_statusCode = 200;
52  }
53 
58  void convertHeaderStreamToKeywordlist();
59  virtual void clearLastError(){m_statusCode = 200;m_statusLine="";}
60 
61  virtual ossimString getLastError()const{return ((m_statusCode == 200)?ossimString(""):m_statusLine);}
62 
63  ossimKeywordlist& headerKwl(){return m_headerKwl;}
64  const ossimKeywordlist& headerKwl()const{return m_headerKwl;}
65  ossim_int64 getContentLength()const;
66  ossimString getHeaderValue(const ossimString& headerName)const;
67  const ossimString& statusLine()const{return m_statusLine;}
68  ossim_uint32 getStatusCode()const{return m_statusCode;}
69 
70 protected:
78 
80 };
81 #endif
82 
ossim_uint32 getStatusCode() const
virtual std::istream * getInputStream()
This might have to change in the future if we start doing other protocols such as ftp scp...
Represents serializable keyword/value map.
const ossimByteStreamBuffer & headerBuffer() const
ossim_uint32 m_statusCode
ossimKeywordlist & headerKwl()
std::iostream & headerStream()
ossimKeywordlist m_headerKwl
virtual void clear()
Clears out the Response and prepares for a new response.
ossimByteStreamBuffer m_headerBuffer
unsigned int ossim_uint32
std::iostream m_bodyStream
const ossimString & statusLine() const
ossimByteStreamBuffer & bodyBuffer()
ossimByteStreamBuffer & headerBuffer()
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
std::iostream & bodyStream()
ossimByteStreamBuffer m_bodyBuffer
#define OSSIM_DLL
ossimString m_statusLine
long long ossim_int64
const ossimByteStreamBuffer & bodyBuffer() const
std::basic_iostream< char > iostream
Base class for char mixed input and output streams.
Definition: ossimIosFwd.h:26
virtual ossimString getLastError() const
const ossimKeywordlist & headerKwl() const
std::iostream m_headerStream
virtual void clearLastError()