def pRarams(context, flute, request): response = LinkedHashMap() text = request.path() status = None if request.queryParams().size() != 0: text = text + "?" params = request.queryParams().toSingleValueMap() theFirst = True for key in params.keySet(): if theFirst != True: text = text + "&" text = text + key + "=" + params.get(key) theFirst = False status = 200 else: text = "there are no params received" status = 422 response.put('text', text) response.put('status', status) return ServerResponse.status(HttpStatus.valueOf(status))\ .body(Mono.just(text), String)
def handlerForApplicationFormUrlencoded(context, flute, request): data = request.body(BodyExtractors.toFormData()).block() result = 'param1=' param1 = data['param1'] for val in param1: result = result + val + "," result = result + 'param2=' param2 = data['param2'] for val in param2: result = result + val + "," return ServerResponse.ok().body(Mono.just(result), String)
def postorder(context, flute, request): doc = request.bodyToMono(dict).block() basic_operations.post_order(context, doc) return ServerResponse.ok().body(Mono.just('OK'), str)
def foo(context, flute, request): report = basic_operations.get_aggregate_report(context) return ServerResponse.ok().body(Mono.just(report), report.__class__)
def afterFilter(context, flute, request): data = request.attributes().get('data') data['foo'] = data['foo'] + 1 return ServerResponse.ok().body(Mono.just(data), data.__class__)
def handlerForDoubleBeforeFilter(context, flute, request): data = request.attributes().get('data') data.add(3) return ServerResponse.ok().body(Mono.just(data), data.__class__)
def postWithJsonBody(context, flute, request): dto = request.bodyToMono(dict).block() dto['numb'] = dto['numb'] + 1 return ServerResponse.ok().body(Mono.just(dto), dto.__class__)
def handlerForTestReturnFromHandler(context, flute, request): dto = {"foo": 1} return ServerResponse.ok().body(Mono.just(dto), dto.__class__)
def after2TestReturnFromAfter(context, flute, request): dto = {"foo": 2} return ServerResponse.ok().body(Mono.just(dto), dto.__class__)
def fluteparam(context, flute, request): sid = flute.sourceId return ServerResponse.ok().body(Mono.just(sid), String)
def beforeTestReturnFromBefore(context, flute, request): dto = {"foo": 1} return ServerResponse.ok().body(Mono.just(dto), dto.__class__)
def handlerForCustomCelestaUserIdFilter(context, flute, request): dto = {"userId": context.getUserId()} return ServerResponse.ok().body(Mono.just(dto), dto.__class__)
def doubleAfterFilter2(context, flute, request): data = request.attributes().get('data') data.add(3) return ServerResponse.ok().body(Mono.just(data), data.__class__)
def foo(context, flute, request): dto = {"foo": 1, "bar": 2} return ServerResponse.ok().body(Mono.just(dto), dto.__class__)