summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-01-07 05:38:13 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2010-01-07 05:38:13 +0000
commit5bbc0193a133fea18364e41c5946a2bc1fc17d59 (patch)
treef6590305a292ec03c816a87461fc5a858df33527
parent18fb28231619d72c47632fd861443e5a25ea6f5a (diff)
TUSCANY-3389 - Tyding up the http response to properly distinguish from authentication and authorization exceptions and send the proper http status code
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@896754 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java b/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
index 346a51e5e7..4f6f5c6077 100644
--- a/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
+++ b/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
@@ -97,11 +97,13 @@ public class JSONRPCServiceServlet extends JSONRPCServlet {
handleServiceRequest(request, response);
} catch(RuntimeException re) {
- if (re.getCause() instanceof javax.security.auth.login.FailedLoginException) {
- response.sendError(HttpServletResponse.SC_FORBIDDEN);
- }else if (re.getCause() instanceof javax.security.auth.login.LoginException) {
- response.setHeader("WWW-Authenticate", "BASIC realm=\"" + "ldap-realm" + "\"");
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ if(re.getCause() instanceof javax.security.auth.login.LoginException) {
+ if (re.getCause() instanceof javax.security.auth.login.FailedLoginException) {
+ response.setHeader("WWW-Authenticate", "BASIC realm=\"" + "ldap-realm" + "\"");
+ response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
+ }else {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN);
+ }
}
} finally {
HttpSession session = request.getSession(false);