/** * Adds a {@link RestCallLogger} to the list of interceptors on this class. * * @param level The log level to log events at. * @param log The logger. * @return This object (for method chaining). */ public RestCall logTo(Level level, Logger log) { interceptor(new RestCallLogger(level, log)); return this; }
/** * Adds a {@link RestCallLogger} to the list of interceptors on this class. * * @param level The log level to log events at. * @param log The logger. * @return This object (for method chaining). */ public RestCall logTo(Level level, Logger log) { interceptor(new RestCallLogger(level, log)); return this; }
/** * Adds a {@link RestCallLogger} to the list of interceptors on this class. * * @param level The log level to log events at. * @param log The logger. * @return This object (for method chaining). */ public RestCall logTo(Level level, Logger log) { interceptor(new RestCallLogger(level, log)); return this; }
/** * Adds a response pattern finder to look for regular expression matches in the response output. * * <p> * This method can be called multiple times to add multiple response pattern finders. * * <p> * {@link ResponsePattern ResponsePatterns} use the {@link #getCapturedResponse()} to read the response text and so * does not affect the other output methods such as {@link #getResponseAsString()}. * * @param responsePattern The response pattern finder. * @return This object (for method chaining). */ public RestCall responsePattern(final ResponsePattern responsePattern) { captureResponse(); interceptor( new RestCallInterceptor() { @Override public void onClose(RestCall restCall) throws RestCallException { responsePattern.match(RestCall.this); } } ); return this; }
/** * Adds a response pattern finder to look for regular expression matches in the response output. * * <p> * This method can be called multiple times to add multiple response pattern finders. * * <p> * {@link ResponsePattern ResponsePatterns} use the {@link #getCapturedResponse()} to read the response text and so * does not affect the other output methods such as {@link #getResponseAsString()}. * * @param responsePattern The response pattern finder. * @return This object (for method chaining). */ public RestCall responsePattern(final ResponsePattern responsePattern) { captureResponse(); interceptor( new RestCallInterceptor() { @Override public void onClose(RestCall restCall) throws RestCallException { responsePattern.match(RestCall.this); } } ); return this; }
/** * Adds a response pattern finder to look for regular expression matches in the response output. * * <p> * This method can be called multiple times to add multiple response pattern finders. * * <p> * {@link ResponsePattern ResponsePatterns} use the {@link #getCapturedResponse()} to read the response text and so * does not affect the other output methods such as {@link #getResponseAsString()}. * * @param responsePattern The response pattern finder. * @return This object (for method chaining). */ public RestCall responsePattern(final ResponsePattern responsePattern) { captureResponse(); interceptor( new RestCallInterceptor() { @Override public void onClose(RestCall restCall) throws RestCallException { responsePattern.match(RestCall.this); } } ); return this; }
/** * Constructs a REST call with the specified method name. * * @param client The client that created this request. * @param request The wrapped Apache HTTP client request object. * @param uri The URI for this call. * @throws RestCallException If an exception or non-200 response code occurred during the connection attempt. */ protected RestCall(RestClient client, HttpRequestBase request, URI uri) throws RestCallException { super(client, BeanSessionArgs.DEFAULT); this.client = client; this.request = request; for (RestCallInterceptor i : this.client.interceptors) interceptor(i); this.retryOn = client.retryOn; this.retries = client.retries; this.retryInterval = client.retryInterval; this.serializer = client.serializer; this.parser = client.parser; this.partSerializer = client.getPartSerializer(); this.partParser = client.getPartParser(); uriBuilder = new URIBuilder(uri); }
/** * Constructs a REST call with the specified method name. * * @param client The client that created this request. * @param request The wrapped Apache HTTP client request object. * @param uri The URI for this call. * @throws RestCallException If an exception or non-200 response code occurred during the connection attempt. */ protected RestCall(RestClient client, HttpRequestBase request, URI uri) throws RestCallException { super(client, BeanSessionArgs.DEFAULT); this.client = client; this.request = request; for (RestCallInterceptor i : this.client.interceptors) interceptor(i); this.retryOn = client.retryOn; this.retries = client.retries; this.retryInterval = client.retryInterval; this.serializer = client.serializer; this.parser = client.parser; this.partSerializer = client.getPartSerializer(); this.partParser = client.getPartParser(); uriBuilder = new URIBuilder(uri); }
/** * Constructs a REST call with the specified method name. * * @param client The client that created this request. * @param request The wrapped Apache HTTP client request object. * @param uri The URI for this call. * @throws RestCallException If an exception or non-200 response code occurred during the connection attempt. */ protected RestCall(RestClient client, HttpRequestBase request, URI uri) throws RestCallException { super(client, BeanSessionArgs.DEFAULT); this.client = client; this.request = request; for (RestCallInterceptor i : this.client.interceptors) interceptor(i); this.retryOn = client.retryOn; this.retries = client.retries; this.retryInterval = client.retryInterval; this.serializer = client.serializer; this.parser = client.parser; this.partSerializer = client.getPartSerializer(); this.partParser = client.getPartParser(); uriBuilder = new URIBuilder(uri); }