class HttpUtil {

    public static HttpResponse executePostWithBasicAuth( final String url, final String userName,
                                                         final String password )
    {
        // check that url is not null
        if ( StringUtils.isBlank( url ) )
        {
            logger.warn( "In executePostWithBasicAuth, URL is either null or blank." );
            return null;
        }
        HttpClient httpClient = HttpUtil.getHttpClientWithBasicAuth( userName, password );
        if ( httpClient == null )
        {
            logger.warn( "In executePostWithBasicAuth, unable to get HttpClient with BasicAuth." );
            return null;
        }
        try
        {
            return httpClient.execute( new HttpPost( url ) );
        }
        catch ( IOException e )
        {
            logger.error( "In executePostWithBasicAuth, error invoking POST on '{}'", url, e );
            return null;
        }
    }

}