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

com.enonic.xp.lib.portal.url.ImageUrlHandler Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.lib.portal.url;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import com.google.common.collect.Multimap;

import com.enonic.xp.portal.url.ImageUrlParams;

public final class ImageUrlHandler
    extends AbstractUrlHandler
{
    private static final Set VALID_URL_PROPERTY_KEYS = new HashSet<>(
        Arrays.asList( "id", "path", "scale", "quality", "background", "format", "filter", "contextPath", "type", "params" ) );

    @Override
    protected String buildUrl( final Multimap map )
    {
        final ImageUrlParams params = new ImageUrlParams().
            setAsMap( map ).
            portalRequest( request ).
            validate();

        return this.urlService.imageUrl( params );
    }

    @Override
    protected boolean isValidParam( final String param )
    {
        return VALID_URL_PROPERTY_KEYS.contains( param );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy