Class HttpHandlerUtil


  • public class HttpHandlerUtil
    extends Object
    Provides methods shared by the HTTP handlers.
    Author:
    Stephen Mallette (http://stephen.genoprime.com)
    • Constructor Detail

      • HttpHandlerUtil

        public HttpHandlerUtil()
    • Method Detail

      • sendError

        public static void sendError​(io.netty.channel.ChannelHandlerContext ctx,
                                     io.netty.handler.codec.http.HttpResponseStatus status,
                                     String message)
        Helper method to send errors back as JSON. Only to be used when the RequestMessage couldn't be parsed, because a proper serialized ResponseMessage should be sent in that case.
        Parameters:
        ctx - The netty channel context.
        status - The HTTP error status code.
        message - The error message to contain the body.