private Observable<Void> handleRecommendationsByUserId(HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) {
        System.out.println("HTTP request -> recommendations by user id request: " + request.getPath());
        final String userId = userIdFromPath(request.getPath());
        if (userId == null) {
            response.setStatus(HttpResponseStatus.BAD_REQUEST);
            return response.close();
        }
        if (!userRecommendations.containsKey(userId)) {
            response.setStatus(HttpResponseStatus.NOT_FOUND);
            return response.close();
        }

        StringBuilder builder = new StringBuilder();
        for (String movieId : userRecommendations.get(userId)) {
            System.out.println("    returning: " + movies.get(movieId));
            builder.append(movies.get(movieId)).append('\n');
        }

        ByteBuf byteBuf = UnpooledByteBufAllocator.DEFAULT.buffer();
        byteBuf.writeBytes(builder.toString().getBytes(Charset.defaultCharset()));

        response.write(byteBuf);
        return response.close();
    }
The client examples assume that the movie server runs on the default port 8080.

@author Tomasz Bak
ribbon-examples/src/main/java/com/netflix/ribbon/examples/rx/RxMovieServer.java