Revision 3655 trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/wms/WMSProtocolHandler.java

View differences:

WMSProtocolHandler.java
288 288
		String req = new String();
289 289
		String host = getHost();
290 290

  
291
        String symbol;
292
        if (host.indexOf("?")==-1) 
293
            symbol = "?";
294
        else if (host.indexOf("?")!=host.length()-1)
295
            symbol = "&";
296
        else
297
            symbol = "";
291
        String symbol = getSymbol(host);
298 292
        req = req + getHost() + symbol + "REQUEST=GetCapabilities&SERVICE=WMS&";
299 293
		req = req + "VERSION=" + getVersion();
300 294
		req += ("&EXCEPTIONS=XML");
......
308 302
    {
309 303
		String req = new String();
310 304

  
311
        String symbol;
312
        if (host.indexOf("?")==-1) 
313
            symbol = "?";
314
        else if (host.indexOf("?")!=host.length()-1)
315
            symbol = "&";
316
        else
317
            symbol = "";
305
        String symbol = getSymbol(host);
318 306
        
319 307
		req = req + getHost() + symbol + "REQUEST=GetFeatureInfo&SERVICE=WMS&";
320 308
		req = req + "QUERY_LAYERS="+Utilities.Vector2CS(status.getLayerNames()); 
......
329 317
        }
330 318
		return req;
331 319
    }    
332
    
320

  
333 321
    /**
334 322
     * Builds the GetMapRequest according to the OGC WMS Specifications
335 323
     */
......
337 325
    { 
338 326
		String req = new String();
339 327

  
340
		String symbol;
341
        if (host.indexOf("?")==-1) 
342
            symbol = "?";
343
        else if (host.indexOf("?")!=host.length()-1)
344
            symbol = "&";
345
        else
346
            symbol = "";
328
		String symbol = getSymbol(host);
347 329
		req = req + getHost() + symbol + "REQUEST=GetMap&SERVICE=WMS&";
348 330
		req = req + "VERSION=" + getVersion() + "&";
349 331
		req = req + getPartialQuery(status);
......
354 336
        }
355 337
		return req;
356 338
    }
339
    
340
    /**
341
     * Just for not repeat code. Gets the correct separator according to the server URL
342
     * @param h
343
     * @return
344
     */
345
    private String getSymbol(String h) {
346
        String symbol;
347
        if (h.indexOf("?")==-1) 
348
            symbol = "?";
349
        else if (h.indexOf("?")!=h.length()-1)
350
            symbol = "&";
351
        else
352
            symbol = "";
353
        return symbol;
354
    }
357 355

  
358 356
    /**
359 357
     * Gets the part of the OGC request that share GetMap and GetFeatureInfo

Also available in: Unified diff