Influence of the gravitational field on the quantum-nondemolition measurement of atomic momentum in the dispersive Jaynes–Cummings model