Several realistic situations in vehicular traffic that give rise to queues can be modeled through conservation laws with boundary and unilateral constraints on the flux. This paper provides a rigorous analytical framework for these descriptions, comprising stability with respect to the initial data, to the boundary inflow and to the constraint. We present a framework to rigorously state optimal management problems and prove the existence of the corresponding optimal controls. Specific cases are dealt with in detail through ad hoc numerical integrations. These are here obtained implementing the wave front tracking algorithm, which appears to be very precise in computing, for instance, the exit times.