[Geoserver-devel] the servlet mapping problem take 2

Hi all,

Revisiting the issue that was discussed in this thread:

http://old.nabble.com/the-servlet-mapping-problem-td26830074.html

To recap the major hole that was brought up by David in that having conflicting mappings would be in the end a bad idea. But keeping on this track I came up with a way to avoid having to do the wild card mapping such as /*/wfs in order to support the desired url for virtual workspaces:

/geoserver/<workspace>/<service>

The idea was to extend the SimpleUrlHandlerMapping that is used to map partial paths to a spring controller endpoint such as the ows dispatcher. The subclass would use the regular mappings:

/wfs
/wfs/*

But in the case of not a direct match check the workspace prefixing / virtual service case. The upshot is that we end up with an implicit set of discrete mappings:

/topp/wfs
/nurc/wfs
...

Without having to use the wild card.

However there is still the possibility of overlap. For instance if one created a workspace named "rest" there would be a conflict with the rest mappings.

Thoughts? To recap the upsides:

1) single mapping in web.xml
2) the desired aesthetic url structure of /geoserver/<workspace>/<service>

The downside:

1) Potential conflicts.

We could address the downside with some workspace name validation. Since we are basically agreeing that any spring dispatch mapping will need to start with a non wild card we could validate a workspace name against the first component of each mapping. It could be done dynamically by looking up all the UrlHandlerMappings in the application context.

Thoughts?

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.