Refine search
/** * Returns a {@link Converter} for converting {@code type} to an HTTP request body, or null if * {@code type} cannot be handled by this factory. This is used to create converters for types * specified by {@link Body @Body}, {@link Part @Part}, and {@link PartMap @PartMap} * values. */ public @Nullable Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { return null; }
RxJavaCallAdapter(Type responseType, @Nullable Scheduler scheduler, boolean isAsync, boolean isResult, boolean isBody, boolean isSingle, boolean isCompletable) { this.responseType = responseType; this.scheduler = scheduler; this.isAsync = isAsync; this.isResult = isResult; this.isBody = isBody; this.isSingle = isSingle; this.isCompletable = isCompletable; }
/** * Invoked immediately after a socket connection was attempted. * * <p>If the {@code call} uses HTTPS, this will be invoked after * {@link #secureConnectEnd(Call, Handshake)}, otherwise it will invoked after * {@link #connectStart(Call, InetSocketAddress, Proxy)}. */ public void connectEnd(Call call, InetSocketAddress inetSocketAddress, Proxy proxy, @Nullable Protocol protocol) { }
/** * Returns the raw response received from the cache. Will be null if this response didn't use the * cache. For conditional get requests the cache response and network response may both be * non-null. The body of the returned response should not be read. */ public @Nullable Response cacheResponse() { return cacheResponse; }
/** * Returns a request that includes a credential to satisfy an authentication challenge in {@code * response}. Returns null if the challenge cannot be satisfied. * * <p>The route is best effort, it currently may not always be provided even when logically * available. It may also not be provided when an authenticator is re-used manually in an * application interceptor, such as when implementing client-specific retries. */ @Nullable Request authenticate(@Nullable Route route, Response response) throws IOException; }
public RealResponseBody( @Nullable String contentTypeString, long contentLength, BufferedSource source) { this.contentTypeString = contentTypeString; this.contentLength = contentLength; this.source = source; }
/** * Sets the HTTP proxy that will be used by connections created by this client. This takes * precedence over {@link #proxySelector}, which is only honored when this proxy is null (which * it is by default). To disable proxy use completely, call {@code proxy(Proxy.NO_PROXY)}. */ public Builder proxy(@Nullable Proxy proxy) { this.proxy = proxy; return this; }
/** Sets the response cache to be used to read and write cached responses. */ public Builder cache(@Nullable Cache cache) { this.cache = cache; this.internalCache = null; return this; }
/** * The full HTTP response. This may be null if the exception was serialized. */ public @Nullable Response<?> response() { return response; } }
/** * Returns a call adapter for interface methods that return {@code returnType}, or null if it * cannot be handled by this factory. */ public abstract @Nullable CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit);
/** * Invoked when a connection attempt fails. This failure is not terminal if further routes are * available and failure recovery is enabled. * * <p>If the {@code call} uses HTTPS, this will be invoked after {@link #secureConnectEnd(Call, * Handshake)}, otherwise it will invoked after {@link #connectStart(Call, InetSocketAddress, * Proxy)}. */ public void connectFailed(Call call, InetSocketAddress inetSocketAddress, Proxy proxy, @Nullable Protocol protocol, IOException ioe) { }
/** * Invoked when an event source has been closed due to an error reading from or writing to the * network. Incoming events may have been lost. No further calls to this listener will be made. */ public void onFailure(EventSource eventSource, @Nullable Throwable t, @Nullable Response response) { } }
/** * Configure TLS extensions on {@code sslSocket} for {@code route}. * * @param hostname non-null for client-side handshakes; null for server-side handshakes. */ public void configureTlsExtensions(SSLSocket sslSocket, @Nullable String hostname, List<Protocol> protocols) { }
/** * Returns the connection the request will be executed on. This is only available in the chains * of network interceptors; for application interceptors this is always null. */ @Nullable Connection connection();
/** * Returns a {@link Converter} for converting an HTTP response body to {@code type}, or null if * {@code type} cannot be handled by this factory. This is used to create converters for * response types such as {@code SimpleResponse} from a {@code Call<SimpleResponse>} * declaration. */ public @Nullable Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) { return null; }
Retrofit(okhttp3.Call.Factory callFactory, HttpUrl baseUrl, List<Converter.Factory> converterFactories, List<CallAdapter.Factory> callAdapterFactories, @Nullable Executor callbackExecutor, boolean validateEagerly) { this.callFactory = callFactory; this.baseUrl = baseUrl; this.converterFactories = converterFactories; // Copy+unmodifiable at call site. this.callAdapterFactories = callAdapterFactories; // Copy+unmodifiable at call site. this.callbackExecutor = callbackExecutor; this.validateEagerly = validateEagerly; }
/** * Invoked immediately after a TLS connection was attempted. * * <p>This method is invoked after {@link #secureConnectStart}. */ public void secureConnectEnd(Call call, @Nullable Handshake handshake) { }
/** * Returns a non-null value if this response was passed to {@link Callback#onResponse} or returned * from {@link Call#execute()}. Response bodies must be {@linkplain ResponseBody closed} and may * be consumed only once. * * <p>This always returns null on responses returned from {@link #cacheResponse}, {@link * #networkResponse}, and {@link #priorResponse()}. */ public @Nullable ResponseBody body() { return body; }
/** * Returns the raw response received from the network. Will be null if this response didn't use * the network, such as when the response is fully cached. The body of the returned response * should not be read. */ public @Nullable Response networkResponse() { return networkResponse; }