The redshift and composite nature of AP Librae (PKS 1514-24)