Hi, I think you can use custom root request mapper for this too. See https://github.com/apache/wicket/blob/master/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/LocaleFirstMapper.java?source=cc - it extracts the locale from the first url segment.
On Tue, Jun 25, 2013 at 6:55 PM, Bas Gooren <b...@iswd.nl> wrote: > 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 AbortWithHttpErrorCodeExceptio* > *n 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 > >