Built with Seam

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 and as external host names, create the files and

add this to your template

<link href="#{facesContext.externalContext.requestContextPath}/#{configuration.serverName}.css" rel="stylesheet" type="text/css"/>

and add the following component

public class Configuration implements Serializable {

	protected FacesMessages facesMessages;

	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();"return local server: " + local);
			return local;
		} else {"return proxy server: " + proxy);
			return proxy;