sb.append('/'); URLFormCodec.appendURL(sb, url);
URLFormCodec.appendURL(sb, absolutePath);
    public String formatImageURL(FacesContext facesContext, String filter,            String url, boolean mainURL,            ImageURLRewritingInformation rewritingInformation) {        String operationId = filter;        int pf = operationId.indexOf('(');        if (pf >= 0) {            operationId = operationId.substring(0, pf);        }        IImageOperation imageOperation = getImageOperation(operationId);        if (LOG.isDebugEnabled()) {            LOG.debug("Image operation id='" + operationId + "' filter='"                    + filter + "' => " + imageOperation);        }        boolean addFilterServletPath = true;        String externalContentType = null;        String internalContentType = null;        if (imageOperation != null) {            externalContentType = imageOperation.getExternalContentType();            internalContentType = imageOperation.getInternalContentType();        }        if (externalContentType == null) {            externalContentType = getContentType(url);        }        if (internalContentType == null) {            internalContentType = externalContentType;        }        if (rewritingInformation != null) {            rewritingInformation.setContentType(externalContentType);        }        if (isValidContenType(internalContentType) == false) {            if (LOG.isInfoEnabled()) {                LOG.info("Not supported content type '" + internalContentType                        + "' for url '" + url + "'.");            }            if (mainURL == false) {                return null;            }            addFilterServletPath = false;        }        ExternalContext externalContext = facesContext.getExternalContext();        StringAppender sb = new StringAppender(256);        String requestContextPath = externalContext.getRequestContextPath();        sb.append(requestContextPath);        if (addFilterServletPath) {            sb.append(imageRepositoryURL);            sb.append('/');            sb.append(filter);        }        // Traitement du base href ????        IProcessContext extContext = AbstractProcessContext                .getProcessContext(externalContext);        if (url.charAt(0) != '/') {            String baseHREF = extContext.getBaseHREF();            if (baseHREF == null || baseHREF.length() < 1) {                // On prend la servlet !                String servletPath = externalContext.getRequestServletPath();                if (servletPath != null) {                    int idx = servletPath.lastIndexOf('/');                    if (idx > 0) {                        sb.append(servletPath.substring(0, idx));                    }                }            } else {                if (baseHREF.indexOf("://") >= 0) {                    throw new FacesException("Base href '" + baseHREF                            + "' is not supported !");                }                // Le BASE HREF est positionné !                sb.append(baseHREF.substring(requestContextPath.length()));            }        }        sb.append('/');        URLFormCodec.appendURL(sb, url);        if (imageOperation != null) {            String suffix = imageOperation.getForceSuffix();            if (suffix != null) {                sb.append('.');                sb.append(suffix);            }        }        String ret = sb.toString();        if (LOG.isDebugEnabled()) {            LOG.debug("Format image '" + url + "' with filter '" + filter                    + "' returns url '" + ret + "'.");        }        return ret;    }