Use of DELETE method

sjr
2010-11-09
2013-04-26
  • sjr

    sjr - 2010-11-09

    I'm new to httpunit, and having a problem issuing an HTTP DELETE request. Here's a snippet

    private WebResponse httpDelete(String destination) throws Exception
    {
        WebConversation wc = new WebConversation();
        wc.setExceptionsThrownOnErrorStatus(false);
        HeaderOnlyWebRequest req = new GetMethodWebRequest(destination);
        System.out.println("Method before: " + req.getMethod());
        req.setMethod("DELETE");
        System.out.println("Method after: " + req.getMethod());
        return wc.getResponse(req);
    }

    The console shows GET as the method both before and after the call to setMethod, and the server sees a GET when the getResponse is issued, so it's not just a problem reporting the method. My company's policy towards  OS s/w prevents me from examining the source… any help gratefully received.

    Thanks.

     
  • sjr

    sjr - 2010-11-09

    BTW, my first thought was to change the relevant line to:

    HeaderOnlyWebRequest req = new HeaderOnlyWebRequest (destination);

    …but the HeaderOnlyWebRequest constructors are protected.

     
  • sjr

    sjr - 2010-11-09

    Oops - should have posted the above to Help, I suppose :(

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks