Dear all,
I cannot change the default style of a layer using the REST API.
I GET the Layer, change some values and PUT it back, get 200 OK. Other things are nicely changed, but the 'defaultStyle' is not.
It goes like this:
GET Layer:
{"layer":{"name":"line_crs","type":"VECTOR","defaultStyle":{"name":"line","href":"http:\/\/erra.ccss.cz:8080\/geoserver\/rest\/styles\/line.json"},"resource":{"@class":"featureType","name":"line_crs","href":"http:\/\/erra.ccss.cz:8080\/geoserver\/rest\/workspaces\/dragouni\/datastores\/line_crs\/featuretypes\/line_crs.json"},"enabled":true,"attribution":{"logoWidth":0,"logoHeight":0}}}
PUT Layer:
{"layer": {"resource": {"href": "http://erra.ccss.cz:8080/geoserver/rest/workspaces/dragouni/datastores/line_crs/featuretypes/line_crs.json", "name": "line_crs", "@class": "featureType"}, "name": "line_crs", "enabled": "false", "defaultStyle": {"href": "http://erra.ccss.cz:8080/geoserver/rest/workspaces/dragouni/styles/line_crs.json", "name": "line_crs"}, "advertised": "false", "attribution": {"logoWidth": "11", "logoHeight": "12"}, "type": "VECTOR", "queryable": "false"}}
response: 200 OK
GET Layer:
{"layer":{"name":"line_crs","type":"VECTOR","defaultStyle":{"name":"line","href":"http:\/\/erra.ccss.cz:8080\/geoserver\/rest\/styles\/line.json"},"resource":{"@class":"featureType","name":"line_crs","href":"http:\/\/erra.ccss.cz:8080\/geoserver\/rest\/workspaces\/dragouni\/datastores\/line_crs\/featuretypes\/line_crs.json"},"enabled":false,"advertised":false,"queryable":false,"attribution":{"logoWidth":11,"logoHeight":12}}}
So enable, advertised, queryable, attribution logoWidth and logoHeight have changed, the default style has not. I have checked the provided style link in the browser, it works. I have assigned the style in the web interface a get the expected result:
{"layer":{"name":"line_crs","type":"VECTOR","defaultStyle":{"name":"line_crs","href":"http:\/\/erra.ccss.cz:8080\/geoserver\/rest\/workspaces\/dragouni\/styles\/line_crs.json"},"resource":{"@class":"featureType","name":"line_crs","href":"http:\/\/erra.ccss.cz:8080\/geoserver\/rest\/workspaces\/dragouni\/datastores\/line_crs\/featuretypes\/line_crs.json"},"enabled":false,"advertised":false,"queryable":false,"attribution":{"logoWidth":11,"logoHeight":12}}}
I am using GeoServer 2.3-RC1. Any suggestions are welcome.
Thank you in advance,
Michal