Class: QgsBufferServerResponse

Defines a buffered server response.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.server.QgsBufferServerResponse

Base classes

QgsServerResponse

Abstract Methods

addHeader

Add a header value for the given key, without replacing any existing value for the same key Add Header entry to the response

fullHeader

Returns all the values for a header key

fullHeaders

Returns all the headers

header

Returns a single header value, or an empty string if the header is not set.

headers

Returns all the headers as a map: only the last value is returned if multiple values are set for the same header name.

removeHeader

Clear header Undo a previous 'setHeader' call

sendError

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

setHeader

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

Methods

body

Returns body

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsBufferServerResponse. See the FAQ for more details.

finish

Finish the response, ending the transaction

flush

Flushes the current output buffer to the network

class qgis.server.QgsBufferServerResponse[source]

Bases: QgsServerResponse

abstract addHeader(self, key: str | None, value: str | None)[source]

Add a header value for the given key, without replacing any existing value for the same key Add Header entry to the response

Note

that it is usually an error to set Header after data have been sent through the wire

Added in version 4.2.

Parameters:
body(self) QByteArray[source]

Returns body

Return type:

QByteArray

virtual finish(self)[source]

Finish the response, ending the transaction

virtual flush(self)[source]

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()’.

abstract fullHeader(self, key: str | None) list[str]

Returns all the values for a header key

Parameters:

key (Optional[str])

Return type:

list[str]

abstract fullHeaders(self) Any

Returns all the headers

Return type:

Any

abstract header(self, key: str | None) str[source]

Returns a single header value, or an empty string if the header is not set. If multiple values are set for the same header, only the last value is returned.

Deprecated since version 4.2: Use fullHeader() instead.

Parameters:

key (Optional[str])

Return type:

str

abstract headers(self) dict[str, str]

Returns all the headers as a map: only the last value is returned if multiple values are set for the same header name.

Deprecated since version 4.2: Use fullHeaders() instead.

Return type:

dict[str, str]

abstract removeHeader(self, key: str | None)[source]

Clear header Undo a previous ‘setHeader’ call

Parameters:

key (Optional[str])

abstract sendError(self, code: int, message: str | None)[source]

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:
  • code (int) – HHTP return code value

  • message (Optional[str]) – An informative error message

abstract setHeader(self, key: str | None, value: str | None)[source]

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

Parameters: