/** Returns the {@link HttpRequest} that has been setup by this builder so far. After using the request, it should be returned * to the pool via {@code Pools.free(request)}. */ public HttpRequest build () { validate(); HttpRequest request = httpRequest; httpRequest = null; return request; }
@Override public ServerSocket newServerSocket (Protocol protocol, String hostname, int port, ServerSocketHints hints) { return new NetJavaServerSocketImpl(protocol, hostname, port, hints); }
@Override public void sendHttpRequest (HttpRequest httpRequest, HttpResponseListener httpResponseListener) { netJavaImpl.sendHttpRequest(httpRequest, httpResponseListener); }
@Override public Socket newClientSocket (Protocol protocol, String host, int port, SocketHints hints) { return new NetJavaSocketImpl(protocol, host, port, hints); }
@Override public void cancelHttpRequest (HttpRequest httpRequest) { netJavaImpl.cancelHttpRequest(httpRequest); }
public AndroidNet (AndroidApplicationBase app, AndroidApplicationConfiguration configuration) { this.app = app; netJavaImpl = new NetJavaImpl(configuration.maxNetThreads); }
/** Sets the correct {@code ContentType} and encodes the given parameter map, then sets it as the content. */ public HttpRequestBuilder formEncodedContent (Map<String, String> content) { validate(); httpRequest.setHeader(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); String formEncodedContent = HttpParametersUtils.convertHttpParameters(content); httpRequest.setContent(formEncodedContent); return this; }
public NetJavaSocketImpl (java.net.Socket socket, SocketHints hints) { this.socket = socket; applyHints(hints); }
@Override public ServerSocket newServerSocket (Protocol protocol, int port, ServerSocketHints hints) { return new NetJavaServerSocketImpl(protocol, port, hints); }
@Override public void sendHttpRequest (HttpRequest httpRequest, final HttpResponseListener httpResponseListener) { netJavaImpl.sendHttpRequest(httpRequest, httpResponseListener); }
@Override public Socket newClientSocket (Protocol protocol, String host, int port, SocketHints hints) { return new NetJavaSocketImpl(protocol, host, port, hints); }
@Override public void cancelHttpRequest (HttpRequest httpRequest) { netJavaImpl.cancelHttpRequest(httpRequest); }
/** Sets the correct {@code ContentType} and encodes the given parameter map, then sets it as the content. */ public HttpRequestBuilder formEncodedContent (Map<String, String> content) { validate(); httpRequest.setHeader(HttpRequestHeader.ContentType, "application/x-www-form-urlencoded"); String formEncodedContent = HttpParametersUtils.convertHttpParameters(content); httpRequest.setContent(formEncodedContent); return this; }
/** Returns the {@link HttpRequest} that has been setup by this builder so far. After using the request, it should be returned * to the pool via {@code Pools.free(request)}. */ public HttpRequest build () { validate(); HttpRequest request = httpRequest; httpRequest = null; return request; }
@Override public ServerSocket newServerSocket (Protocol protocol, int port, ServerSocketHints hints) { return new NetJavaServerSocketImpl(protocol, port, hints); }
@Override public void sendHttpRequest (HttpRequest httpRequest, HttpResponseListener httpResponseListener) { netJavaImpl.sendHttpRequest(httpRequest, httpResponseListener); }
@Override public ServerSocket newServerSocket (Protocol protocol, int port, ServerSocketHints hints) { return new NetJavaServerSocketImpl(protocol, port, hints); }
@Override public ServerSocket newServerSocket (Protocol protocol, String hostname, int port, ServerSocketHints hints) { return new NetJavaServerSocketImpl(protocol, hostname, port, hints); }
@Override public ServerSocket newServerSocket (Protocol protocol, int port, ServerSocketHints hints) { return new NetJavaServerSocketImpl(protocol, port, hints); }
@Override public ServerSocket newServerSocket (Protocol protocol, String hostname, int port, ServerSocketHints hints) { return new NetJavaServerSocketImpl(protocol, hostname, port, hints); }