I am attaching the GeoServer log and my own log, where the requests and responses are recorded. My attention was caught by the following lines:

2013-04-08 19:35:24,358 DEBUG [catalog.impl] - Warning, some code is setting the LayerInfo name, but that will be ignored 2013-04-08 19:35:24,358 DEBUG [geoserver.config] - Persisting layer line_crs 2013-04-08 19:35:24,359 DEBUG [geoserver.config] - Persisted org.geoserver.catalog.impl.LayerInfoImpl to /data/geoserver/data/workspaces/dragouni/line_crs/line_crs/layer.xml 2013-04-08 19:35:24,359 DEBUG [gwc.layer] - Handling modify event for LayerInfoImpl[line_crs, resource:FeatureTypeInfoImpl[line_crs]] 2013-04-08 19:35:24,361 DEBUG [geoserver.config] - Persisted sun.proxy.$Proxy506 to /data/geoserver/data/global.xml 2013-04-08 19:35:24,361 INFO [catalog.rest] - PUT layer dragouni:line_crs

But I am not sure, what exactly that means.

I am aware, that I am not allowed to change the name or resource of the layer (in such a case I would expect status code 403), but should it be possible to change the defualtStyle?

Michal



Dne 08.04.2013 18:48, [email protected] napsal:
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




------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
2013-04-08 19:35:06,199 DEBUG [geoserver.security] - Start searching for 
expired authentication tokens
2013-04-08 19:35:06,199 DEBUG [geoserver.security] - Number of expired 
authentication tokens found: 1
2013-04-08 19:35:06,199 DEBUG [geoserver.security] - End searching for expired 
authentication tokens
2013-04-08 19:35:24,256 DEBUG 
[rememberme.GeoServerTokenBasedRememberMeServices] - Did not send remember-me 
cookie (principal did not set parameter '_spring_security_remember_me')
2013-04-08 19:35:24,257 DEBUG 
[rememberme.GeoServerTokenBasedRememberMeServices] - Remember-me login not 
requested.
2013-04-08 19:35:24,257 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - Converted URL to 
lowercase, from: '/rest/layers/dragouni:line_crs.json'; to: 
'/rest/layers/dragouni:line_crs.json'  and httpMethod= GET
2013-04-08 19:35:24,257 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - ~~~~~~~~~~ antPath= 
/** methodList= [Ljava.lang.String;@7fe9230d
2013-04-08 19:35:24,257 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - method[0]: GET
2013-04-08 19:35:24,257 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - Candidate is: 
'/rest/layers/dragouni:line_crs.json'; antPath is /**; matchedPath=true; 
matchedMethods=true
2013-04-08 19:35:24,257 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/rest/layers/dragouni:line_crs.json]
2013-04-08 19:35:24,257 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/rest/layers/dragouni:line_crs.json]
2013-04-08 19:35:24,258 DEBUG [org.geoserver] - Thread 44683 locking in mode 
READ
2013-04-08 19:35:24,258 DEBUG [org.geoserver] - Thread 44683 got the lock in 
mode READ
2013-04-08 19:35:24,261 DEBUG [org.geoserver] - Thread 44683 releasing the lock 
in mode READ
2013-04-08 19:35:24,264 DEBUG [geoserver.filters] - Compressing output for 
mimetype: application/json
2013-04-08 19:35:24,265 DEBUG 
[filter.GeoServerSecurityContextPersistenceFilter$1] - SecurityContextHolder 
now cleared, as request processing completed
2013-04-08 19:35:24,349 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - Converted URL to 
lowercase, from: '/rest/layers/dragouni:line_crs.json'; to: 
'/rest/layers/dragouni:line_crs.json'  and httpMethod= PUT
2013-04-08 19:35:24,349 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - ~~~~~~~~~~ antPath= 
/** methodList= [Ljava.lang.String;@7fe9230d
2013-04-08 19:35:24,349 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - method[0]: GET
2013-04-08 19:35:24,349 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - Candidate is: 
'/rest/layers/dragouni:line_crs.json'; antPath is /**; matchedPath=true; 
matchedMethods=false
2013-04-08 19:35:24,349 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - ~~~~~~~~~~ antPath= 
/** methodList= [Ljava.lang.String;@416c4476
2013-04-08 19:35:24,350 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - method[0]: POST
2013-04-08 19:35:24,350 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - method[1]: DELETE
2013-04-08 19:35:24,350 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - method[2]: PUT
2013-04-08 19:35:24,350 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - Candidate is: 
'/rest/layers/dragouni:line_crs.json'; antPath is /**; matchedPath=true; 
matchedMethods=true
2013-04-08 19:35:24,350 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/rest/layers/dragouni:line_crs.json]
2013-04-08 19:35:24,350 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/rest/layers/dragouni:line_crs.json]
2013-04-08 19:35:24,351 DEBUG [org.geoserver] - Thread 44618 locking in mode 
WRITE
2013-04-08 19:35:24,351 DEBUG [org.geoserver] - Thread 44618 got the lock in 
mode WRITE
2013-04-08 19:35:24,358 DEBUG [catalog.impl] - Warning, some code is setting 
the LayerInfo name, but that will be ignored
2013-04-08 19:35:24,358 DEBUG [geoserver.config] - Persisting layer line_crs
2013-04-08 19:35:24,359 DEBUG [geoserver.config] - Persisted 
org.geoserver.catalog.impl.LayerInfoImpl to 
/data/geoserver/data/workspaces/dragouni/line_crs/line_crs/layer.xml
2013-04-08 19:35:24,359 DEBUG [gwc.layer] - Handling modify event for 
LayerInfoImpl[line_crs, resource:FeatureTypeInfoImpl[line_crs]]
2013-04-08 19:35:24,361 DEBUG [geoserver.config] - Persisted 
sun.proxy.$Proxy506 to /data/geoserver/data/global.xml
2013-04-08 19:35:24,361 INFO [catalog.rest] - PUT layer dragouni:line_crs
2013-04-08 19:35:24,361 DEBUG [org.geoserver] - Thread 44618 releasing the lock 
in mode WRITE
2013-04-08 19:35:24,362 DEBUG 
[filter.GeoServerSecurityContextPersistenceFilter$1] - SecurityContextHolder 
now cleared, as request processing completed
2013-04-08 19:35:24,575 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - Converted URL to 
lowercase, from: '/rest/layers/dragouni:line_crs.json'; to: 
'/rest/layers/dragouni:line_crs.json'  and httpMethod= GET
2013-04-08 19:35:24,575 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - ~~~~~~~~~~ antPath= 
/** methodList= [Ljava.lang.String;@7fe9230d
2013-04-08 19:35:24,575 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - method[0]: GET
2013-04-08 19:35:24,575 DEBUG 
[security.RESTfulPathBasedFilterInvocationDefinitionMap] - Candidate is: 
'/rest/layers/dragouni:line_crs.json'; antPath is /**; matchedPath=true; 
matchedMethods=true
2013-04-08 19:35:24,575 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/rest/layers/dragouni:line_crs.json]
2013-04-08 19:35:24,575 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/rest/layers/dragouni:line_crs.json]
2013-04-08 19:35:24,576 DEBUG [org.geoserver] - Thread 44680 locking in mode 
READ
2013-04-08 19:35:24,576 DEBUG [org.geoserver] - Thread 44680 got the lock in 
mode READ
2013-04-08 19:35:24,579 DEBUG [org.geoserver] - Thread 44680 releasing the lock 
in mode READ
2013-04-08 19:35:24,582 DEBUG [geoserver.filters] - Compressing output for 
mimetype: application/json
2013-04-08 19:35:24,582 DEBUG 
[filter.GeoServerSecurityContextPersistenceFilter$1] - SecurityContextHolder 
now cleared, as request processing completed
2013-04-08 19:35:31,724 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/web/]
2013-04-08 19:35:31,725 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/web/]
2013-04-08 19:35:31,725 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/web/]
2013-04-08 19:35:31,725 DEBUG [org.geoserver] - Thread 48517 locking in mode 
WRITE
2013-04-08 19:35:31,725 DEBUG [org.geoserver] - Thread 48517 got the lock in 
mode WRITE
2013-04-08 19:35:31,728 DEBUG [org.geoserver] - Thread 48517 releasing the lock 
in mode WRITE
2013-04-08 19:35:31,728 DEBUG 
[filter.GeoServerSecurityContextPersistenceFilter$1] - SecurityContextHolder 
now cleared, as request processing completed
2013-04-08 19:35:31,834 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/web/]
2013-04-08 19:35:31,834 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/web/]
2013-04-08 19:35:31,835 TRACE [ows.OWSHandlerMapping] - No handler mapping 
found for [/web/]
2013-04-08 19:35:31,835 DEBUG [org.geoserver] - Thread 48517 locking in mode 
WRITE
2013-04-08 19:35:31,835 DEBUG [org.geoserver] - Thread 48517 got the lock in 
mode WRITE
2013-04-08 19:35:31,840 DEBUG [geoserver.web] - cannot convert url: 
jar:file:/data/liferay/tomcat-7.0.27/webapps/geoserver/WEB-INF/lib/web-core-2.3-RC1.jar!/org/geoserver/web/css/blueprint/screen.css
 to file (URI is not hierarchical), falling back to the inputstream for polling
2013-04-08 19:35:31,841 DEBUG [geoserver.web] - cannot convert url: 
jar:file:/data/liferay/tomcat-7.0.27/webapps/geoserver/WEB-INF/lib/web-core-2.3-RC1.jar!/org/geoserver/web/css/blueprint/print.css
 to file (URI is not hierarchical), falling back to the inputstream for polling
2013-04-08 19:35:31,842 DEBUG [geoserver.web] - cannot convert url: 
jar:file:/data/liferay/tomcat-7.0.27/webapps/geoserver/WEB-INF/lib/web-core-2.3-RC1.jar!/org/geoserver/web/css/geoserver.css
 to file (URI is not hierarchical), falling back to the inputstream for polling
2013-04-08 19:35:31,843 DEBUG [geoserver.web] - cannot convert url: 
jar:file:/data/liferay/tomcat-7.0.27/webapps/geoserver/WEB-INF/lib/web-core-2.3-RC1.jar!/org/geoserver/web/css/blueprint/ie.css
 to file (URI is not hierarchical), falling back to the inputstream for polling
2013-04-08 19:35:31,845 DEBUG [geoserver.web] - cannot convert url: 
jar:file:/data/liferay/tomcat-7.0.27/webapps/geoserver/WEB-INF/lib/web-core-2.3-RC1.jar!/org/geoserver/web/js/jquery-1.2.6.min.js
 to file (URI is not hierarchical), falling back to the inputstream for polling
2013-04-08 19:35:31,846 DEBUG [geoserver.web] - cannot convert url: 
jar:file:/data/liferay/tomcat-7.0.27/webapps/geoserver/WEB-INF/lib/web-core-2.3-RC1.jar!/org/geoserver/web/js/jquery.inline-info.js
 to file (URI is not hierarchical), falling back to the inputstream for polling

mis@besenek:~/layman/server/tests$ python layedtest.py 
test_01_publish (__main__.LayEdTestCase) ... *** GSREST *** getLayer ***
*** url ***
http://erra.ccss.cz:8080/geoserver/rest/layers/dragouni:line_crs.json
*** headers ***
{'status': '200', 'content-length': '428', 'content-location': 
'http://erra.ccss.cz:8080/geoserver/rest/layers/dragouni:line_crs.json', 
'server': 'Noelios-Restlet-Engine/1.0..8', '-content-encoding': 'gzip', 'date': 
'Mon, 08 Apr 2013 19:35:24 GMT', 'content-type': 'application/json'}
*** response ***
{"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":33,"logoHeight":44}}}
*** GSREST *** putLayer ***
*** url ***
http://erra.ccss.cz:8080/geoserver/rest/layers/dragouni:line_crs.json
*** data ***
{"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": "33", 
"logoHeight": "44"}, "type": "VECTOR", "queryable": "false"}}
*** headers ***
{'date': 'Mon, 08 Apr 2013 19:35:24 GMT', 'status': '200', 'content-length': 
'0', 'server': 'Noelios-Restlet-Engine/1.0..8'}
*** response ***

*** GSREST *** getLayer ***
*** url ***
http://erra.ccss.cz:8080/geoserver/rest/layers/dragouni:line_crs.json
*** headers ***
{'status': '200', 'content-length': '428', 'content-location': 
'http://erra.ccss.cz:8080/geoserver/rest/layers/dragouni:line_crs.json', 
'server': 'Noelios-Restlet-Engine/1.0..8', '-content-encoding': 'gzip', 'date': 
'Mon, 08 Apr 2013 19:35:24 GMT', 'content-type': 'application/json'}
*** response ***
{"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":33,"logoHeight":44}}}
FAIL

======================================================================
FAIL: test_01_publish (__main__.LayEdTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "layedtest.py", line 65, in test_01_publish
    self.assertEquals("line_crs", styleName, "The layer is there, but it has 
wrong style assinged.")
AssertionError: The layer is there, but it has wrong style assinged.

----------------------------------------------------------------------
Ran 1 test in 0.555s

FAILED (failures=1)

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to