Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.devbliss.doctest.httpfactory;
 
 import static com.devbliss.doctest.httpfactory.HttpConstants.ENCODING;
 import static com.devbliss.doctest.httpfactory.HttpConstants.HANDLE_REDIRECTS;
 
 import java.net.URI;
 
Implements a DELETE HTTP request which does not handle any redirect.

Author(s):
bmary
public class DeleteWithoutRedirectImpl implements DeleteFactory {
    private final Gson gson;
    @Inject
    public DeleteWithoutRedirectImpl(Gson gson) {
        this. = gson;
    }
    public HttpDeleteWithBody createDeleteRequest(URI uriObject payloadthrows IOException {
        HttpDeleteWithBody httpDelete = new HttpDeleteWithBody(uri);
        HttpParams params = new BasicHttpParams();
        params.setParameter(false);
        httpDelete.setParams(params);
        if (payload != null) {
            String json = .toJson(payload);
            StringEntity entity = new StringEntity(json);
            entity.setContentType(..getMimeType());
            httpDelete.setEntity(entity);
        }
        return httpDelete;
    }
    public HttpDelete createDeleteRequest(URI urithrows IOException {
        HttpDelete httpDelete = new HttpDelete(uri);
        HttpParams params = new BasicHttpParams();
        params.setParameter(false);
        httpDelete.setParams(params);
        return httpDelete;
    }
New to GrepCode? Check out our FAQ X