Hi Torben,

I also noticed issues with this PUT /styles/{styleName} endpoint while
testing the REST API for mapbox styles. I collected my notes in this gist,
<https://gist.github.com/mattkrusz/f071e5947674737a305dfa085ae14073> but
here's the "short" version of what I found:

Any style formats that don't support bidirectional encoding from SLD ->
theFormat will *require* you to set *?raw=true* when uploading with the
REST API, or else a HTTP 500 will be returned.

By default, GeoServer attempts to decode the uploaded style to SLD, then
encode it back to the original format, and then write that result to the
catalog. See StyleFormat::read, line 101
<https://github.com/geoserver/geoserver/blob/e7e0a3cdce8140dc1afa02b9cff6a46d8ab15fb7/src/restconfig/src/main/java/org/geoserver/catalog/rest/StyleFormat.java#L101>,
then ResourcePool::writeStyle, line 1947
<https://github.com/geoserver/geoserver/blob/3d9396a70ffd5a8cd026d2d3c87b81a94dba32b6/src/main/src/main/java/org/geoserver/catalog/ResourcePool.java#L1947>.
For an SLD, that roundtrip works and accomplishes parsing, validating, and
formatting of the uploaded style body. For other style formats that don't
support encoding from SLD, it results in a HTTP 500 response and nothing
being written to the catalog. See CSSHandler::encode, which throws an
UnsupportedOperationException at line 142
<https://github.com/geoserver/geoserver/blob/55c4740060eb2b8809ae935a510ac83eeb923313/src/extension/css/src/main/java/org/geoserver/community/css/web/CssHandler.java#L142>
.

We at least need the docs to better explain how the endpoint works, but we
might want to allow GeoServer to be more flexible with uploaded styles by
default.

On Thu, Mar 23, 2017 at 5:21 PM, Torben Barsballe <
tbarsba...@boundlessgeo.com> wrote:

> Now that the example branch is complete, we can move it over to a branch
> in the geoserver repository (rather than the boundless geoserver fork), if
> no one has any objections.
>
>
> Let me know if there's any questions or comments. One thing that's not
>> supported right now are the Style extension end points. I still need to
>> look at how those are handled. Many of the extensions lack their own tests
>> for this though.
>>
>> I've done a little bit of testing against a previous GeoServer release
> using YSLD, and I found Style "PUT" seems quite buggy, so this seems like
> an opportunity for improvement. The answer to "how those are handled" might
> be pretty close to "they aren't".
>
> Torben
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to