Skip to content

Commit 37fc8ef

Browse files
committed
Rollback http client version
1 parent c24e525 commit 37fc8ef

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

pom.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,8 @@
158158
<dependency>
159159
<groupId>org.apache.httpcomponents</groupId>
160160
<artifactId>httpclient</artifactId>
161-
<version>4.3</version>
161+
<version>4.0-alpha4</version>
162162
</dependency>
163-
<dependency>
164-
<groupId>org.apache.httpcomponents</groupId>
165-
<artifactId>httpmime</artifactId>
166-
<version>4.3</version>
167-
</dependency>
168163
<dependency>
169164
<groupId>org.json</groupId>
170165
<artifactId>json</artifactId>

src/main/java/org/fogbowcloud/manager/core/plugins/openstack/OpenStackNovaV2ComputePlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.apache.http.HttpVersion;
1414
import org.apache.http.client.methods.HttpDelete;
1515
import org.apache.http.client.methods.HttpGet;
16-
import org.apache.http.client.methods.HttpPatch;
1716
import org.apache.http.client.methods.HttpPost;
1817
import org.apache.http.client.methods.HttpPut;
1918
import org.apache.http.entity.FileEntity;
@@ -29,6 +28,7 @@
2928
import org.fogbowcloud.manager.core.model.Flavor;
3029
import org.fogbowcloud.manager.core.model.ResourcesInfo;
3130
import org.fogbowcloud.manager.core.plugins.ComputePlugin;
31+
import org.fogbowcloud.manager.core.plugins.util.HttpPatch;
3232
import org.fogbowcloud.manager.occi.core.Category;
3333
import org.fogbowcloud.manager.occi.core.ErrorType;
3434
import org.fogbowcloud.manager.occi.core.OCCIException;
@@ -599,7 +599,7 @@ private String doPutRequest(String endpoint, String authToken, String path) {
599599
HttpPut request = new HttpPut(endpoint);
600600
request.addHeader(OCCIHeaders.CONTENT_TYPE, "application/octet-stream");
601601
request.addHeader(OCCIHeaders.X_AUTH_TOKEN, authToken);
602-
request.setEntity(new FileEntity(new File(path)));
602+
request.setEntity(new FileEntity(new File(path), "application/octet-stream"));
603603
response = client.execute(request);
604604
} catch (Exception e) {
605605
LOGGER.error(e);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.fogbowcloud.manager.core.plugins.util;
2+
3+
import java.net.URI;
4+
5+
import org.apache.http.client.methods.HttpPost;
6+
7+
public class HttpPatch extends HttpPost {
8+
9+
public final static String METHOD_NAME = "PATCH";
10+
11+
public HttpPatch() {
12+
super();
13+
}
14+
15+
public HttpPatch(final URI uri) {
16+
super();
17+
setURI(uri);
18+
}
19+
20+
public HttpPatch(final String uri) {
21+
super();
22+
setURI(URI.create(uri));
23+
}
24+
25+
@Override
26+
public String getMethod() {
27+
return METHOD_NAME;
28+
}
29+
30+
}

0 commit comments

Comments
 (0)