Encode path segments in urls to prevent illegal uris thanks to layer names with spaces.

I have a geoserver instance where users can publish layers to the geoserver.  Because there are so many users that can publish to the geoserver we have been unable to prevent them from publishing layers with spaces in the names.  When there are spaces (or other certain characters), the rest api
is broken because the urls have spaces in them.

Obviously the best solution is to fix Geoserver so that a layer with a space in the name (or in the workspace name) does not break the REST API.  However that is a substantial amount of work and this change makes this library more robust in the face or inconsiderate geoserver
administrators so I decided to make the change here.  When I have time I would like to patch Geoserver as well but that is another issue.