QGIS API Documentation 3.37.0-Master (684a802617f)
Loading...
Searching...
No Matches
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()->onProjectReady() )
51 {
52 // stop propagation
53 return;
54 }
55 }
56#endif
57}
58
60{
61#ifdef HAVE_SERVER_PYTHON_PLUGINS
62 QgsServerFiltersMap::const_iterator filtersIterator;
63 for ( filtersIterator = mFilters.constBegin(); filtersIterator != mFilters.constEnd(); ++filtersIterator )
64 {
65 if ( ! filtersIterator.value()->onResponseComplete() )
66 {
67 // stop propagation, 'finish' must be called on the wrapped
68 // response
69 break;
70 }
71 }
72#endif
73 // Will call internal 'flush'
74 mResponse.finish();
75}
76
77
79{
80#ifdef HAVE_SERVER_PYTHON_PLUGINS
81 QgsServerFiltersMap::const_iterator filtersIterator;
82
83 for ( filtersIterator = mFilters.constBegin(); filtersIterator != mFilters.constEnd(); ++filtersIterator )
84 {
85 if ( ! filtersIterator.value()->onSendResponse() )
86 {
87 // Stop propagation
88 return;
89 }
90 }
91#endif
92 mResponse.flush();
93}
void flush() override
Flushes the current output buffer to the network.
void start()
Call filters requestReady() method.
void finish() override
Finish the response, ending the transaction.
QgsFilterResponseDecorator(QgsServerFiltersMap filters, QgsServerResponse &response)
Constructor for QgsFilterResponseDecorator.
void ready()
Call filters projectReady() method.
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
virtual void flush()
Flushes the current output buffer to the network.
virtual void finish()
Finish the response, ending the transaction.
QMultiMap< int, QgsServerFilter * > QgsServerFiltersMap