Resolves https://issues.apache.org/jira/browse/JCLOUDS-278

This patch resolves https://issues.apache.org/jira/browse/JCLOUDS-278, with changes made against the master branch. Code is the same as in https://github.com/jclouds/jclouds/pull/387 except for the test which is tweaked slightly based on changes that have been made to GeneratedHttpRequest since 1.5.x.