We're updating the issue view to help you get more done. 

Uploading of SLD from GeoNode fails

Description

When using GeoNode 2.10rc5 to upload a layer to GeoServer 2.15.2 it results in GeoServer reporting the error

1 No such style handler: format = application/xml

In GeoNode the python package used to upload the data to GeoServer is called gsconfig.

Tested with GeoServer 2.15.1 and the same error is returned. Testing with an older nightly build of GeoServer 2.15.1 from a couple of weeks ago works fine. No code has changed in GeoServer in this area and also in gsconfig.

As per the (GeoServer API documentation) the POST /styles REST endpoint it passes the following:

1 2 3 4 <style> <name>roads_style</name> <filename>roads.sld</filename> </style>

gsconfig when passing making this call passes the following data in the header:

1 2 Content-Type : application/xml Accept : application/xml

The problem is the Accept header item, if it is omitted the correct method is called :

1 org.geoserver.rest.catalog.StyleController stylePost()

If the Accept header is present then it calls

1 org.geoserver.rest.catalog.StyleController styleSLDPost()

The reason this happens is because the `produces` list is not expecting application/xml. I assume an underlying xml library has updated.

1 2 3 4 5 6 7 8 9 10 @PostMapping( value = {"/styles", "/layers/{layerName}/styles", "/workspaces/{workspaceName}/styles"}, consumes = { MediaType.TEXT_XML_VALUE, MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE, MediaTypeExtensions.TEXT_JSON_VALUE }, produces = MediaType.TEXT_PLAIN_VALUE )

and should be:

1 2 3 4 5 6 7 8 9 10 @PostMapping( value = {"/styles", "/layers/{layerName}/styles", "/workspaces/{workspaceName}/styles"}, consumes = { MediaType.TEXT_XML_VALUE, MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE, MediaTypeExtensions.TEXT_JSON_VALUE }, produces = {MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_XML_VALUE} )

This fix ensures that it is backwards compatible.

Environment

Ubuntu 18.04 GeoServer 2.15.2

Status

Assignee

Unassigned

Reporter

Robert Ward

Triage

Fix versions

None

Affects versions

2.15.2

Components

Priority

High