Skip to content

Commit

Permalink
jersey version bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
woorea committed Jan 3, 2013
1 parent d9da302 commit a0358e1
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
Expand Up @@ -14,7 +14,7 @@ public CeilometerClient(String endpointURL, String token) {
public <R> R execute(CeilometerCommand<R> command) {
WebTarget endpoint = OpenStack.CLIENT.target(endpointURL);
if(token != null) {
endpoint.configuration().register(tokenFilter);
endpoint.register(tokenFilter);
}
return command.execute(endpoint);
}
Expand Down
Expand Up @@ -14,7 +14,7 @@ public GlanceClient(String endpointURL, String token) {
public <R> R execute(GlanceCommand<R> command) {
WebTarget endpoint = OpenStack.CLIENT.target(endpointURL);
if(token != null) {
endpoint.configuration().register(tokenFilter);
endpoint.register(tokenFilter);
}
return command.execute(endpoint);
}
Expand Down
Expand Up @@ -18,7 +18,7 @@ public KeystoneClient(String endpointURL) {
public <R> R execute(KeystoneCommand<R> command) {
WebTarget endpoint = OpenStack.CLIENT.target(endpointURL);
if(token != null) {
endpoint.configuration().register(tokenFilter);
endpoint.register(tokenFilter);
}
return command.execute(endpoint);
}
Expand Down
Expand Up @@ -14,7 +14,7 @@ public NovaClient(String endpointURL, String token) {
public <R> R execute(NovaCommand<R> command) {
WebTarget endpoint = OpenStack.CLIENT.target(endpointURL);
if(token != null) {
endpoint.configuration().register(tokenFilter);
endpoint.register(tokenFilter);
}
return command.execute(endpoint);
}
Expand Down
8 changes: 4 additions & 4 deletions openstack-client/src/main/java/org/openstack/OpenStack.java
Expand Up @@ -59,7 +59,7 @@ private static void initialize() {
SSLContext context = null;
context = SSLContext.getInstance("SSL");
context.init(null, null, null);
CLIENT.configuration().setProperty(ClientProperties.SSL_CONFIG, new SslConfig(context));
CLIENT.setProperty(ClientProperties.SSL_CONFIG, new SslConfig(context));

DEFAULT_MAPPER = new ObjectMapper();

Expand All @@ -75,23 +75,23 @@ private static void initialize() {
WRAPPED_MAPPER.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
WRAPPED_MAPPER.enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);

CLIENT.configuration().register(new JacksonFeature()).register(new ContextResolver<ObjectMapper>() {
CLIENT.register(new JacksonFeature()).register(new ContextResolver<ObjectMapper>() {

public ObjectMapper getContext(Class<?> type) {
return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER;
}

});

CLIENT.configuration().register(new ClientRequestFilter() {
CLIENT.register(new ClientRequestFilter() {

public void filter(ClientRequestContext requestContext) throws IOException {
requestContext.getHeaders().remove("Content-Language");
requestContext.getHeaders().remove("Content-Encoding");
}
});

CLIENT.configuration().register(new LoggingFilter(Logger.getLogger("openstack"), true));
CLIENT.register(new LoggingFilter(Logger.getLogger("openstack"), true));
} catch(Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
Expand Down
Expand Up @@ -44,7 +44,7 @@ public void setToken(String token) {
public OpenStackRequest request(String uri, String... mediaTypes) {
WebTarget endpoint = OpenStack.CLIENT.target(endpointURL);
if(token != null) {
endpoint.configuration().register(tokenFilter);
endpoint.register(tokenFilter);
}
return new OpenStackRequest(endpoint.path(uri).request(mediaTypes));
}
Expand Down
Expand Up @@ -12,7 +12,6 @@
import org.openstack.keystone.utils.KeystoneUtils;
import org.openstack.swift.SwiftClient;
import org.openstack.swift.api.CreateContainer;
import org.openstack.swift.api.DeleteContainer;
import org.openstack.swift.api.ListContainers;
import org.openstack.swift.api.ListObjects;
import org.openstack.swift.api.UploadObject;
Expand Down Expand Up @@ -48,19 +47,19 @@ public static void main(String[] args) throws Exception {

SwiftClient swiftClient = new SwiftClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "object-store", null, "public"), access.getToken().getId());

swiftClient.execute(new DeleteContainer("navidad"));
//swiftClient.execute(new DeleteContainer("navidad2"));

swiftClient.execute(new CreateContainer("navidad"));
swiftClient.execute(new CreateContainer("navidad2"));

System.out.println(swiftClient.execute(new ListContainers()));

ObjectForUpload upload = new ObjectForUpload();
upload.setContainer("navidad");
upload.setName("example");
upload.setContainer("navidad2");
upload.setName("example2");
upload.setInputStream(new FileInputStream(TEST_FILE));
swiftClient.execute(new UploadObject(upload));

System.out.println(swiftClient.execute(new ListObjects("navidad", new HashMap<String, String>() {{
System.out.println(swiftClient.execute(new ListObjects("navidad2", new HashMap<String, String>() {{
put("path", "");
}})).get(0).getContentType());

Expand Down
Expand Up @@ -14,7 +14,7 @@ public SwiftClient(String endpointURL, String token) {
public <R> R execute(SwiftCommand<R> command) {
WebTarget endpoint = OpenStack.CLIENT.target(endpointURL);
if(token != null) {
endpoint.configuration().register(tokenFilter);
endpoint.register(tokenFilter);
}
return command.execute(endpoint);
}
Expand Down

0 comments on commit a0358e1

Please sign in to comment.