class HttpHeaderUtils {

    public static long getTransactionTimeout( HttpServletRequest request, Log errorLog )
    {
        String headerValue = request.getHeader( MAX_EXECUTION_TIME_HEADER );
        if ( headerValue != null )
        {
            try
            {
                return Long.parseLong( headerValue );
            }
            catch ( NumberFormatException e )
            {
                errorLog.error( String.format( "Fail to parse `%s` header with value: '%s'. Should be a positive number.",
                        MAX_EXECUTION_TIME_HEADER, headerValue), e );
            }
        }
        return GraphDatabaseSettings.UNSPECIFIED_TIMEOUT;
    }

    private  HttpHeaderUtils();

}