private Map<String, Object> addVersionToOptions( final Map<String, Object> options, final Version version) { options.put("version", version.toString()); return options; }
/** * This is a migration method for global to processor options. Currently used * by the merge-processor which gets the 'source:once' option from the global * scope. */ private Map<String, Object> injectGlobalOptionsFallback( final Version version, final Manifest manifest, final String name, final Map<String, Object> options) { final Map<String, Object> copy = new HashMap<String, Object>(options); copy.put("version", version.toString()); if (manifest != null) { if ("merge".equals(name)) { copy.put("source", GlobalOptions.isSourceOnce(manifest) ? "once" : ""); } } return copy; }
/** * @param host * @param port * @param proxyhost * @param proxyport * @param bytes * @return the response as {@link InputStream} * @throws ExecutionException */ public byte[] send(final String host, final String port, final String proxyhost, final String proxyport, final byte[] bytes) throws ExecutionException { try { final Request request = Request.Post("http://" + host + ":" + port) .socketTimeout(0).connectTimeout(0); if (proxyhost != null && proxyport != null) { request.viaProxy(new HttpHost(proxyhost, Integer.valueOf(proxyport))); } final HttpResponse response = request .addHeader(Version.HEADER, Version.getCurrentVersion().toString()) .bodyByteArray(bytes).execute().returnResponse(); return handleResponse(response); } catch (final Exception e) { if (e instanceof SmallerException) { throw (SmallerException) e; } throw new ExecutionException("Failed to send zip file", e); } }