/** * 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); }
/** * Same as {@link #getResponseHeader(String)} except parses the header value using the specified part parser and schema. * * @param name The header name. * @param partParser The part parser to use for parsing the header. * @param schema The part schema. Can be <jk>null</jk>. * @param type The type to convert the part into. * @param args The type arguments to convert the part into. * @return The parsed part. * @throws IOException * @throws ParseException */ public <T> T getResponseHeader(HttpPartParser partParser, HttpPartSchema schema, String name, Type type, Type...args) throws IOException, ParseException { try { HttpResponse r = getResponse(); Header h = r.getFirstHeader(name); if (h == null) return null; String hs = h.getValue(); if (partParser == null) partParser = client.getPartParser(); return partParser.parse(schema, hs, type, args); } catch (IOException e) { isFailed = true; close(); throw e; } }
/** * Same as {@link #getResponseHeader(String)} except parses the header value using the specified part parser and schema. * * @param name The header name. * @param partParser The part parser to use for parsing the header. * @param schema The part schema. Can be <jk>null</jk>. * @param type The type to convert the part into. * @param args The type arguments to convert the part into. * @return The parsed part. * @throws IOException * @throws ParseException */ public <T> T getResponseHeader(HttpPartParser partParser, HttpPartSchema schema, String name, Type type, Type...args) throws IOException, ParseException { try { HttpResponse r = getResponse(); Header h = r.getFirstHeader(name); if (h == null) return null; String hs = h.getValue(); if (partParser == null) partParser = client.getPartParser(); return partParser.parse(schema, hs, type, args); } catch (IOException e) { isFailed = true; close(); throw e; } }
/** * Same as {@link #getResponseHeader(String)} except parses the header value using the specified part parser and schema. * * @param name The header name. * @param partParser The part parser to use for parsing the header. * @param schema The part schema. Can be <jk>null</jk>. * @param type The type to convert the part into. * @param args The type arguments to convert the part into. * @return The parsed part. * @throws IOException * @throws ParseException */ public <T> T getResponseHeader(HttpPartParser partParser, HttpPartSchema schema, String name, Type type, Type...args) throws IOException, ParseException { try { HttpResponse r = getResponse(); Header h = r.getFirstHeader(name); if (h == null) return null; String hs = h.getValue(); if (partParser == null) partParser = client.getPartParser(); return partParser.parse(schema, hs, type, args); } catch (IOException e) { isFailed = true; close(); throw e; } }
Class<T> c = (Class<T>)rbm.getClassMeta().getInnerClass(); final RestClient rc = this.client; final HttpPartParser p = ObjectUtils.firstNonNull(partParser, rc.getPartParser()); return (T)Proxy.newProxyInstance( c.getClassLoader(),
Class<T> c = (Class<T>)rbm.getClassMeta().getInnerClass(); final RestClient rc = this.client; final HttpPartParser p = ObjectUtils.firstNonNull(partParser, rc.getPartParser()); return (T)Proxy.newProxyInstance( c.getClassLoader(),
Class<T> c = (Class<T>)rbm.getClassMeta().getInnerClass(); final RestClient rc = this.client; final HttpPartParser p = ObjectUtils.firstNonNull(partParser, rc.getPartParser()); return (T)Proxy.newProxyInstance( c.getClassLoader(),