Added polymorphism support for Rest gateway.