[Geoserver-devel] Styles and virtual services

Hi,

I found a strange behavior with styles and virtual services.

I moved style 'simple_roads' to workspace 'topp' and layer 'tiger_roads' belonging to workspace 'tiger' can use that style.

Performing a virtual service GetCapabilities request in the context of 'tiger' workspace:
http://localhost:8080/geoserver/tiger/ows?service=wms&version=1.3.0&request=GetCapabilities

will list layer 'tiger_roads' that will contains a reference to 'topp:simple_roads' style:

  <Style>
    <Name>topp:simple_roads</Name>
    <Title>Default Styler for simple road segments</Title>
    <Abstract>Light red line, 2px wide</Abstract>
    <LegendURL width="20" height="20">
      <Format>image/png</Format>
      <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink&quot; xlink:type="simple" xlink:href="http://localhost:8080/geoserver/tiger/ows?s
ervice=WMS&amp;request=GetLegendGraphic&amp;format=image%2Fpng&amp;width=20&amp;height=20&amp;layer=tiger_roads&amp;style=simple_roads"/>;
    </LegendURL>
  </Style>

The provided GetLegend URL will not work and there is no way to use style 'topp:simple_roads' when performing a virtual service request in
the context of 'tiger' workspace:

http://localhost:8080/geoserver/tiger/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&STYLES=topp:simple_ro
ads&LAYERS=tiger_roads&SRS=EPSG%3A4326&WIDTH=476&HEIGHT=768&BBOX=-74.00768280029297%2C40.71910858154297%2C
-73.92597198486328%2C40.85094451904297

this request will fail saying that style 'topp:simple' is unknown.

What should be the correct behavior of this ? In my opinion style 'topp:simple_roads' should not have been listed in the virtual service
GetCapabilities result.

When chatting about this with Andrea he raised a corner case ... what to do if 'topp:simple_roads' is the default style and we are making a
query without any style in the context of 'tiger' workspace virtual service ?

If the default style of layer doesn't belong to the virtual service workspace the layer should not be listed in the virtual service
GetCapabilities result ? Or internally we apply some kind of default style ?geo

Regards,

Nuno Oliveira

--

GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information.

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 333 8128928

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono
da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate
nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e
-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo
anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of
the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree
June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying,
distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender does not give any warranty or accept liability as the content,
accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which
arise as a result of e-mail transmission, viruses, etc.

On 24 June 2016 at 06:53, Nuno Oliveira <nuno.oliveira@anonymised.com>
wrote:

The provided GetLegend URL will not work and there is no way to use style
'topp:simple_roads' when performing a virtual service request in
the context of 'tiger' workspace:

http://localhost:8080/geoserver/tiger/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&STYLES=topp:simple_ro

ads&LAYERS=tiger_roads&SRS=EPSG%3A4326&WIDTH=476&HEIGHT=768&BBOX=-74.00768280029297%2C40.71910858154297%2C
-73.92597198486328%2C40.85094451904297

this request will fail saying that style 'topp:simple' is unknown.

What should be the correct behavior of this ? In my opinion style
'topp:simple_roads' should not have been listed in the virtual service
GetCapabilities result.

I agree, if it does not work it should not be listed. We then get the
corner case of the default style (as Andrea pointed out) or if none of the
configured styles are available in that workspace.

The global workspace styles directory is a bit odd, I can never quite sort
out:
- if all the global styles are supposed to be "present" in all workspace
(and each workspace has a chance to add or override additional styles)
- or if styles can be referenced from anywhere with the right prefix
(leading us into this trouble you are finding where styles are referenced
that should not be visible from a neighbouring workspace)

I expect that the codebase is very lax (to preserve backwards compatibility
when virtual services were introduced). I would like to gradually steer the
project towards better fences between workspaces (in case a user does not
have permission to see over the fence the styles could reveal something
about the data being published there).

When chatting about this with Andrea he raised a corner case ... what to do

if 'topp:simple_roads' is the default style and we are making a
query without any style in the context of 'tiger' workspace virtual
service ?

If the default style of layer doesn't belong to the virtual service
workspace the layer should not be listed in the virtual service
GetCapabilities result ? Or internally we apply some kind of default style.

We have our ultimate backup style - geometry - that should work with any
and all content. That would probably be preferable to not listing the layer.