private CookieStore makeCookieStore(final HttpObjectConfig objectConfig) { if (objectConfig.getClient().getCookiesEnabled()) { final File folder = objectConfig.getClient().getCookieFolder(); return (folder == null ? new NonBlockingCookieStore() : new FileBackedCookieStore(folder, objectConfig.getExecution().getExecutor())); } else { return NullCookieStore.instance(); } }
@Override public void accept(final ChainedHttpConfig config, final ToServer ts) { final ChainedHttpConfig.ChainedRequest request = config.getChainedRequest(); final Object body = request.actualBody(); NativeHandlers.Encoders.checkTypes(body, MULTIPART_TYPES); MultipartContent mp = (MultipartContent) request.actualBody(); request.setContentType("multipart/form-data; boundary=" + mp.boundary()); ts.toServer(stream(config, mp)); }
private Object createAndExecute(final ChainedHttpConfig config, final String verb) { try { Action action = new Action(clientConfig.getClientCustomizer(), config, verb); return action.execute(); } catch (Exception e) { return handleException(config.getChainedResponse(), e); } }
protected JavaHttpBuilder(final HttpObjectConfig config) { super(config); this.config = new HttpConfigs.ThreadSafeHttpConfig(config.getChainedConfig()); this.executor = config.getExecution().getExecutor(); this.clientConfig = config.getClient(); this.hostnameVerifier = config.getExecution().getHostnameVerifier(); this.sslContext = config.getExecution().getSslContext(); this.proxyInfo = config.getExecution().getProxyInfo(); }
public ThreadSafeHttpConfig(final ChainedHttpConfig parent) { super(parent); if(parent == null) { this.request = new ThreadSafeRequest(null); this.response = new ThreadSafeResponse(null); } else { this.request = new ThreadSafeRequest(parent.getChainedRequest()); this.response = new ThreadSafeResponse(parent.getChainedResponse()); } }
@Override public Request getRequest() { final HttpConfigs.BasicRequest request = new HttpConfigs.BasicRequest(null); final Charset charset = config.getChainedRequest().getCharset(); request.setCharset(charset != null ? charset : StandardCharsets.UTF_8); request.setContentType(contentType); request.setBody(content); return request; }
public BasicHttpConfig(final ChainedHttpConfig parent) { super(parent); if(parent == null) { this.request = new BasicRequest(null); this.response = new BasicResponse(null); } else { this.request = new BasicRequest(parent.getChainedRequest()); this.response = new BasicResponse(parent.getChainedResponse()); } }
default BiFunction<ChainedHttpConfig, FromServer, Object> actualParser(final String contentType) { final Function<ChainedResponse, BiFunction<ChainedHttpConfig, FromServer, Object>> theValue = (cr) -> { BiFunction<ChainedHttpConfig, FromServer, Object> ret = cr.parser(contentType); if (ret != null) { return ret; } else { return cr.parser(ContentTypes.ANY.getAt(0)); } }; return traverse(this, (cr) -> cr.getParent(), theValue, Traverser::notNull); } }
default BiConsumer<ChainedHttpConfig, ToServer> actualEncoder(final String contentType) { final Function<ChainedRequest, BiConsumer<ChainedHttpConfig, ToServer>> theValue = (cr) -> { BiConsumer<ChainedHttpConfig, ToServer> ret = cr.encoder(contentType); if (ret != null) { return ret; } else { return cr.encoder(ContentTypes.ANY.getAt(0)); } }; return traverse(this, (cr) -> cr.getParent(), theValue, Traverser::notNull); }
default BiConsumer<ChainedHttpConfig, ToServer> actualEncoder(final String contentType) { final Function<ChainedRequest, BiConsumer<ChainedHttpConfig, ToServer>> theValue = (cr) -> { BiConsumer<ChainedHttpConfig, ToServer> ret = cr.encoder(contentType); if (ret != null) { return ret; } else { return cr.encoder(ContentTypes.ANY.getAt(0)); } }; return traverse(this, ChainedRequest::getParent, theValue, Traverser::notNull); }
default BiFunction<ChainedHttpConfig, FromServer, Object> actualParser(final String contentType) { final Function<ChainedResponse, BiFunction<ChainedHttpConfig, FromServer, Object>> theValue = (cr) -> { BiFunction<ChainedHttpConfig, FromServer, Object> ret = cr.parser(contentType); if (ret != null) { return ret; } else { return cr.parser(ContentTypes.ANY.getAt(0)); } }; return traverse(this, ChainedResponse::getParent, theValue, Traverser::notNull); } }
public ThreadSafeRequest(final ChainedRequest parent) { super(parent); this.auth = new ThreadSafeAuth(); this.uriBuilder = (parent == null) ? UriBuilder.threadSafe(null) : UriBuilder.threadSafe(parent.getUri()); }
private CookieStore makeCookieStore(final HttpObjectConfig objectConfig) { if (objectConfig.getClient().getCookiesEnabled()) { final File folder = objectConfig.getClient().getCookieFolder(); return (folder == null ? new NonBlockingCookieStore() : new FileBackedCookieStore(folder, objectConfig.getExecution().getExecutor())); } else { return NullCookieStore.instance(); } }
public ThreadSafeHttpConfig(final ChainedHttpConfig parent) { super(parent); if(parent == null) { this.request = new ThreadSafeRequest(null); this.response = new ThreadSafeResponse(null); } else { this.request = new ThreadSafeRequest(parent.getChainedRequest()); this.response = new ThreadSafeResponse(parent.getChainedResponse()); } }
@Override public Request getRequest() { final HttpConfigs.BasicRequest request = new HttpConfigs.BasicRequest(null); final Charset charset = config.getChainedRequest().getCharset(); request.setCharset(charset != null ? charset : StandardCharsets.UTF_8); request.setContentType(contentType); request.setBody(content); return request; }
private Object createAndExecute(final ChainedHttpConfig config, final String verb) { try { Action action = new Action(clientConfig.getClientCustomizer(), config, verb); return action.execute(); } catch (Exception e) { return handleException(config.getChainedResponse(), e); } }
public BasicHttpConfig(final ChainedHttpConfig parent) { super(parent); if(parent == null) { this.request = new BasicRequest(null); this.response = new BasicResponse(null); } else { this.request = new BasicRequest(parent.getChainedRequest()); this.response = new BasicResponse(parent.getChainedResponse()); } }
default BiConsumer<ChainedHttpConfig, ToServer> actualEncoder(final String contentType) { final Function<ChainedRequest, BiConsumer<ChainedHttpConfig, ToServer>> theValue = (cr) -> { BiConsumer<ChainedHttpConfig, ToServer> ret = cr.encoder(contentType); if (ret != null) { return ret; } else { return cr.encoder(ContentTypes.ANY.getAt(0)); } }; return traverse(this, ChainedRequest::getParent, theValue, Traverser::notNull); }
public ThreadSafeRequest(final ChainedRequest parent) { super(parent); this.auth = new ThreadSafeAuth(); this.uriBuilder = (parent == null) ? UriBuilder.threadSafe(null) : UriBuilder.threadSafe(parent.getUri()); }
public ThreadSafeHttpConfig(final ChainedHttpConfig parent) { super(parent); if(parent == null) { this.request = new ThreadSafeRequest(null); this.response = new ThreadSafeResponse(null); } else { this.request = new ThreadSafeRequest(parent.getChainedRequest()); this.response = new ThreadSafeResponse(parent.getChainedResponse()); } }