|
From: Andrea A. <aa...@op...> - 2009-03-10 09:46:38
|
Andrea Aime ha scritto:
> Kris Geusebroek ha scritto:
>> Hi Andrea,
>>
>> Here's the patch
>> I'm not sure about the if statement (should be easier to determine if a
>> namespace is available) but it works
>>
>> In wms/src/main/java/org/vfny/geoserver/global/WMS.java
>>
>> The method getbaseMapLayers should be:
>>
>> public Map getBaseMapLayers() {
>> HashMap baseLayers = new HashMap();
>> for ( LayerGroupInfo map : gs.getCatalog().getLayerGroups() ) {
>> StringBuffer layers = new StringBuffer();
>> for ( LayerInfo l : map.getLayers() ) {
>> // check if namespace is used in basemapgroup. If so use
>> it.
>> if (l.getResource() != null &&
>> l.getResource().getNamespace() != null &&
>> l.getResource().getNamespace().getPrefix() != null) {
>> layers.append( l.toString()).append( "," );
>> }
>> else {
>> layers.append( l.getName() ).append( "," );
>> }
>> }
>> layers.setLength( layers.length() - 1 );
>> baseLayers.put( map.getName(), layers.toString() );
>> }
>> return baseLayers;
>> //return baseMapLayers != null ? baseMapLayers :
>> Collections.EMPTY_MAP;
>> }
>
> Thanks, I'll review and apply shortly
Hum, ok, I'm looking at the code on 1.7.x and I'm a bit confused.
The current code on 1.7.x uses:
for ( LayerInfo l : map.getLayers() ) {
layers.append( l.getResource().getPrefixedName()
).append( "," );
}
This should always generate a fully qualified name, no matter what,
in the form "nsprefix:layerName".
As far as I know a ResourceInfo should always be attached to
a namespace, so the case l.getResource().getNamespace() should
never happen, either.
Looking into svn blame I see that line was changed one month ago by
Arne, before it looked like:
layers.append( l.getName() ).append( "," );
May it be that you've been patching an older version?
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.
|