# sprint-2 Fixed post on redirect.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d3a3a3e5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d3a3a3e5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d3a3a3e5 Branch: refs/heads/ignite-release-test-no-mod Commit: d3a3a3e5d2a018471eabf145da0e2dadf595758c Parents: f589cfa Author: anovikov <anovi...@gridgain.com> Authored: Thu Mar 5 23:23:15 2015 +0700 Committer: anovikov <anovi...@gridgain.com> Committed: Thu Mar 5 23:23:15 2015 +0700 ---------------------------------------------------------------------- .../apache/ignite/internal/GridUpdateNotifier.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d3a3a3e5/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java b/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java index 3d491ec..903171f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java @@ -83,7 +83,6 @@ class GridUpdateNotifier { * * @param gridName gridName * @param ver Compound Ignite version. - * @param site Site. * @param reportOnlyNew Whether or not to report only new version. * @param gw Kernal gateway. * @throws IgniteCheckedException If failed. @@ -260,6 +259,13 @@ class GridUpdateNotifier { /** {@inheritDoc} */ @Override protected void body() throws InterruptedException { + // Set the http.strictPostRedirect property to prevent redirected POST from being mapped to a GET. + // This system property was a hack to fix a jdk bug w/out changing back compat behavior. + // It's bogus that this is a system (and not a per-connection) property, + // so we just change it for the duration of the connection. + // See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4023866 + String postRedirect = System.getProperty("http.strictPostRedirect"); + try { String stackTrace = gw != null ? gw.userStackTrace() : null; @@ -280,6 +286,8 @@ class GridUpdateNotifier { conn.setConnectTimeout(3000); conn.setReadTimeout(3000); + System.setProperty("http.strictPostRedirect", "true"); + Document dom = null; try { @@ -320,6 +328,12 @@ class GridUpdateNotifier { if (log.isDebugEnabled()) log.debug("Unexpected exception in update checker. " + e.getMessage()); } + finally { + if (postRedirect == null) + System.clearProperty("http.strictPostRedirect"); + else + System.setProperty("http.strictPostRedirect", postRedirect); + } } /**