baseURI = absolutePath;
if (!encodedPath.trim().equals(""))
{
String tmpContextPath = contextPath;
if (!tmpContextPath.endsWith("/")) tmpContextPath += "/";
baseURI = absoluteBuilder.clone().replacePath(tmpContextPath).replaceQuery(null).build();
}
// make sure there is no trailing '/'
if (encodedPath.length() > 1 && encodedPath.endsWith("/"))
encodedPath = encodedPath.substring(0, encodedPath.length() - 1);