From 0f248204dbd740fcbf3d88818e19e7f76a1b0e5f Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 7 Jan 2010 05:19:27 +0000 Subject: 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 --- .../sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sca-java-1.x/branches/sca-java-1.6/modules') 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); -- cgit v1.2.3