diff options
author | bdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-21 23:54:27 +0000 |
---|---|---|
committer | bdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-21 23:54:27 +0000 |
commit | e3a642e8c03d0686ae070dc30ca42fa622fb3e89 (patch) | |
tree | 4bc4c6e3d23016ab5329adb88b90874aaa3452dc /branches | |
parent | a59e0a56017d05b0e977d4e6c914cc9ecd052a2a (diff) |
TUSCANY-2932 Correctly handle NotFoundException as a 404 in AtomBindingListenerServlet
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@757107 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
-rw-r--r-- | branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java b/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java index f6c713fae7..f92102535b 100644 --- a/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java +++ b/branches/sca-java-1.x/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java @@ -347,7 +347,14 @@ class AtomBindingListenerServlet extends HttpServlet { requestMessage.setBody(new Object[] {id}); Message responseMessage = getInvoker.invoke(requestMessage); if (responseMessage.isFault()) { - throw new ServletException((Throwable)responseMessage.getBody()); + Object body = responseMessage.getBody(); + if (body.getClass().getName().endsWith(".NotFoundException")) { + response.sendError(HttpServletResponse.SC_NOT_FOUND); + return; + } else { + throw new ServletException((Throwable)responseMessage.getBody()); + } + } if (supportsFeedEntries) { // The service implementation returns a feed entry @@ -538,7 +545,7 @@ class AtomBindingListenerServlet extends HttpServlet { } // Get the request path - String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8"); + String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length() + request.getContextPath().length()), "UTF-8"); if (path == null || path.length() == 0 || path.equals("/")) { org.apache.abdera.model.Entry createdFeedEntry = null; @@ -749,7 +756,7 @@ class AtomBindingListenerServlet extends HttpServlet { } // Get the request path - String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8"); + String path = URLDecoder.decode(request.getRequestURI().substring(request.getContextPath().length() + request.getServletPath().length()), "UTF-8"); String id; if (path != null && path.startsWith("/")) { |