Hi there,

The call to getInfo() and get() is due to the support of HTTP conditional
processing. We've fixed a related issue in ServerResource post-2.0 M5 so I
would recommend to try with a recent snapshot. Otherwise, you can also
called setConditional(false).

Also, note that in recent snapshots this part of ServerResource has been
refactored. You should instead override the getVariant(Method) method to
return your variants manually. Instead I would recommend leveraging the @Get
and @Delete annotations such as in:
http://www.restlet.org/documentation/2.0/firstResource

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com



-----Message d'origine-----
De : [email protected] [mailto:[email protected]] 
Envoyé : mardi 10 novembre 2009 19:01
À : [email protected]
Objet : DELETE goes to GET !!

Hi everyone,

I have writed a simple resource that extend "ServerResource" and override
"delete(Variant v)". When I do a DELETE request on this resource nothing
happened. So I have overrided "get(Variant v)" and now when I do a DELETE
request, the "get" method is called.
I have added many breakpoints and I can see that the get method is called
from the getInfo method..

But I don't want that, I want to delete a resource not to retrieve it and I
don't really understand why the default "getInfo(Variant v)" method call the
"get(Variant v)" method.

Can you help me ?

Thanks.


Here is my resource : 
public class TemplateResource extends ServerResource {
  @Override
  protected void init() {                 
    getVariants().put(Method.DELETE,  
        Arrays.asList(new Variant[]{
            new Variant(MediaType.TEXT_XML),
            new Variant(MediaType.APPLICATION_XML)
        }));
  }     
  @Override
  protected Representation get(Variant variant) throws ResourceException {
    System.out.println("GET "+getRequestAttributes().get("identifier"));
    return super.get(variant);
  }
  @Override
  protected Representation delete(Variant variant) throws ResourceException
{
    System.out.println("DELETE "+getRequestAttributes().get("identifier"));
    return Representation.createEmpty();
  }

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=24162
50

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2416496

Reply via email to