QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | List of all members
QgsFcgiServerResponse Class Reference

Class defining fcgi response. More...

#include <qgsfcgiserverresponse.h>

Inheritance diagram for QgsFcgiServerResponse:
Inheritance graph
[legend]

Public Member Functions

 QgsFcgiServerResponse (QgsServerRequest::Method method=QgsServerRequest::GetMethod)
 Constructor for QgsFcgiServerResponse. More...
 
void clear () override
 Reset all headers and content for this response. More...
 
QByteArray data () const override
 Gets the data written so far. More...
 
void finish () override
 Finish the response, ending the transaction. More...
 
void flush () override
 Flushes the current output buffer to the network. More...
 
QString header (const QString &key) const override
 Returns the header value. More...
 
QMap< QString, QString > headers () const override
 Returns the header value. More...
 
bool headersSent () const override
 Returns true if the headers have already been sent. More...
 
QIODevice * io () override
 Returns the underlying QIODevice. More...
 
void removeHeader (const QString &key) override
 Clear header Undo a previous 'setHeader' call. More...
 
void sendError (int code, const QString &message) override
 Send error This method delegates error handling at the server level. More...
 
void setDefaultHeaders ()
 Set the default headers. More...
 
void setHeader (const QString &key, const QString &value) override
 Set Header entry Add Header entry to the response Note that it is usually an error to set Header after data have been sent through the wire. More...
 
void setStatusCode (int code) override
 Set the http status code. More...
 
int statusCode () const override
 Returns the http status code. More...
 
void truncate () override
 Truncate data. More...
 
- Public Member Functions inherited from QgsServerResponse
 QgsServerResponse ()=default
 constructor More...
 
virtual ~QgsServerResponse ()=default
 destructor More...
 
virtual void clear ()=0
 Reset all headers and content for this response. More...
 
virtual QByteArray data () const =0
 Gets the data written so far. More...
 
virtual void finish () SIP_THROW(QgsServerException)
 Finish the response, ending the transaction. More...
 
virtual void flush () SIP_THROW(QgsServerException)
 Flushes the current output buffer to the network. More...
 
virtual QString header (const QString &key) const =0
 Returns the header value. More...
 
virtual QMap< QString, QString > headers () const =0
 Returns the header value. More...
 
virtual bool headersSent () const =0
 Returns true if the headers have already been sent. More...
 
virtual QIODevice * io ()=0
 Returns the underlying QIODevice. More...
 
virtual void removeHeader (const QString &key)=0
 Clear header Undo a previous 'setHeader' call. More...
 
virtual void sendError (int code, const QString &message)=0
 Send error This method delegates error handling at the server level. More...
 
virtual void setHeader (const QString &key, const QString &value)=0
 Set Header entry Add Header entry to the response Note that it is usually an error to set Header after data have been sent through the wire. More...
 
virtual void setStatusCode (int code)=0
 Set the http status code. More...
 
virtual int statusCode () const =0
 Returns the http status code. More...
 
virtual void truncate ()=0
 Truncate data. More...
 
virtual qint64 write (const char *data)
 Writes at most maxSize bytes of data. More...
 
virtual qint64 write (const char *data, qint64 maxsize)
 Writes at most maxSize bytes of data. More...
 
virtual qint64 write (const QByteArray &byteArray)
 Write chunk of data This is a convenient method that will write directly to the underlying I/O device. More...
 
virtual void write (const QgsServerException &ex)
 Write server exception. More...
 
virtual void write (const QString &data)
 Write string This is a convenient method that will write directly to the underlying I/O device. More...
 
virtual qint64 write (std::string data)
 Writes at most maxSize bytes of data. More...
 

Detailed Description

Class defining fcgi response.

Since
QGIS 3.0

Definition at line 36 of file qgsfcgiserverresponse.h.

Constructor & Destructor Documentation

◆ QgsFcgiServerResponse()

QgsFcgiServerResponse::QgsFcgiServerResponse ( QgsServerRequest::Method  method = QgsServerRequest::GetMethod)

Constructor for QgsFcgiServerResponse.

Parameters
methodThe HTTP method (Get by default)

Definition at line 30 of file qgsfcgiserverresponse.cpp.

Member Function Documentation

◆ clear()

void QgsFcgiServerResponse::clear ( )
overridevirtual

Reset all headers and content for this response.

Implements QgsServerResponse.

Definition at line 143 of file qgsfcgiserverresponse.cpp.

◆ data()

QByteArray QgsFcgiServerResponse::data ( ) const
overridevirtual

Gets the data written so far.

This is implementation dependent: some implementations may not give access to the underlying and return an empty array.

Note that each call to 'flush' may empty the buffer and in case of streaming process you may get partial content

Implements QgsServerResponse.

Definition at line 154 of file qgsfcgiserverresponse.cpp.

◆ finish()

void QgsFcgiServerResponse::finish ( )
overridevirtual

Finish the response, ending the transaction.

The default implementation does nothing.

Reimplemented from QgsServerResponse.

Definition at line 85 of file qgsfcgiserverresponse.cpp.

◆ flush()

void QgsFcgiServerResponse::flush ( )
overridevirtual

Flushes the current output buffer to the network.

'flush()' may be called multiple times. For HTTP transactions headers will be written on the first call to 'flush()'. The default implementation does nothing.

Reimplemented from QgsServerResponse.

Definition at line 104 of file qgsfcgiserverresponse.cpp.

◆ header()

QString QgsFcgiServerResponse::header ( const QString &  key) const
overridevirtual

Returns the header value.

Implements QgsServerResponse.

Definition at line 47 of file qgsfcgiserverresponse.cpp.

◆ headers()

QMap< QString, QString > QgsFcgiServerResponse::headers ( ) const
inlineoverridevirtual

Returns the header value.

Implements QgsServerResponse.

Definition at line 52 of file qgsfcgiserverresponse.h.

◆ headersSent()

bool QgsFcgiServerResponse::headersSent ( ) const
overridevirtual

Returns true if the headers have already been sent.

Implements QgsServerResponse.

Definition at line 52 of file qgsfcgiserverresponse.cpp.

◆ io()

QIODevice * QgsFcgiServerResponse::io ( )
overridevirtual

Returns the underlying QIODevice.

Implements QgsServerResponse.

Definition at line 80 of file qgsfcgiserverresponse.cpp.

◆ removeHeader()

void QgsFcgiServerResponse::removeHeader ( const QString &  key)
overridevirtual

Clear header Undo a previous 'setHeader' call.

Implements QgsServerResponse.

Definition at line 37 of file qgsfcgiserverresponse.cpp.

◆ sendError()

void QgsFcgiServerResponse::sendError ( int  code,
const QString &  message 
)
overridevirtual

Send error This method delegates error handling at the server level.

This is different from calling setReturnCode() which let you return a specific response body. Calling sendError() will end the transaction and any attempt to write data or set headers will be an error.

Parameters
codeHHTP return code value
messageAn informative error message

Implements QgsServerResponse.

Definition at line 65 of file qgsfcgiserverresponse.cpp.

◆ setDefaultHeaders()

void QgsFcgiServerResponse::setDefaultHeaders ( )

Set the default headers.

Definition at line 167 of file qgsfcgiserverresponse.cpp.

◆ setHeader()

void QgsFcgiServerResponse::setHeader ( const QString &  key,
const QString &  value 
)
overridevirtual

Set Header entry Add Header entry to the response Note that it is usually an error to set Header after data have been sent through the wire.

Implements QgsServerResponse.

Definition at line 42 of file qgsfcgiserverresponse.cpp.

◆ setStatusCode()

void QgsFcgiServerResponse::setStatusCode ( int  code)
overridevirtual

Set the http status code.

Parameters
codeHTTP status code value

Implements QgsServerResponse.

Definition at line 57 of file qgsfcgiserverresponse.cpp.

◆ statusCode()

int QgsFcgiServerResponse::statusCode ( ) const
inlineoverridevirtual

Returns the http status code.

Implements QgsServerResponse.

Definition at line 58 of file qgsfcgiserverresponse.h.

◆ truncate()

void QgsFcgiServerResponse::truncate ( )
overridevirtual

Truncate data.

Clear internal buffer

Implements QgsServerResponse.

Definition at line 160 of file qgsfcgiserverresponse.cpp.


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