You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
have multiple external domain's pointing to the same seam app but want to have a custom CSS or template depending on the current external domain being used by the user?
the assumption is you have an apache in front doeing some url rewriting that passes an x-forwarded-host param.
create a custom stylesheet per external host, i.e. if you have www.host1.com and www.host2.be as external host names, create the files www.host1.com.css and www.host2.be.css.
add this to your template
<link href="#{facesContext.externalContext.requestContextPath}/#{configuration.serverName}.css" rel="stylesheet" type="text/css"/>
and add the following component
@Name("configuration")
@Scope(ScopeType.APPLICATION)
@Startup
public class Configuration implements Serializable {
@In
protected FacesMessages facesMessages;
@Logger
Log log;
public Map<String, String> getHeaderMap() {
return FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap();
}
public String getServerName() {
return getServerAddress().split(":")[0];
}
public String getServerAddress() {
final String proxy = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap().get("x-forwarded-host");
if (LangUtil.isEmpty(proxy)) {
final HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
final String local = request.getLocalAddr() + ":" + request.getLocalPort();
log.info("return local server: " + local);
return local;
} else {
log.info("return proxy server: " + proxy);
return proxy;
}
}
}
thank you. this is just what i needed. is there a list somewhere on which seam scopes are shared between multiple subdomains and which are not?
Well worth the read. Thanks for sharing this information. I got a chance to know about this rezultate live.
I have read your post, really you have provided such a great information about it. I suggest this site to my friends so it could be useful and informative for them also. I am working for Call center jobs pakistan