Changing domain names, redirect each JSF page to corresponding page in new domain using a JSF Filter

When changing domain names, Google recommends that redirection is done page by page in order to preserve page search rank. Below is how to redirect pages of a Java Server Faces (JSF) application to corresponding pages of a new domain name using a JSF Filter.