QGIS API Documentation  3.24.2-Tisler (13c1a02865)
qgsfilterresponsedecorator.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfilterresponsedecorator.cpp
3 
4  Define response wrapper for fcgi response
5  -------------------
6  begin : 2017-01-03
7  copyright : (C) 2017 by David Marteau
8  email : david dot marteau at 3liz dot com
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 #include "qgsconfig.h"
22 
24  : mFilters( filters )
25  , mResponse( response )
26 {
27 }
28 
30 {
31 #ifdef HAVE_SERVER_PYTHON_PLUGINS
32  QgsServerFiltersMap::const_iterator filtersIterator;
33  for ( filtersIterator = mFilters.constBegin(); filtersIterator != mFilters.constEnd(); ++filtersIterator )
34  {
35  if ( ! filtersIterator.value()->onRequestReady() )
36  {
37  // stop propagation
38  return;
39  }
40  }
41 #endif
42 }
43 
45 {
46 #ifdef HAVE_SERVER_PYTHON_PLUGINS
47  QgsServerFiltersMap::const_iterator filtersIterator;
48  for ( filtersIterator = mFilters.constBegin(); filtersIterator != mFilters.constEnd(); ++filtersIterator )
49  {
50  if ( ! filtersIterator.value()->onResponseComplete() )
51  {
52  // stop propagation, 'finish' must be called on the wrapped
53  // response
54  break;
55  }
56  }
57 #endif
58  // Will call internal 'flush'
59  mResponse.finish();
60 }
61 
62 
64 {
65 #ifdef HAVE_SERVER_PYTHON_PLUGINS
66  QgsServerFiltersMap::const_iterator filtersIterator;
67 
68  for ( filtersIterator = mFilters.constBegin(); filtersIterator != mFilters.constEnd(); ++filtersIterator )
69  {
70  if ( ! filtersIterator.value()->onSendResponse() )
71  {
72  // Stop propagation
73  return;
74  }
75  }
76 #endif
77  mResponse.flush();
78 }
79 
80 
void flush() override
Flushes the current output buffer to the network.
void finish() override
Finish the response, ending the transaction.
QgsFilterResponseDecorator(QgsServerFiltersMap filters, QgsServerResponse &response)
Constructor for QgsFilterResponseDecorator.
void start() SIP_THROW(QgsServerException)
Call filters requestReady() method.
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
virtual void flush() SIP_THROW(QgsServerException)
Flushes the current output buffer to the network.
virtual void finish() SIP_THROW(QgsServerException)
Finish the response, ending the transaction.
QMultiMap< int, QgsServerFilter * > QgsServerFiltersMap