/** Helper method that builds the legend get url using the available info. */ private String buildFinalUrl( String finalStyleName, Integer finalWidth, Integer finalHeight, String finalFormat) { if (completeUrl != null) { // we have a complete url so let's just return it return completeUrl; } String finalUrl = url == null ? layerUrl : url; // check mandatory values checkNotNull(finalWidth, "A legend width is mandatory."); checkNotNull(finalHeight, "A legend height is mandatory."); checkNotNull(finalUrl, "A legend url is mandatory."); checkNotNull(layerName, "A layer name is mandatory."); return finalUrl + addQuoteMark(finalUrl) + "service=WMS&request=GetLegendGraphic" + "&format=" + finalFormat + "&width=" + finalWidth + "&height=" + finalHeight + "&layer=" + ServletUtils.URLEncode(layerName) + "&style=" + ServletUtils.URLEncode(finalStyleName); }