Skip to content

Instantly share code, notes, and snippets.

@jkyamog
Created March 18, 2014 08:59
Show Gist options
  • Save jkyamog/9616210 to your computer and use it in GitHub Desktop.
Save jkyamog/9616210 to your computer and use it in GitHub Desktop.
handling 414
event.getCause match {
// IO exceptions happen all the time, it usually just means that the client has closed the connection before fully
// sending/receiving the response.
case e: IOException => nettyExceptionLogger.trace("Benign IO exception caught in Netty", e)
event.getChannel.close()
case e: TooLongFrameException => nettyExceptionLogger.warn("Handling TooLongFrameException", e)
val response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.REQUEST_URI_TOO_LONG)
response.setHeader("connection", "close")
val dme = new DownstreamMessageEvent(ctx.getChannel, Channels.future(ctx.getChannel), response, ctx.getChannel.getRemoteAddress)
ctx.sendDownstream(dme);
case e => nettyExceptionLogger.error("Exception caught in Netty", e)
event.getChannel.close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment