Frequently Asked Questions - geronimo-iia/restexpress GitHub Wiki

Q. My service is simply returning a string in the body, but the response shows up as a quoted string. What gives?

A. RestExpress, by default, will serialize the response body into JSON format--which is why you're seeing the quotes be added. To eliminate serialization for that route, simply add the .noSerialization() option to the route DSL. For example:

server.uri("/example/route", controller)
    .action("returnString", HttpMethod.GET)
    .noSerialization();

Q. Why doesn't RestExpress support multi-part file uploads?

A. RestExpress is built on Netty 3.6.x, which at present doesn't auto-magically support multi-part uploads in its HTTP codec. However, RestExpress users have had success with creating a controller that processes the request body (via request.getBody()) ChannelBuffer and parses the results as a multi-part upload.

Q. Does RestExpress support performing asynchronous handling of controller logic?

A. In a word, no. Most Java libraries are currently of the blocking nature. For example, calls to a back-end database in your controller, will block the thread. So RestExpress is designed to support blocking operations in controllers by wrapping them in an "Executor." This enables configuration of the Executor pool on a server-by-server basis depending on how many blocking operations the server can handle at once (see RestExpress.setExecutorThreadCount(int)).

If, however, you desire to utilize non-blocking, callback-based controllers, that's fine too. You can eliminate the Executor thread pool (the default) and utilize non-blocking operations or callbacks in your controllers. RestExpress uses non-blocking IO to write the response back to the client.