Micah Wengren created GEOS-5103:
-----------------------------------
Summary: Workspace-specific styles are not represented correctly in REST API representations for layers
Key: GEOS-5103
URL: https://jira.codehaus.org/browse/GEOS-5103
Project: GeoServer
Issue Type: Bug
Components: REST
Affects Versions: 2.2-beta1
Environment: Apache Tomcat, Debian Linux, Sun JDK
Reporter: Micah Wengren
Assignee: Andrea Aime
Styles created via REST API in new workspace-segregated configuration are not represented correctly in REST API representations.
Steps to reproduce:
1. Create a layer via REST API
2. Create, upload SLD for new workspace-specific style via REST API:
curl -k -u <user>:<passwd> -X POST -H "Content-type: text/xml" -d "<style><name>ahps_fcst</name><filename>ahps_fcst.sld</filename></style>" https://<host>/geoserver/rest/workspaces/<workspace>/styles
curl -k -u <user>:<passwd> -X PUT -H "Content-type: application/vnd.ogc.sld+xml" -d @ahps.sld https://<host>/geoserver/rest/workspaces/<workspace>/styles/ahps_fcst
3. Configure new layer to use workspace-specific style via Web interface (note: REST API config example shown below does not work as expected for workspace-specific styles either). This had worked for non-workspace specific styles.
curl -k -u <user>:<passwd> -X PUT -H "Content-type: text/xml" -d "<layer><defaultStyle><name>ahps_fcst</name></defaultStyle><enabled>true</enabled></layer>" https://<host>/geoserver/rest/layers/<workspace>:ahps_fcst
Results:
1. The resulting layer configuration in the REST API references the style by the global /rest/styles/ path (which returns 'No such style: <stylename>' response), instead of the workspace-specific path that is valid, such as: /rest/workspaces/<ws>/styles/ahps_obs.xml, which returns the correct response:
<style>
<name>ahps_obs</name>
<workspace>
<name>nos_ocs_1</name>
</workspace>
<sldVersion>
<version>1.0.0</version>
</sldVersion>
<filename>ahps_obs.sld</filename>
</style>
Resulting Layer config example:
<layer>
<name>ahps_fcst</name>
<type>VECTOR</type>
<defaultStyle>
<name>ahps_fcst</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="https://<host>/geoserver/rest/styles/ahps_fcst.xml" type="application/xml"/>
</defaultStyle>
<resource class="featureType">
<name>ahps_obs</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" rel="alternate" href="https://<host>/geoserver/rest/workspaces/<workspace>/datastores/postgis/featuretypes/ahps_fcst.xml" type="application/xml"/>
</resource>
<enabled>true</enabled>
<advertised>true</advertised>
<queryable>true</queryable>
<attribution>
<logoWidth>0</logoWidth>
<logoHeight>0</logoHeight>
</attribution>
</layer>
2. Style preview (via Layer -> Publishing page in web interface) does not work (no style preview image shown).
3. Layer/Style renders corrrectly via OpenLayers preview link, however doesn't work in other client apps (such as GeoExplorer). Logs show the following stack trace for requests from GeoExplorer:
2012-05-07 17:16:00,660 ERROR [geoserver.ows] -
org.geoserver.platform.ServiceException: No such style: ahps_fcst
at org.geoserver.wms.map.GetMapKvpRequestReader.parseStyles(GetMapKvpRequestReader.java:1357)
at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:308)
at org.geoserver.wms.map.GetMapKvpRequestReader.read(GetMapKvpRequestReader.java:78)
at org.geoserver.ows.Dispatcher.parseRequestKVP(Dispatcher.java:1383)
at org.geoserver.ows.Dispatcher.dispatch(Dispatcher.java:619)
at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:263)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira