I've encountered a little problem with my styles having an assigned workspace. For one, I've got to admit that I'm not really sure what good does it make to put a certain style inside a workspace. I just guessed that if that style was going to be used by layers in a workspace, I might aswell add that workspace to the style.
So far, so good. But yesterday I ran into a problem trying to add my WMS service's URL to a map viewer web app. Let me put you in situation.
Let's say I have L1 layer, in W1 workspace with a default style of S1, which is also assigned to W1. Even if so far I didn't have any problems, this particular webapp didn't want to load the L1 layer attached to that same W1 workspace and S1 style. Whenever it did a GetMap request, GeoServer would return a "S1 style not found" error.
So, I had a look at the request itself and I noticed that, while in all other requests the "STYLES" parameter was missing (actually it was set to "(...)&STYLES=&(...)"), in this request it was "STYLES=S1". In fact, if I removed that from the request it worked correctly. This, I'm guessing is because S1 was set as L1 layer's default style.
Surprisingly, considering a L2 layer inside W1 with S1 as style too, it worked perfectly. After a bit of messing around I decided to remove S1's attachment to W1 workspace and, yay!, it worked and I was able to visualize L1 layer. So yes, the problem is solved. Now, my question is...
What is the real purpose of adding a workspace to a style? Is it worth it in any aspect? Should I not worry at all about this and just remove the workspace from all my styles?
Thanks for your help and sorry if it was a little confusing :-)