unicorn commit: ~ is HEAD method is not allowed fallback to GET

changeset:   1492:8c9db27d4f5e
tag:         tip
user:        Thomas Gambet <tgambet@w3.org>
date:        Tue Sep 14 13:41:14 2010 -0400
files:       src/org/w3c/unicorn/input/URIInputParameter.java
description:
~ is HEAD method is not allowed fallback to GET


diff -r 628b3bf4c0f8 -r 8c9db27d4f5e src/org/w3c/unicorn/input/URIInputParameter.java
--- a/src/org/w3c/unicorn/input/URIInputParameter.java	Tue Sep 14 13:16:27 2010 -0400
+++ b/src/org/w3c/unicorn/input/URIInputParameter.java	Tue Sep 14 13:41:14 2010 -0400
@@ -105,6 +105,12 @@
 				messages.add(message);
 			}
 			int responseCode = con.getResponseCode();
+			if (responseCode == 405) {
+				con = (HttpURLConnection) docUrl.openConnection();
+				con.setRequestMethod("GET");
+				con.connect();
+				responseCode = con.getResponseCode();
+			}
 			switch (responseCode) {
 			case HttpURLConnection.HTTP_UNAUTHORIZED:
 				throw new UnicornException(Message.ERROR, "$message_unauthorized_access");

Received on Tuesday, 14 September 2010 17:42:00 UTC