java - Rapidoid. How to return response from lambda without rendering? -


i need return response lambda without additional rendering. tried this:

on.post("/locations/{id:\\d+}").serve((integer id, req req, resp resp) -> {     if (!storageservice.locationispresent(id)) {         return resp.code(404).json("location not found!");     }     try {         string request = new string(req.body());         location location = mapper.readvalue(request, location.class);         storageservice.updatelocation(id, location.getcountry(), location.getcity(), location.getplace(), location.getdistance() );     } catch (exception ex) {         return resp.code(400).json("bad request!");     }     return resp.code(200).body(empty_resp); }); 

but result getting exception:

error | 20/aug/2017 14:19:53:460 | executor2 | org.rapidoid.http.impl.lowlevel.lowlevelhttpio | error occurred when handling request! | error = java.lang.runtimeexception: com.fasterxml.jackson.databind.jsonmappingexception: no serializer found class org.rapidoid.http.impl.respimpl , no properties discovered create beanserializer (to avoid exception, disable serializationfeature.fail_on_empty_beans) java.lang.runtimeexception: com.fasterxml.jackson.databind.jsonmappingexception: no serializer found class org.rapidoid.http.impl.respimpl , no properties discovered create beanserializer (to avoid exception, disable serializationfeature.fail_on_empty_beans) 

please tell me how correctly.

and know how configure server faster response large number of requests per second. since in case slow.

thank in advance!

try configure mapper following, objectmapper mapper = new objectmapper(); mapper.setvisibility(propertyaccessor.field, visibility.any); here info on problem, http://www.baeldung.com/jackson-exception


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -