Search in sources :

Example 1 with UrlTransformer

use of org.craftercms.core.url.UrlTransformer in project core by craftercms.

the class UrlTransformationEngineImpl method doTransformUrl.

@Override
protected String doTransformUrl(Context context, CachingOptions cachingOptions, String transformerName, String url) throws UrlTransformationException {
    UrlTransformer transformer = transformers.get(transformerName);
    if (transformer == null) {
        throw new UrlTransformationException("Url transformer " + transformerName + " not found");
    }
    String result = transformer.transformUrl(context, cachingOptions, url);
    if (StringUtils.isEmpty(result)) {
        result = "/";
    }
    if (logger.isDebugEnabled()) {
        logger.debug("Transformation in: " + url + ", Transformation out: " + result);
    }
    return result;
}
Also used : UrlTransformationException(org.craftercms.core.exception.UrlTransformationException) UrlTransformer(org.craftercms.core.url.UrlTransformer)

Aggregations

UrlTransformationException (org.craftercms.core.exception.UrlTransformationException)1 UrlTransformer (org.craftercms.core.url.UrlTransformer)1