SlingPostServlet returns 500 error instead of 404 when attempting to delete
non-existent resource
-------------------------------------------------------------------------------------------------
Key: SLING-1247
URL: https://issues.apache.org/jira/browse/SLING-1247
Project: Sling
Issue Type: Bug
Components: Servlets
Affects Versions: Servlets Post 2.0.4
Environment: Ubuntu Linux, Standalone Sling 5
Reporter: Andrew Khoury
Priority: Minor
According to this documentation at:
http://sling.apache.org/site/manipulating-content-the-slingpostservlet.html#ManipulatingContent-TheSlingPostServlet-ContentRemoval
if a resource trying to be deleted through the SlingPostServlet is not found,
the servlet should return a 404/Not Found status. It is instead returning a
500/Error status and raising an exception
$ curl -v -F":operation=delete" http://localhost:8080/content/this/doesnt/exist
* About to connect() to localhost port 8080 (#0)
* Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
> POST /content/this/doesnt/exist HTTP/1.1
> User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g
> zlib/1.2.3.3 libidn/1.10
> Host: localhost:8080
> Accept: */*
> Content-Length: 151
> Expect: 100-continue
> Content-Type: multipart/form-data;
> boundary=----------------------------9fdde738b8eb
>
< HTTP/1.1 100 Continue
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Server: Jetty(6.1.x)
<
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<title>Error while processing /content/this/doesnt/exist</title>
</head>
<body>
<h1>Error while processing /content/this/doesnt/exist</h1>
<table>
<tbody>
<tr>
<td>Status</td>
<td><div id="Status">500</div></td>
</tr>
<tr>
<td>Message</td>
<td><div
id="Message">org.apache.sling.api.resource.ResourceNotFoundException: Missing
source NonExistingResource, path=/content/this/doesnt/exist for
delete</div></td>
</tr>
<tr>
<td>Location</td>
<td><a href="/this/doesnt/exist"
id="Location">/this/doesnt/exist</a></td>
</tr>
<tr>
<td>Parent Location</td>
<td><a href="/this/doesnt"
id="ParentLocation">/this/doesnt</a></td>
</tr>
<tr>
<td>Path</td>
<td><div id="Path">/content/this/doesnt/exist</div></td>
</tr>
<tr>
<td>Referer</td>
<td><a href="" id="Referer"></a></td>
</tr>
<tr>
<td>ChangeLog</td>
<td><div id="ChangeLog"><pre></pre></div></td>
</tr>
</tbody>
</table>
<p><a href="">Go Back</a></p>
<p><a href="/this/doesnt/exist">Modified Resource</a></p>
<p><a href="/this/doesnt">Parent of Modified Resource</a></p>
</body>
* Connection #0 to host localhost left intact
* Closing connection #0
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.