Hi *,

One of our multi-tenant apps uses the incoming hostname to look up the account to "attach" to.
We've currently handled it like so:
- Request scoped guice provider, which performs the lookup (which can return Account.UNKNOWN) - Base page class which "validates" the account returned by the provides at construction time

This works quite well for us, but it does mean that any component not extending the base page class will also need to validate the account.

I think a more logical place to perform the lookup (and cache it) is in a request cycle listener.
However, in case no matching account is found, we need to render a 404 page.
One way of handling that is by throwing an AbortWithHttpErrorCodeException in onRequestHandlerResolved, since that will also allow us to inspect the resolved handler and check if it's pointing to our 404 page (to prevent a loop).

Is there a better/cleaner way to handle such concerns?

--

Met vriendelijke groet,
Kind regards,

Bas Gooren

Reply via email to