Hi,

this section of the manual:

https://docs.geoserver.org/latest/en/user/rest/api/details.html#formats-and-representations

tells that I can use the URL ending to control the Format being used in
the message body for REST calls.

It works OK for GET calls:

curl -u admin:geoserver -XGET http://localhost:8080/geoserver/rest/styles.xml
--> XML

curl -u admin:geoserver -XGET http://localhost:8080/geoserver/rest/styles.json
--> JSON

But for this POST call, it doesn't work:

curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d 
"<style><name>roads_style</name><filename>roads.sld</filename></style>" 
http://localhost:8080/geoserver/rest/styles.xml

It ends in a stacktrace starting with:

java.lang.RuntimeException: No such style handler: format = text/xml
        at org.geoserver.catalog.Styles.handler(Styles.java:156)
        at 
org.geoserver.rest.catalog.StyleController.styleSLDPost(StyleController.java:227)

If I leave out the ".xml" at the end, it works as expected. Same
problem for JSON content/URL-ending.

The problem here is that I get routed into the wrong Method within
StyleController: With the ".json"-Ending, I get into 

        consumes = {MediaType.ALL_VALUE}
    )
    public ResponseEntity<String> styleSLDPost(

which is for uploading the Style Content.

Only if leaving out the ".xml" ending from the URL, I get into the
correct

 public String stylePost(

Method for creating the blank style entry in the catalog.

Any idea what's wrong here? Was there a change in the Spring framework?
I can confirm that it works with GS 2.12.2


Thanks,

Björn


Attachment: pgpcGZ3zwn6SZ.pgp
Description: OpenPGP digital signature

_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to