QGIS API Documentation  3.21.0-Master (909859188c)
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 #include "qgsserverexception.h"
23 
25  : mFilters( filters )
26  , mResponse( response )
27 {
28 }
29 
31 {
32 #ifdef HAVE_SERVER_PYTHON_PLUGINS
33  QgsServerFiltersMap::const_iterator filtersIterator;
34  for ( filtersIterator = mFilters.constBegin(); filtersIterator != mFilters.constEnd(); ++filtersIterator )
35  {
36  filtersIterator.value()->requestReady();
37  }
38 #endif
39 }
40 
42 {
43 
44 #ifdef HAVE_SERVER_PYTHON_PLUGINS
45  QgsServerFiltersMap::const_iterator filtersIterator;
46  for ( filtersIterator = mFilters.constBegin(); filtersIterator != mFilters.constEnd(); ++filtersIterator )
47  {
48  filtersIterator.value()->responseComplete();
49  }
50 #endif
51  // Will call 'flush'
52  mResponse.finish();
53 }
54 
56 {
57 #ifdef HAVE_SERVER_PYTHON_PLUGINS
58  QgsServerFiltersMap::const_iterator filtersIterator;
59  for ( filtersIterator = mFilters.constBegin(); filtersIterator != mFilters.constEnd(); ++filtersIterator )
60  {
61  filtersIterator.value()->sendResponse();
62  }
63 #endif
64  mResponse.flush();
65 }
66 
67 
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