@Override
    public boolean handleRequest(VaadinSession session, VaadinRequest request,
            VaadinResponse response) throws IOException {
        if (!"/remoteConsole".equals(request.getPathInfo())) {
            // Not for us
            return false;
        }

        int contentLength = request.getContentLength();
        if (contentLength <= 0) {
            throw new IOException("Content lenght required");
        }

        InputStream inputStream = request.getInputStream();
        byte[] buffer = new byte[contentLength];
        int totalRead = 0;
        while (totalRead < contentLength) {
            int read = inputStream.read(buffer, totalRead, contentLength
                    - totalRead);
            if (read == -1) {
                // More data was expected
                throw new EOFException();
            }
            totalRead += read;
        }

        try {
            JSONArray messages = new JSONArray(new String(buffer,
                    Charset.forName("UTF-8")));
            for (int i = 0; i < messages.length(); i++) {
                JSONObject message = messages.getJSONObject(i);
                boolean error = message.optBoolean("isError");
                String text = message.getString("message");
                long time = message.getLong("time");
                messageProcessor.processMessage(time, text, error);
            }
        } catch (JSONException e) {
            throw new IOException(e);
        }

        response.setStatus(200);
        response.getWriter().close();
        return true;
    }