return response;
}
catch ( IOException e )
{
throw new DirectMemoryException( e.getMessage(), e );
}
catch ( ClassNotFoundException e )
{
throw new DirectMemoryException( e.getMessage(), e );
}
catch ( IllegalAccessException e )
{
throw new DirectMemoryException( e.getMessage(), e );
}
catch ( InstantiationException e )
{
throw new DirectMemoryException( e.getMessage(), e );
}
case TEXT_PLAIN:
try
{
DirectMemoryResponse<String> response = new DirectMemoryResponse<String>();
response.setResponse( IOUtils.toString( inputStream ) );
return response;
}
catch ( IOException e )
{
throw new DirectMemoryException( e.getMessage(), e );
}
default:
LoggerFactory.getLogger( AbstractDirectMemoryHttpClient.class ).error( "exchange type unknown {}",
request.getExchangeType() );
throw new DirectMemoryException( "exchange type unknown " + request.getExchangeType() );
}
}