public void postConstruct() throws URISyntaxException {
        WmsVersion.lookup(this.version);
        Assert.isTrue(validateBaseUrl(), "invalid baseURL");

        Assert.isTrue(this.layers.length > 0, "There must be at least one layer defined for a WMS request" +
                " to make sense");

        // OpenLayers 2 compatibility.  It will post a single empty style no matter how many layers there are

        if (this.styles != null && this.styles.length != this.layers.length && this.styles.length == 1 &&
                this.styles[0].trim().isEmpty()) {
            this.styles = null;
        } else {
            Assert.isTrue(this.styles == null || this.layers.length == this.styles.length,
                          String.format(
                                  "If styles are defined then there must be one for each layer.  Number of" +
                                          " layers: %s\nStyles: %s", this.layers.length,
                                  Arrays.toString(this.styles)));
        }

        if (this.imageFormat.indexOf('/') < 0) {
            LOGGER.warn("The format {} should be a mime type", this.imageFormat);
            this.imageFormat = "image/" + this.imageFormat;
        }

        Assert.isTrue(this.method == HttpMethod.GET || this.method == HttpMethod.POST,
                      String.format("Unsupported method %s for WMS layer", this.method.toString()));
    }
public void postConstruct ( ) throws URISyntaxException { WmsVersion . lookup ( this . version ) ; Assert . isTrue ( validateBaseUrl ( ) , "invalid baseURL" ) ; Assert . isTrue ( this . layers . length > 0 , "There must be at least one layer defined for a WMS request" + " to make sense" ) ; if ( this . styles != null && this . styles . length != this . layers . length && this . styles . length == 1 && this . styles [ 0 ] . trim ( ) . isEmpty ( ) ) { this . styles = null ; } else { Assert . isTrue ( this . styles == null || this . layers . length == this . styles . length , String . format ( "If styles are defined then there must be one for each layer.  Number of" + " layers: %s\nStyles: %s" , this . layers . length , Arrays . toString ( this . styles ) ) ) ; } if ( this . imageFormat . indexOf ( '/' ) < 0 ) { LOGGER . warn ( "The format {} should be a mime type" , this . imageFormat ) ; this . imageFormat = "image/" + this . imageFormat ; } Assert . isTrue ( this . method == HttpMethod . GET || this . method == HttpMethod . POST , String . format ( "Unsupported method %s for WMS layer" , this . method . toString ( ) ) ) ; }
Validate some of the properties of this layer.