Hi again, I've just tried 2.0.2 and it works fine.  Sorry for wasting your
time, I thought 2.0.1 was the latest stable version!

Thanks,

Jon

On 22 September 2010 11:10, Jon Britton <jonbritt...@googlemail.com> wrote:

> Hi Justin.  I'm not trying to post a new style, I only want to set the
> layers default style.  The steps I use are as follows:
>
> 1. POST a coveragestore
> 2. PUT the coverage (code for 1 and 2 is below)
> 3. PUT the default style to the layer
> 4. PUT to set enabled to true (because (3) disabled it...)
>
> I want my coverage to have the default "raster" style, which it is actually
> given automatically in (2) so (3) probably isn't even necessary.  Either
> way, the default style disappears when I restart GeoServer.
>
> Which version of GeoServer did you use?  I'm using 2.0.1 but will try a
> more recent version now.
>
> Thanks,
>
> Jon
>
> Code for creating the coverage:
>
> WebResource r = client.resource(geoserverUrl + "/rest/workspaces/" +
> workspace + "/coveragestores");
>  // POST coveragestore
> String xml = "<coverageStore><name>" + coverageStoreName +
> "</name><workspace>" + workspace +
> "</workspace><enabled>true</enabled></coverageStore>";
> r.type("application/xml").post(String.class, xml);
>
> // PUT coverage
> r = client.resource(geoserverUrl + "/rest/workspaces/" + workspace +
> "/coveragestores/" + coverageName +
> "/external.geotiff?configure=first&coverageName=" + coverageName);
> r.put(String.class, "file:/" + file.getAbsolutePath());
>
> On 21 September 2010 18:13, Justin Deoliveira <jdeol...@opengeo.org>wrote:
>
>> Hi Jon, I just tried to reproduce this bug and was unable to. Here is what
>> i did.
>>
>> 1. POST'ed a new coverage
>> 2. verified default style being used
>> 3. POST'ed new style
>> 4. POST'ed new default style to layer created in (1)
>> 5. verified new style set on coverage
>> 6. restarted geoserver
>>
>> And everything continued to work, the default style persists. So not sure
>> what the issue.
>>
>> If you can send me the exact sequence of rest calls made to geoserver, and
>> ideally the style you are trying to post and even more ideal the coverage
>> you are using i can try again to reproduce. Let me know.
>>
>> -Justin
>>
>> On Tue, Sep 21, 2010 at 3:41 AM, Jon Britton 
>> <jonbritt...@googlemail.com>wrote:
>>
>>> Hi again,
>>>
>>> I was just wondering if anybody has any comment on this?  This problem is
>>> a bit of a blocker for me so any help would be appreciated.
>>>
>>> Thanks,
>>>
>>> Jon
>>>
>>>
>>> On 15 September 2010 12:40, Jon Britton <jonbritt...@googlemail.com>wrote:
>>>
>>>> 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.
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> 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