iipsrv 1.2
iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images
IIPResponse Class Reference

Class to handle non-image IIP responses including errors. More...

#include <IIPResponse.h>

Public Member Functions

 IIPResponse ()
 Constructor.
 
void setProtocol (const std::string &p)
 Set the IIP protocol version.
 
void setMimeType (const std::string &m)
 Set the Mime Type.
 
void setLastModified (const std::string &m)
 Set the Last Modified header.
 
void setContentDisposition (const std::string &name, const std::string &type="inline")
 Set Content Disposition header.
 
void addResponse (const std::string &r)
 Add a response string.
 
void addResponse (const char *c)
 Add a response string.
 
void addResponse (const char *c, int a)
 Add a response string.
 
void addResponse (std::string c, const std::string &a)
 Add a response string.
 
void addResponse (const char *c, int a, int b)
 Add a response string.
 
void setError (const std::string &code, const std::string &arg)
 Set an error.
 
void setCORS (const std::string &c)
 Set CORS setting.
 
std::string getCORS ()
 Get CORS setting.
 
void setCacheControl (const std::string &c)
 Set Cache-Control value.
 
void setCachability (bool cachable)
 Set whether the response should be cached.
 
bool cachable ()
 Is response cachable?
 
std::string getCacheControl ()
 Get Cache-Control value.
 
void setStatus (const std::string &s)
 Set HTTP status code.
 
std::string formatResponse ()
 Get a formatted string to send back.
 
bool isSet ()
 Indicate whether this object has had any arguments passed to it.
 
bool errorIsSet ()
 Indicate whether we have an error message.
 
void setImageSent ()
 Set the sent flag indicating that some sort of response has been sent.
 
bool imageSent ()
 Indicate whether a response has been sent.
 
std::string getAdvert ()
 Display our advertising banner ;-)
 
std::string createHTTPHeader (const std::string &mimeType, const std::string &timeStamp, unsigned int contentLength=0)
 Convenience function to generate HTTP header fields.
 

Detailed Description

Class to handle non-image IIP responses including errors.

Member Function Documentation

◆ addResponse() [1/5]

void IIPResponse::addResponse ( const char *  c)

Add a response string.

Parameters
cresponse string

◆ addResponse() [2/5]

void IIPResponse::addResponse ( const char *  c,
int  a 
)

Add a response string.

Parameters
cresponse string
ainteger value

◆ addResponse() [3/5]

void IIPResponse::addResponse ( const char *  c,
int  a,
int  b 
)

Add a response string.

Parameters
cresponse string
ainteger value
banother integer value

◆ addResponse() [4/5]

void IIPResponse::addResponse ( const std::string &  r)

Add a response string.

Parameters
rresponse string

◆ addResponse() [5/5]

void IIPResponse::addResponse ( std::string  c,
const std::string &  a 
)

Add a response string.

Parameters
cresponse string
astring reply

◆ cachable()

bool IIPResponse::cachable ( )
inline

Is response cachable?

Returns
Whether response should be cached

Referenced by setCachability().

◆ createHTTPHeader()

std::string IIPResponse::createHTTPHeader ( const std::string &  mimeType,
const std::string &  timeStamp,
unsigned int  contentLength = 0 
)

Convenience function to generate HTTP header fields.

Parameters
mimeTypeMIME type of output
timeStampformatted timestamp
contentLengthoptional Content-Length value

◆ getAdvert()

std::string IIPResponse::getAdvert ( )

Display our advertising banner ;-)

Returns
HTML string

◆ setCachability()

void IIPResponse::setCachability ( bool  cachable)
inline

Set whether the response should be cached.

Parameters
cachableWhether this reponse should be cached or not

References cachable().

◆ setCacheControl()

void IIPResponse::setCacheControl ( const std::string &  c)
inline

Set Cache-Control value.

Parameters
cCache-Control setting

◆ setContentDisposition()

void IIPResponse::setContentDisposition ( const std::string &  name,
const std::string &  type = "inline" 
)
inline

Set Content Disposition header.

Parameters
nameFile name for Content-disposition header

◆ setCORS()

void IIPResponse::setCORS ( const std::string &  c)
inline

Set CORS setting.

Parameters
csetting

◆ setError()

void IIPResponse::setError ( const std::string &  code,
const std::string &  arg 
)

Set an error.

Parameters
codeerror code
argthe argument supplied by the client

◆ setLastModified()

void IIPResponse::setLastModified ( const std::string &  m)
inline

Set the Last Modified header.

Parameters
mLast modified date as a HTTP RFC 1123 formatted timestamp

◆ setMimeType()

void IIPResponse::setMimeType ( const std::string &  m)
inline

Set the Mime Type.

Parameters
mMime Type

◆ setProtocol()

void IIPResponse::setProtocol ( const std::string &  p)
inline

Set the IIP protocol version.

Parameters
pIIP protocol version

◆ setStatus()

void IIPResponse::setStatus ( const std::string &  s)
inline

Set HTTP status code.

Parameters
sHTTP status code string

The documentation for this class was generated from the following file: