As far as I understand, gravity wells prevent hyperspace travel. 

What's the in-universe explanation for how Han was able to hyperspace travel through the First Order's shields, and even land successfully, in The Force Awakens?