diff options
author | Masaya Suzuki <masayasuzuki@google.com> | 2016-08-23 17:57:59 -0700 |
---|---|---|
committer | Masaya Suzuki <masayasuzuki@google.com> | 2016-08-23 18:06:51 -0700 |
commit | c4e209b20fe519f419be0300ed414350649df88f (patch) | |
tree | 2b9505f07f466d698b3615117a8061597642c8f2 /org.eclipse.jgit.http.server | |
parent | 1096652e71257720fcf5bc90ccfa367293bd8ce2 (diff) | |
download | jgit-c4e209b20fe519f419be0300ed414350649df88f.tar.gz jgit-c4e209b20fe519f419be0300ed414350649df88f.zip |
Add HTTP status code to ServiceMayNotContinueException
The exception can be thrown in a various reason, and sometimes 403
Forbidden is not appropriate. Make the HTTP status code customizable.
Change-Id: If2ef6f454f7479158a4e28a12909837db483521c
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Diffstat (limited to 'org.eclipse.jgit.http.server')
3 files changed, 3 insertions, 3 deletions
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java index a021c1ff5e..b3fad3d959 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java @@ -143,7 +143,7 @@ public class RepositoryFilter implements Filter { res.sendError(SC_UNAUTHORIZED, e.getMessage()); return; } catch (ServiceMayNotContinueException e) { - sendError(req, res, SC_FORBIDDEN, e.getMessage()); + sendError(req, res, e.getStatusCode(), e.getMessage()); return; } try { diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java index 7d4f21b5c4..a06bb1e9ed 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java @@ -139,7 +139,7 @@ abstract class SmartServiceInfoRefs implements Filter { if (e.isOutput()) buf.close(); else - sendError(req, res, SC_FORBIDDEN, e.getMessage()); + sendError(req, res, e.getStatusCode(), e.getMessage()); } } diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java index 8c27b712ba..a9a0c5b128 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java @@ -197,7 +197,7 @@ class UploadPackServlet extends HttpServlet { out.close(); } else if (!rsp.isCommitted()) { rsp.reset(); - sendError(req, rsp, SC_FORBIDDEN, e.getMessage()); + sendError(req, rsp, e.getStatusCode(), e.getMessage()); } return; |