@@ -0,0 +1,2840 @@
+package br.com.softctrl.http.rest;%0A%0Aimport java.io.InputStream;%0A%0Aimport br.com.softctrl.http.rest.listener.RequestFinishedListener;%0Aimport br.com.softctrl.http.rest.listener.ResponseErrorListener;%0Aimport br.com.softctrl.http.rest.listener.ResponseListener;%0A%0A/*%0AThe MIT License (MIT)%0A%0ACopyright (c) 2015 Carlos Timoshenko Rodrigues Lopes%0Ahttp://www.0x09.com.br%0A%0APermission is hereby granted, free of charge, to any person obtaining a copy%0Aof this software and associated documentation files (the %22Software%22), to deal%0Ain the Software without restriction, including without limitation the rights%0Ato use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0Acopies of the Software, and to permit persons to whom the Software is%0Afurnished to do so, subject to the following conditions:%0A%0AThe above copyright notice and this permission notice shall be included in all%0Acopies or substantial portions of the Software.%0A%0ATHE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE%0AAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0ALIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0AOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE%0ASOFTWARE.%0A*/%0A%0A/**%0A * @author carlostimoshenkorodrigueslopes@gmail.com%0A */%0Apublic final class DownloadFileHTTPRestfulClient extends AbstractHTTPRestfulClient%3CString, InputStream%3E %7B%0A%0A%09/**%0A%09 * @param responseListener%0A%09 * @param responseErrorListener%0A%09 * @param requestFinishedListener%0A%09 */%0A%09public DownloadFileHTTPRestfulClient(ResponseListener%3CInputStream%3E responseListener,%0A%09%09%09ResponseErrorListener responseErrorListener, RequestFinishedListener%3CInputStream%3E requestFinishedListener) %7B%0A%09%09super(responseListener, responseErrorListener, requestFinishedListener);%0A%09%7D%0A%0A%09/*%0A%09 * (non-Javadoc)%0A%09 * %0A%09 * @see%0A%09 * br.com.softctrl.http.rest.AbstractHTTPRestfulClient#createRequest(br.com.%0A%09 * softctrl.http.rest.HttpMethod, java.lang.String, java.lang.Object,%0A%09 * br.com.softctrl.http.rest.Parameter%5B%5D)%0A%09 */%0A%09@Override%0A%09protected Request%3CString, InputStream%3E createRequest(HttpMethod httpMethod, String url, String body,%0A%09%09%09Parameter... parameters) %7B%0A%0A%09%09final Request%3CString, InputStream%3E request = new Request%3CString, InputStream%3E(httpMethod, url, body) %7B%0A%09%09%09@Override%0A%09%09%09public Response%3CInputStream%3E parseResponse(int statusCode, InputStream in) %7B%0A%09%09%09%09return new Response%3CInputStream%3E(statusCode, in);%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public byte%5B%5D bodyToByteArray() %7B%0A%09%09%09%09return (getBody() + %22%22).getBytes();%0A%09%09%09%7D%0A%09%09%7D;%0A%09%09if (parameters != null && parameters.length %3E 0) %7B%0A%09%09%09for (Parameter parameter : parameters) %7B%0A%09%09%09%09request.addParameter(parameter);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return request;%0A%09%7D%0A%0A%7D%0A

Add new rest manager, for download files using rest.