diff --git a/fly-rest/src/br/com/softctrl/net/rest/AbstractHTTPRestfulClient.java b/fly-rest/src/br/com/softctrl/net/rest/AbstractHTTPRestfulClient.java index 33c35ef..0b344a9 100644 --- a/fly-rest/src/br/com/softctrl/net/rest/AbstractHTTPRestfulClient.java +++ b/fly-rest/src/br/com/softctrl/net/rest/AbstractHTTPRestfulClient.java @@ -397,8 +397,8 @@ protected Response perform(final Request request) { final HttpURLConnection connection = newURLConnection(request.getHttpMethod(), request.getUrl()); try { connection.setDoInput(true); - final boolean isPOST = HttpMethod.POST.equals(request.getHttpMethod()); - connection.setDoOutput(isPOST); + final boolean isPostOrPut = HttpMethod.POST.equals(request.getHttpMethod()) || HttpMethod.PUT.equals(request.getHttpMethod(); + connection.setDoOutput(isPostOrPut); // Basic HTTP Authentication if (Objects.nonNull(this.mBasicHttpAuthentication)) { @@ -415,7 +415,7 @@ protected Response perform(final Request request) { } // If is a POST: - if (isPOST) { + if (isPostOrPut) { // If exists parameters: final String parameters = request.getStringParameters(); if (Objects.nonNull(parameters)) { @@ -601,6 +601,39 @@ public synchronized final void post(final String url, final R body, final Parame this.send(HttpMethod.POST, url, body, parameters, properties); } + /** + * + * @param url + */ + public synchronized final void put(final String url) { + this.put(url, mBody, + this.getValidParameters(), + this.getValidProperties()); + } + + /** + * @param url + * @param body + * @param parameters + */ + public synchronized final void put(final String url, final R body, final Parameter... parameters) { + + this.put(url, body, (Objects.isNullOrEmpty(parameters) ? this.getValidParameters() : parameters), + this.getValidProperties()); + + } + + /** + * + * @param url + * @param body + * @param parameters + * @param properties + */ + public synchronized final void put(final String url, final R body, final Parameter[] parameters, final Property[] properties) { + this.send(HttpMethod.PUT, url, body, parameters, properties); + } + /** * * @param url