All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.noear.solon.view.thymeleaf.BaseUrlLinkBuilder Maven / Gradle / Ivy

package org.noear.solon.view.thymeleaf;

import org.thymeleaf.context.IExpressionContext;
import org.thymeleaf.exceptions.TemplateProcessingException;
import org.thymeleaf.linkbuilder.StandardLinkBuilder;

import java.util.Map;

public class BaseUrlLinkBuilder extends StandardLinkBuilder {
    private String baseUrl;

    public void setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
    }

    @Override
    protected String computeContextPath(IExpressionContext context, String base, Map parameters) {
        if (baseUrl == null) {
            throw new TemplateProcessingException("baseUrl is null");
        }

        return baseUrl;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy