QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
QgsFilterResponseDecorator::start
void start() SIP_THROW(QgsServerException)
Call filters requestReady() method.
Definition: qgsfilterresponsedecorator.cpp:30
QgsServerResponse::flush
virtual void flush() SIP_THROW(QgsServerException)
Flushes the current output buffer to the network.
Definition: qgsserverresponse.cpp:73
QgsFilterResponseDecorator::flush
void flush() override
Flushes the current output buffer to the network.
Definition: qgsfilterresponsedecorator.cpp:55
QgsFilterResponseDecorator::finish
void finish() override
Finish the response, ending the transaction.
Definition: qgsfilterresponsedecorator.cpp:41
QgsFilterResponseDecorator::QgsFilterResponseDecorator
QgsFilterResponseDecorator(QgsServerFiltersMap filters, QgsServerResponse &response)
Constructor for QgsFilterResponseDecorator.
Definition: qgsfilterresponsedecorator.cpp:24
QgsServerResponse::finish
virtual void finish() SIP_THROW(QgsServerException)
Finish the response, ending the transaction.
Definition: qgsserverresponse.cpp:68
QgsServerFiltersMap
QMultiMap< int, QgsServerFilter * > QgsServerFiltersMap
Definition: qgsserverfilter.h:88
qgsserverexception.h
QgsServerResponse
Definition: qgsserverresponse.h:43
qgsfilterresponsedecorator.h