diff options
Diffstat (limited to 'openstack-client-connectors')
7 files changed, 12 insertions, 8 deletions
diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java index dc03f9e..f7fa30b 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientConnector.java @@ -104,6 +104,7 @@ public class HttpClientConnector implements OpenStackClientConnector { return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; } + @Override public <T> OpenStackResponse request(OpenStackRequest<T> request) { CloseableHttpClient httpClient = null; //HttpClients.createDefault(); @@ -136,8 +137,8 @@ public class HttpClientConnector implements OpenStackClientConnector { String entityJson = mapper.writeValueAsString (request.entity().getEntity()); entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType())); - - System.out.println("Openstack query JSON:"+entityJson); + + LOGGER.debug("Openstack query JSON:"+entityJson); LOGGER.debug ("Request JSON Body: " + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\"")); } catch (JsonProcessingException e) { diff --git a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java index 6264589..2ba17fb 100644 --- a/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java +++ b/openstack-client-connectors/http-connector/src/main/java/com/woorea/openstack/connector/HttpClientRedirectStrategy.java @@ -113,7 +113,7 @@ public class HttpClientRedirectStrategy extends DefaultRedirectStrategy { final int status = response.getStatusLine().getStatusCode();
- HttpUriRequest newRequest = null;
+ HttpUriRequest newRequest;
if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == HttpStatus.SC_MOVED_TEMPORARILY) {
newRequest = RequestBuilder.copy(request).setUri(uri).build();
} else {
diff --git a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java index e621910..eb1b3d5 100644 --- a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java +++ b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java @@ -78,7 +78,7 @@ public class JerseyConnector implements OpenStackClientConnector { headers.add("Content-Type", "application/json"); } try { - ClientResponse response = null; + ClientResponse response; if (request.entity() != null && request.entity().getEntity() != null) { response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), request.entity().getEntity(), headers)); } else { diff --git a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java index 7c8cdc6..18f0d84 100644 --- a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java +++ b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyLoggingFilter.java @@ -100,6 +100,7 @@ public class JerseyLoggingFilter extends ClientFilter { this.b = b; } + @Override public OutputStream adapt(ClientRequest request, OutputStream out) throws IOException { return new LoggingOutputStream(getAdapter().adapt(request, out), b); } @@ -292,4 +293,4 @@ public class JerseyLoggingFilter extends ClientFilter { entityString = entityString.replaceAll(PASSWORD_PATTERN, "\"password\" : \"******\""); b.append(entityString).append("\n"); } -}
\ No newline at end of file +} diff --git a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyResponse.java b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyResponse.java index a2ca2c2..b6ccd04 100644 --- a/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyResponse.java +++ b/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyResponse.java @@ -73,7 +73,7 @@ public class JerseyResponse implements OpenStackResponse { @Override
public Map<String, String> headers() {
- Map<String, String> headers = new HashMap<String, String>();
+ Map<String, String> headers = new HashMap<>();
for(String k : response.getHeaders().keySet()) {
headers.put(k, response.getHeaders().getFirst(k));
}
diff --git a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java index a89bdf9..b51c833 100644 --- a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java +++ b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/JaxRs20Response.java @@ -67,7 +67,7 @@ public class JaxRs20Response implements OpenStackResponse { @Override public Map<String, String> headers() { - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); for(String k : response.getHeaders().keySet()) { headers.put(k, response.getHeaderString(k)); } diff --git a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java index 4add865..2ec564c 100644 --- a/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java +++ b/openstack-client-connectors/jersey2-connector/src/main/java/com/woorea/openstack/connector/OpenStack.java @@ -67,7 +67,7 @@ public class OpenStack { try { - SSLContext context = null; + SSLContext context; context = SSLContext.getInstance("SSL"); context.init(null, null, null); @@ -103,6 +103,7 @@ public class OpenStack { CLIENT.register(new JacksonFeature()).register(new ContextResolver<ObjectMapper>() { + @Override public ObjectMapper getContext(Class<?> type) { return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER; } @@ -111,6 +112,7 @@ public class OpenStack { CLIENT.register(new ClientRequestFilter() { + @Override public void filter(ClientRequestContext requestContext) throws IOException { requestContext.getHeaders().remove("Content-Language"); requestContext.getHeaders().remove("Content-Encoding"); |