In the framework of real-time optimization, measurement-based schemes have been developed to deal with plant-model mismatch and process variations. These schemes differ in how the feedback information from the plant is used to adapt the inputs. A recent idea therein is to use the feedback information to adapt the constraints of the optimization problem instead of updating the model parameters. These methods are based on the observation that, for many problems, most of the optimization potential arises from activating the correct set of constraints. In this paper, we provide a theoretical justification of these methods based on a variational analysis. Then, various aspects of the constraint-adaptation algorithm are discussed, including the detection of active constraints and convergence issues. Finally, the applicability and suitability of the constraint-adaptation algorithm is demonstrated with the case study of an isothermal stirred-tank reactor.