/** * Sets the address from which client requests will originate. * * @param address The address from which client requests will originate. * @return This factory object. */ @Nonnull public final BaseResourceClientFactory<B, C> setSourceAddress(@Nonnull final String address) { sourceAddress = address; return this; }
/** * Gets the maximum period of inactivity between two consecutive data packets in milliseconds. * * @param timeout The maximum period of inactivity between two consecutive data packets in milliseconds. * @return This factory object. */ public final BaseResourceClientFactory<B, C> setSocketTimeout(@Nonnull final Integer timeout) { socketTimeout = timeout; return this; }
/** * Sets Whether HTTP redirects will be followed. * * @param follow Whether HTTP redirects will be followed. * @return This factory object. */ public final BaseResourceClientFactory<B, C> setFollowRedirects(@Nonnull final Boolean follow) { followRedirects = follow; return this; }
/** * Sets the Maximum number of redirects that will be followed if following of redirects is enabled. * * @param max Maximum number of redirects that will be followed if following of redirects is enabled. * @return this factory object. */ public final BaseResourceClientFactory<B, C> setMaxRedirects(@Nonnull final int max) { maxRedirects = max; return this; }
/** * Returns the base URL used to connect to the service. * * @return The base URL used to connect to the service. */ @Nonnull public final String getServiceBaseUrl() { return serviceBaseUrl; }
/** * Sets the Socket buffer size in bytes. * * @param bufferSize The Socket buffer size in bytes. * @return this factory object. */ public final BaseResourceClientFactory<B, C> setSocketBufferSize(@Nonnull final Integer bufferSize) { socketBufferSize = bufferSize; return this; }
/** * Sets Whether connections will automatically be closed by server after the response is sent. * * @param enabled Whether connections will automatically be closed by server after the response is sent. * @return this factory object. */ public final BaseResourceClientFactory<B, C> setConnectionCloseAfterResponseEnabled(@Nonnull final Boolean enabled) { connectionCloseAfterResponseEnabled = enabled; return this; }
/** * Sets the maximum number of concurrent connections allowed. * * @param max Maximum number of concurrent connections allowed. * @return this factory instance. */ @Nonnull public final BaseResourceClientFactory<B, C> setMaxConcurrentRequests(@Nonnull final Integer max) { maxConcurrentRequests = max; return this; }
/** * Sets the given invocation context on the current thread. * * @param context The invocation context to set. */ static void set(@Nonnull ClientInitializationContext context) { THREADLOCAL.set(context); log.debug("Set invocation context on thread local: {}", context); }
/** {@inheritDoc} **/ @Nonnull public CheckedFuture<List<T>, ServiceException> search(@Nonnull Multimap<String, String> searchCriteria, @Nullable SortCriteria sortCriteria, @Nonnull Page page, @Nonnull HttpContext httpContext) { return search(searchCriteria, sortCriteria, page, httpContext, crudOperationContentType, searchEndpoint); }
/** {@inheritDoc} */ @Nonnull public String toString() { return Objects.toStringHelper(this).add("clientFactory", clientFactory).toString(); }
/** * Sets the writers used by the client to produce request bodies. * * @param writers writers used by the client to produce request bodies */ final void setEntityWriters(@Nonnull @NonnullElements List<EntityWriter> writers) { entityWriters = new ImmutableList.Builder().addAll(Iterables.filter(writers, Predicates.notNull())).build(); }
/** * Sets the template used to get a resource by its ID. The template must have a single variable named * {@value #ID_URL_VAR}. * * @param endpoint template used to get a resource by its ID */ final void setGetByIdEndpointTemplate(@Nonnull UriTemplate endpoint) { getByIdEndpointTemplate = isValidByIdTemplate(endpoint); }
/** * Sets the template used to update a resource by its ID. The template must have a single variable named * {@value #ID_URL_VAR}. * * @param endpoint template used to update a resource by its ID */ final void setUpdateEndpointTemplate(@Nonnull UriTemplate endpoint) { updateEndpointTemplate = isValidByIdTemplate(endpoint); }
/** * Sets the template used to delete a resource by its ID. The template must have a single variable named * {@value #ID_URL_VAR}. * * @param endpoint template used to delete a resource by its ID */ final void setDeleteEndpointTemplate(@Nonnull UriTemplate endpoint) { deleteEndpointTemplate = isValidByIdTemplate(endpoint); }
/** * Sets the endpoint used to add a resource. * * @param endpoint endpoint used to add a resource */ final void setAddEndpoint(@Nonnull @NotEmpty String endpoint) { addEndpoint = endpoint; }
/** * Constructor. * * @param statusCode a service-specific status code * @param message message describing this exception */ public InvalidRequestException(@Nonnull @NotEmpty String statusCode, @Nullable String message) { this(statusCode, message, null); }
/** * Constructor. * * @param statusCode a service-specific status code * @param message message describing this exception * @param cause a finer-grained error that this exception is wrapping */ public InvalidResponseException(@Nonnull @NotEmpty String statusCode, @Nullable String message, @Nullable Throwable cause) { super(statusCode, message, cause); } }