Branes in AdS and pp-wave spacetimes