in server/src/main/java/org/apache/asyncweb/server/transport/mina/SingleHttpSessionIoHandler.java [167:212]
public void exceptionCaught( Throwable cause )
{
MutableHttpResponse response = null;
if ( cause instanceof ProtocolDecoderException )
{
HttpResponseStatus status;
if ( cause instanceof HttpRequestDecoderException )
{
status = ( ( HttpRequestDecoderException ) cause ).getResponseStatus();
}
else
{
status = HttpResponseStatus.BAD_REQUEST;
}
LOG.warn( "Bad request: {}", session.getRemoteAddress(), cause );
response = new DefaultHttpResponse();
response.setProtocolVersion( HttpVersion.HTTP_1_1 );
response.setStatus( status );
}
else if ( cause instanceof IOException )
{
LOG.warn( "IOException on HTTP connection", cause );
session.close();
}
else
{
response = new DefaultHttpResponse();
response.setProtocolVersion( HttpVersion.HTTP_1_1 );
response.setStatus( HttpResponseStatus.INTERNAL_SERVER_ERROR );
LOG.error( "Unexpected exception from a service : "+session.getRemoteAddress(), cause );
}
if ( response != null )
{
HttpServiceContext context = this.currentContext;
if ( context == null )
{
context = createContext( new DefaultHttpRequest() );
}
context.commitResponse( response );
}
}