On Wednesday 16 December 2009 02:06:28 Matthias Howell wrote:
> One of my requirements is to support the same app in a single instance
> responding to multiple domain names.
>
> E.g. www.domain1.com/webapp  gets to the app and the app is in English -
> English text, English images.  www.domain2.com/webapp is on the same
> machine but is in French  - all the text and images are in French.

I am wicket user since last friday, so handle with care:


from 
http://cwiki.apache.org/WICKET/lifecycle-of-a-wicket-application.html

"1. Wicket asks the Application class to create a Session for the
servlet request. If no session exists for the incoming request, a
Session object is created using the application's session factory."

So you can just override the Application.newSession method, LIKE this

public Session newSession ( Request request, Response response )
        {
                Session session = new YourSession(request);
        session.setLocale(Locale.ENGLISH);
                String serverName = ((WebRequest) 
request).getHttpServletRequest().getServerName();
        if (serverName.equals("www.domain2.com")) {
                session.setLocale(Locale.FRENCH);
        }
        return session;
        }

Might be better to put this code into Session Constructor.

kind regards
Janning



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to