Hi Justin, sorry for the delay but I've been left without an internet
connection for a while!

I'm submitting only partial XML using the following method (I'm using the
Jersey REST client):

public static void setDefaultStyle(String geoserverURL, String layerName,
String styleName) {
String xml =
"<layer><defaultStyle><name>"+styleName+"</name></defaultStyle></layer>";
 WebResource r = client.resource(geoserverURL + "/rest/layers/" + layerName
+ ".xml");
r.type("application/xml").put(String.class, xml);
}

When I GET the layer XML back it seems to do the trick, but again it doesn't
save when I restart Geoserver.

Any ideas?

Jon

On 8 September 2010 23:46, Justin Deoliveira <jdeol...@opengeo.org> wrote:

> Hi Jon,
>
> Can you share the XML you are posting to set the default style?
>
> -Justin
>
> On Tue, Sep 7, 2010 at 2:17 PM, Jon Britton <jonbritt...@googlemail.com>wrote:
>
>> Hi,
>>
>> I'm using REST to add a coverage to Geoserver (2.0.1) and then make it
>> available as a WMS layer.  When the layer is created it is given a default
>> style ("raster") and works just fine.  Just to be certain, I also set it's
>> default style using REST and in doing so discovered the first bug - changing
>> the defaultStyle also disabled the layer!
>>
>> My second problem arises when GeoServer is restarted - the new layers
>> defaultStyle is missing (XML is shown below).  This means I can't make any
>> Getcapabilities requests because GeoServer throws an exception!
>>
>> Are these known bugs?
>>
>> Thanks,
>>
>> Jon
>>
>> XML before restart:
>>
>> <layer>
>>   <name>18jjzzrnxewnh</name>
>>   <type>RASTER</type>
>>   <defaultStyle>
>>     <name>raster</name>
>>     <atom:link xmlns:atom="http://www.w3.org/2005/Atom"; rel="alternate"
>> href="http://localhost:8080/geoserver/rest/styles/raster.xml";
>> type="application/xml"/>
>>   </defaultStyle>
>>   <resource class="coverage">
>>     <name>18jjzzrnxewnh</name>
>>     <atom:link xmlns:atom="http://www.w3.org/2005/Atom"; rel="alternate"
>> href="
>> http://localhost:8080/geoserver/rest/workspaces/temp/coveragestores/18jjzzrnxewnh/coverages/18jjzzrnxewnh.xml";
>> type="application/xml"/>
>>   </resource>
>>   <enabled>true</enabled>
>>   <attribution>
>>     <logoWidth>0</logoWidth>
>>     <logoHeight>0</logoHeight>
>>   </attribution>
>> </layer>
>>
>> XML after restart:
>>
>> <layer>
>>   <name>18jjzzrnxewnh</name>
>>   <type>RASTER</type>
>>   <resource class="coverage">
>>     <name>18jjzzrnxewnh</name>
>>     <atom:link xmlns:atom="http://www.w3.org/2005/Atom"; rel="alternate"
>> href="
>> http://localhost:8080/geoserver/rest/workspaces/temp/coveragestores/18jjzzrnxewnh/coverages/18jjzzrnxewnh.xml";
>> type="application/xml"/>
>>   </resource>
>>   <enabled>true</enabled>
>>   <attribution>
>>     <logoWidth>0</logoWidth>
>>     <logoHeight>0</logoHeight>
>>   </attribution>
>> </layer>
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net Dev2Dev email is sponsored by:
>>
>> Show off your parallel programming skills.
>> Enter the Intel(R) Threading Challenge 2010.
>> http://p.sf.net/sfu/intel-thread-sfd
>> _______________________________________________
>> Geoserver-users mailing list
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>
>
> --
> Justin Deoliveira
> OpenGeo - http://opengeo.org
> Enterprise support for open source geospatial.
>
>
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to