diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-07 05:19:27 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2010-01-07 05:19:27 +0000 |
commit | 0f248204dbd740fcbf3d88818e19e7f76a1b0e5f (patch) | |
tree | 33351d72b4b4013d6d06d8198db61f5756ba54b6 /sca-java-1.x/branches | |
parent | 59d8b4fd967f993542ecf3b4b9dc3bd2a89aa5bb (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@896752 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches')
-rw-r--r-- | sca-java-1.x/branches/sca-java-1.6/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.6/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java b/sca-java-1.x/branches/sca-java-1.6/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/branches/sca-java-1.6/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java +++ b/sca-java-1.x/branches/sca-java-1.6/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); |