Let\'s say that I have an application which manages users. You can add new user, delete them, edit detail etc. Each user has na ID and has detail page on URL like this:
As mentioned, you can get the context from within a managed bean. I tried the validator approach, but for me it wasn't applicable since I was using two parameters to initialize my bean, and I do want to throw a 404. For me .setResponseStatus didn't throw the 404-page. Just gave a non-informative browser page. So I used the responseSendError instead.