For once we worked around it by extending the class and providing another static method:
Code:
public static SiteSwitcherHandlerInterceptor configurable(final String mobileName, final String normalName) {
boolean tabletIsMobile = false;
String mobileServer = mobileName.replaceAll("http[s]?://", "").replaceAll(":[0-9]+/", "");
String normalServer = normalName.replaceAll("http[s]?://", "").replaceAll(":[0-9]+/", "");
return new SiteSwitcherHandlerInterceptor(new StandardSiteUrlFactory(normalServer), new StandardSiteUrlFactory(
mobileServer), new StandardSitePreferenceHandler(new CookieSitePreferenceRepository("."
+ normalServer)), tabletIsMobile);
}
the string expressions are just to make sure we can reuse existing property variables and create valid URLs (for example a trailing slash today makes m.mysite.com/ be different the getServerName() -- m.mysite.com -- and thus thing we are in the wrong URL (same thing with the port). This is probably just an issue we face.
I really don't know the code good enough to propose something sound from scratch, but I would try to see if there's a way to make all these options pluggable, so it's easier to extend, instead of hardcoding them in methods. For example, somebody that integrates with WURLF might want to have even different sites for mobile (android vs iOS, vs blackberry, vs feature phones). For example in StandardSiteSwitcherHandler.handleSiteSwitch() you just visit each of those and decide.. don't know, just saying.
Regards
AB

Originally Posted by
Roy Clarkson
I agree with your feelings. When I added the tablet support everything became more complicated. The original static convenience methods made more sense when only dealing with mobile or normal options. What are your requirements, or do you have something already in mind? It's perfectly fine to discuss in the forum, but if you have some concrete ideas, can you please create a JIRA? Thanks!