io.femo.http.drivers.DefaultDriver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http-jdk7 Show documentation
Show all versions of http-jdk7 Show documentation
An easy to use HTTP API, that supports synchronous and asynchronous execution of HTTP request.
On android only asynchronous driver is supported.
This library has been backported to jdk 7 to retain compatibility with android!
The newest version!
package io.femo.http.drivers;
import io.femo.http.HttpDriver;
import io.femo.http.HttpRequest;
import io.femo.http.HttpResponse;
import io.femo.http.HttpServer;
import java.net.URL;
/**
* Created by felix on 9/11/15.
*/
public class DefaultDriver extends HttpDriver {
@Override
public HttpRequest url(URL url) {
HttpRequest request = new DefaultHttpRequest(url);
if(url.getProtocol().toLowerCase().equals("https")) {
request.https();
}
return request;
}
@Override
public HttpServer server(int port, boolean ssl) {
return new DefaultHttpServer(port, ssl);
}
}