Fix bugs in URL parsing and truncation of request content

Fixes the following issues:

1. Previously it was possible to pass invalid URLs which caused tests to pass but code to fail when deployed to a container. Switched to using java.net.URL object for more complete URL parsing and validation.
2. getRequestURL was returning path instead of complete URL. 
3. Request body was occasionally being truncated by StringInputStream. Replaced with ByteArrayInputStream which respects the set character encoding of the request.