You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by Remy Gendron <re...@arrova.ca> on 2008/04/09 20:27:01 UTC
DELETE of inexisting resource... weak api
Hi all,
GET and PUT properly handle an invalid resource request and return a 404.
However, the way the delete is handled in AbstractEntityCollectionAdapter
does not allow the implementation to indicate that a 404 should be returned.
Currently, all I can do is throw an exception and have Abdera return an
error or (this is what I do), still return a 204 if the entry does not
exist.
Maybe void AbstractEntityCollectionAdapter.deleteEntry(String,
RequestContext) should be refactored to either return a Boolean or an
EmpyResponseContext.
Should I enter a JIRA?
Thanks again for the great work!
Rémy
RE: DELETE of inexisting resource... weak api
Posted by Remy Gendron <re...@arrova.ca>.
You are right in that the end result will be the same as returning an
EmptyResponseContext(404).
However, some logging will occur that could have someone believe that an
error occurred. More importantly, the ClientResponse.getType() will return
CLIENT_ERROR. A 404 on a GET or PUT returns a ResponseType.SUCCESS.
Remy
-----Original Message-----
From: Dan Diephouse [mailto:dan.diephouse@mulesource.com]
Sent: April 9, 2008 14:30
To: abdera-dev@incubator.apache.org
Subject: Re: DELETE of inexisting resource... weak api
Hi,
Couldn't you just do "throw new ResponseContextException(404);" ?
Dan
Remy Gendron wrote:
> Hi all,
>
>
>
> GET and PUT properly handle an invalid resource request and return a 404.
>
>
>
> However, the way the delete is handled in AbstractEntityCollectionAdapter
> does not allow the implementation to indicate that a 404 should be
returned.
>
>
>
> Currently, all I can do is throw an exception and have Abdera return an
> error or (this is what I do), still return a 204 if the entry does not
> exist.
>
>
>
> Maybe void AbstractEntityCollectionAdapter.deleteEntry(String,
> RequestContext) should be refactored to either return a Boolean or an
> EmpyResponseContext.
>
>
>
> Should I enter a JIRA?
>
>
>
> Thanks again for the great work!
>
>
>
>
>
> Rémy
>
>
>
--
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com
--
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.10/1367 - Release Date: 09/04/2008
7:10 AM
RE: DELETE of inexisting resource... weak api
Posted by Remy Gendron <re...@arrova.ca>.
You are right James, my unit tests confirm that 404 on a GET is associated
with CLIENT_ERROR. Thus, the current response type of CLIENT_ERROR for a
DELETE on a non-existant resource is OK.
I will enter the Jira for the logging issue.
Thanks both,
Remy
-----Original Message-----
From: James M Snell [mailto:jasnell@gmail.com]
Sent: April 9, 2008 15:22
To: abdera-dev@incubator.apache.org
Subject: Re: DELETE of inexisting resource... weak api
Dan Diephouse wrote:
> [snip]
> 2. Fix the client side of it so it returns a SUCCESS on 404 and DELETE
> [snip]
-1. 404 is a client error as defined by RFC 2616. Defining it as a
SUCCESS would be a bug and would break existing code. For 404,
getType() should return CLIENT_ERROR and the client needs to check the
status code.
- James
--
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.10/1367 - Release Date: 09/04/2008
7:10 AM
Re: DELETE of inexisting resource... weak api
Posted by James M Snell <ja...@gmail.com>.
Dan Diephouse wrote:
> [snip]
> 2. Fix the client side of it so it returns a SUCCESS on 404 and DELETE
> [snip]
-1. 404 is a client error as defined by RFC 2616. Defining it as a
SUCCESS would be a bug and would break existing code. For 404,
getType() should return CLIENT_ERROR and the client needs to check the
status code.
- James
Re: DELETE of inexisting resource... weak api
Posted by Dan Diephouse <da...@mulesource.com>.
OK. I think the right fix is to:
1. Log the ResponseContextExceptions at DEBUG if status code < 500.
(Could've sworn I did this before...)
2. Fix the client side of it so it returns a SUCCESS on 404 and DELETE
Re: JIRA - that would be great!
Dan
Remy Gendron wrote:
> Effectively, my console is now full of stack traces when I run my unit
> tests, as I have my root logger set to INFO.
>
> Remy
>
> -----Original Message-----
> From: Dan Diephouse [mailto:dan.diephouse@mulesource.com]
> Sent: April 9, 2008 14:30
> To: abdera-dev@incubator.apache.org
> Subject: Re: DELETE of inexisting resource... weak api
>
> Hi,
> Couldn't you just do "throw new ResponseContextException(404);" ?
>
> Dan
>
> Remy Gendron wrote:
>
>> Hi all,
>>
>>
>>
>> GET and PUT properly handle an invalid resource request and return a 404.
>>
>>
>>
>> However, the way the delete is handled in AbstractEntityCollectionAdapter
>> does not allow the implementation to indicate that a 404 should be
>>
> returned.
>
>>
>>
>> Currently, all I can do is throw an exception and have Abdera return an
>> error or (this is what I do), still return a 204 if the entry does not
>> exist.
>>
>>
>>
>> Maybe void AbstractEntityCollectionAdapter.deleteEntry(String,
>> RequestContext) should be refactored to either return a Boolean or an
>> EmpyResponseContext.
>>
>>
>>
>> Should I enter a JIRA?
>>
>>
>>
>> Thanks again for the great work!
>>
>>
>>
>>
>>
>> Rémy
>>
>>
>>
>>
>
>
>
--
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com
RE: DELETE of inexisting resource... weak api
Posted by Remy Gendron <re...@arrova.ca>.
Effectively, my console is now full of stack traces when I run my unit
tests, as I have my root logger set to INFO.
Remy
-----Original Message-----
From: Dan Diephouse [mailto:dan.diephouse@mulesource.com]
Sent: April 9, 2008 14:30
To: abdera-dev@incubator.apache.org
Subject: Re: DELETE of inexisting resource... weak api
Hi,
Couldn't you just do "throw new ResponseContextException(404);" ?
Dan
Remy Gendron wrote:
> Hi all,
>
>
>
> GET and PUT properly handle an invalid resource request and return a 404.
>
>
>
> However, the way the delete is handled in AbstractEntityCollectionAdapter
> does not allow the implementation to indicate that a 404 should be
returned.
>
>
>
> Currently, all I can do is throw an exception and have Abdera return an
> error or (this is what I do), still return a 204 if the entry does not
> exist.
>
>
>
> Maybe void AbstractEntityCollectionAdapter.deleteEntry(String,
> RequestContext) should be refactored to either return a Boolean or an
> EmpyResponseContext.
>
>
>
> Should I enter a JIRA?
>
>
>
> Thanks again for the great work!
>
>
>
>
>
> Rémy
>
>
>
--
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com
--
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.10/1367 - Release Date: 09/04/2008
7:10 AM
Re: DELETE of inexisting resource... weak api
Posted by Dan Diephouse <da...@mulesource.com>.
Hi,
Couldn't you just do "throw new ResponseContextException(404);" ?
Dan
Remy Gendron wrote:
> Hi all,
>
>
>
> GET and PUT properly handle an invalid resource request and return a 404.
>
>
>
> However, the way the delete is handled in AbstractEntityCollectionAdapter
> does not allow the implementation to indicate that a 404 should be returned.
>
>
>
> Currently, all I can do is throw an exception and have Abdera return an
> error or (this is what I do), still return a 204 if the entry does not
> exist.
>
>
>
> Maybe void AbstractEntityCollectionAdapter.deleteEntry(String,
> RequestContext) should be refactored to either return a Boolean or an
> EmpyResponseContext.
>
>
>
> Should I enter a JIRA?
>
>
>
> Thanks again for the great work!
>
>
>
>
>
> Rémy
>
>
>
--
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com