How to configure the HTTP MOVE query using HttpURLConnection?


How to set HTTP request method MOVE using HttpURLConnection ?

Using HttpURLConnection or libraries that rely on that class, the code is throwing an exception Caused by: Invalid HTTP method: MOVE. So I guess the MOVE method is not supported by the Java platform.

Is there a patch or workaround for this issue / limitation? The workaround could be another java library for creating HTTP requests.

EDIT: Note that the MOVE verb is supported WebDav HTTP extension. There is also PATCH extension that was later added to the protocol.

For reference here is SkyDrive API with the move feature we are trying to implement.

Note that the Ruby platform supports the MOVE method. I wonder why java does not supports or even allow those extensions.

It's a bug in HttpURLConnection. If you don't want to switch to a different library, you can try to overwrite the method using introspection (yes, that's what Jersey does, see