Let\'s presume that I have string like \'=&?/;#+%\' to be a part of my URL, let\'s say like this:
example.com/servletPath/someOtherPath/myString/something.ht
It seems like you are trying to do something RESTy (use Jersey). Can's you just parse off the leading and trailing parts of the URL to get the data you are looking for?
url.substring(startLength, url.length - endLength);