The SLD file is moved and all of its images copied (copied because it might be used by multiple styles), this is all handled by GeoServerResourcePersister.

This works the same via GUI or REST. All that needs to happen is remove the IF-block that prevents it in the StyleController.

The only issue I see is that it is not possible to set workspace back to NULL. I don't see a clear way to resolve that, because it is a general principle of the geoserver REST that null values are ignored in PUTs (so the user must not specify fields that have not changed). Changing this principle for the workspace field only would break consistency and backwards compatibility. It is a functional question to think about.

On the other side, it is a not a very likely use case (changing workspace back to null). I just discovered that this is not even possible with the GUI, because the dropdown doesn't have null valid set to true. Nobody has complained about that either.

Kind Regards
Niels

On 15/07/2019 10:48, Andrea Aime wrote:
I believe changing workspace is allowed via UI right? If so, I don't see a reason to disallow from REST, provided it ends up behaving the same (see if the UI code moves only the style or also the symbols associated).

Cheers
Andrea

On Thu, Jul 11, 2019 at 10:43 AM Niels Charlier <[email protected] <mailto:[email protected]>> wrote:

    Hello,

    At the moment it is not possible to change the workspace of a
    style with
    a REST put request. This is explicitly prevented by a block of code:

    
https://github.com/geoserver/geoserver/blob/master/src/restconfig/src/main/java/org/geoserver/rest/catalog/StyleController.java#L474

    However, when this check is removed, it seems to work fine to
    change the
    workspace of a style this way. After all this is already allowed
    in the
    GUI, which does nothing special to implement it. It is the low level
    GeoServerResourcePersister that handles moving all the files to a
    different directory when a style workspace is changed. This is why it
    works fine with rest too.

    So, could the block of code preventing this perhaps be removed?

    One issue is however that is not possible to remove the workspace
    from a
    style. The rest services only changes specified properties, ignoring
    nulls, so it is not possible to change something back to null via the
    rest in general I think.

    Kind Regards

    Niels



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



--

Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- /Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail./

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

Reply via email to