Implement FOO method by extending HttpRequestBase as follows:
public class HttpFoo extends HttpRequestBase{
public final static String METHOD_NAME = "FOO";
public HttpFoo() {
super();
}
@Override
public String getMethod() {
return METHOD_NAME;
}
public HttpFoo(final String uri) {
super();
setURI(URI.create(uri));
}
public String getName() {
return "FOO";
}
}
And then the above method can be used just like any other existing methods like GET(HttpGet) etc.
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpFoo fooMethod = new HttpFoo(fooUrl);
HttpResponse response = httpClient.execute(fooMethod);
Have tested with
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>