Resonant-cavity photodetectors