Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
### Added
- N/A

## 1.3.4 - 2019-01-10
### Added
- Support for device attributes on volume attachments in the Compute service
- Support for custom header rulesets in the Load Balancing service
- Add support to use RESTEasy with Java SDK. Examples can be found at [ResteasyClientWithObjectStorageExample](https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/ResteasyClientWithObjectStorageExample.java) and [InstancePrincipalsAuthenticationDetailsProviderWithResteasyClientExample](https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/InstancePrincipalsAuthenticationDetailsProviderWithResteasyClientExample.java)

### Fixed
- Reading entities from HTTP response without a Content-Type header no longer throws a NullPointerException

## 1.3.3 - 2018-12-13
### Added
- Support for Data Guard for VM shapes in the Database service
Expand Down
4 changes: 2 additions & 2 deletions bmc-addons/bmc-apache-connector-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-addons</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
/**
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.http;

import com.oracle.bmc.http.internal.ContentLengthFilter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.RequestEntityProcessing;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
import java.util.LinkedList;
import java.util.List;

Expand Down Expand Up @@ -72,30 +70,4 @@ protected void setConnectorProvider(ClientBuilder builder) {

builder.withConfig(clientConfig);
}

private static class ContentLengthFilter implements ClientRequestFilter {
@Override
public void filter(ClientRequestContext requestContext) {
String contentLengthHeader = null;
for (String key : requestContext.getHeaders().keySet()) {
if (StringUtils.equalsIgnoreCase("content-length", key)) {
contentLengthHeader = key;
}
}

final String method = requestContext.getMethod();
final String uri = requestContext.getUri().toString();
final Object existingContentLengthValue =
requestContext.getHeaders().remove(contentLengthHeader);
if (existingContentLengthValue != null) {
LOG.debug(
"Removed existing content-length header for Method [{}], URI [{}], Existing Value [{}]",
method,
uri,
existingContentLengthValue);
} else {
LOG.debug("content-length not found for Method [{}], URI [{}]", method, uri);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.http;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.http;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.http;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.http;

Expand Down
20 changes: 20 additions & 0 deletions bmc-addons/bmc-resteasy-client-configurator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# OCI Java SDK Resteasy Client Configurator Add-On

## About

The oci-java-sdk-addons-resteasy-client-configurator is an optional add-on to the OCI Java SDK. It makes resteasy client work with Java SDK.

## Installation
1. The OCI Java SDK must be installed and configured before installing the add-on. See [the documentation](https://docs.us-phoenix-1.oraclecloud.com/Content/API/SDKDocs/javasdk.htm) for details.
2. Copy the supplied oci-java-sdk-addons-resteasy-client-configurator and third-party jar files to your application's classpath.

#### Example
An example of configuring the client to use RestEasy with the Java SDK can be found [here](https://github.com/oracle/oci-java-sdk/tree/master/bmc-examples/src/main/java/ResteasyClientExample.java).


## License
Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.

This SDK and sample is dual licensed under the Universal Permissive License 1.0 and the Apache License 2.0.

See [LICENSE](../../LICENSE.txt) for more details.
44 changes: 44 additions & 0 deletions bmc-addons/bmc-resteasy-client-configurator/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-addons</artifactId>
<version>1.3.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>oci-java-sdk-addons-resteasy-client-configurator</artifactId>
<name>Oracle Cloud Infrastructure SDK - RestEasyClientConfigurator</name>
<description>This project adds support for the RestEasyClientConfigurator for the Java SDK</description>
<url>https://docs.us-phoenix-1.oraclecloud.com/Content/API/SDKDocs/javasdk.htm</url>


<dependencies>
<!-- https://mvnrepository.com/artifact/org.jboss.resteasy/resteasy-client -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.1.2.Final</version>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.1.2.Final</version>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<version>3.0.12.Final</version>
</dependency>

<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common</artifactId>
<version>1.3.4</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">

<id>release</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<!-- Include the README.md -->
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>README.md</include>
</includes>
</fileSet>
<!-- Include all of the Javadocs -->
<fileSet>
<directory>${project.build.directory}/apidocs</directory>
<outputDirectory>apidocs</outputDirectory>
</fileSet>
<!-- Include the sources and javadoc jars for developers -->
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>oci-java-sdk-addons-resteasy-client-configurator-${project.version}-*.jar</include>
</includes>
<outputDirectory>lib</outputDirectory>
</fileSet>
</fileSets>
<files>
<!-- Explicitly copy the signed/unsigned jar and rename it in the release zip file.
If this is for a "signed" release, then the signed jar should be defined; else, the unsigned if the
build profile is "ziponly" -->
<file>
<source>${source.jar.for.zip}</source>
<outputDirectory>lib</outputDirectory>
<destName>oci-java-sdk-addons-resteasy-client-configurator-${project.version}.jar</destName>
</file>
</files>
<dependencySets>
<!-- 3P dependencies only that's exclusive to this add-on, exclude OCI and its related third-party dependencies -->
<dependencySet>
<includes>
<include>javax.activation:activation</include>
<include>commons-logging:commons-logging</include>
<include>org.jboss.resteasy:*</include>
<include>org.apache.httpcomponents:*</include>
<include>org.jboss.spec.javax.annotation:*</include>
<include>org.jboss.logging:*</include>
<include>org.jboss.spec.javax.ws.rs:*</include>
</includes>
<outputDirectory>third-party/lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<useProjectAttachments>true</useProjectAttachments>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.http;

import com.oracle.bmc.http.internal.ContentLengthFilter;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

/**
* A client configurator object allows to use resteasy with JavaSDK.
*/
public class ResteasyClientConfigurator implements ClientConfigurator {
/**
* Customize the ClientBuilder instance.
*
* @param builder
* The client builder.
*/
public void customizeBuilder(ClientBuilder builder) {}

/**
* Customize the Client generated by the builder.
*
* @param client
* The client.
*/
public void customizeClient(Client client) {
// Java SDK needs to write Json string to http body directly, StringTextStar is the class that resteasy writes
// Json string with application/json media type.
// Add more providers to support stream content type. Add DefaultTextPlain, DefaultNumberWriter and ByteArrayProvider
// for future user scenarios
client.register(org.jboss.resteasy.plugins.providers.StringTextStar.class);
client.register(org.jboss.resteasy.plugins.providers.StreamingOutputProvider.class);
client.register(org.jboss.resteasy.plugins.providers.InputStreamProvider.class);
client.register(org.jboss.resteasy.plugins.providers.DefaultTextPlain.class);
client.register(org.jboss.resteasy.plugins.providers.DefaultNumberWriter.class);
client.register(org.jboss.resteasy.plugins.providers.ByteArrayProvider.class);

// Required for calls to only allow ResteasyClient to set the content-length header.
// Otherwise, apache will throw an exception if it already exists. For example, such a case includes
// ObjectStorage where the content-length is explicitly set in the header based on the value in the request.
client.register(new ContentLengthFilter());
}
}
3 changes: 2 additions & 1 deletion bmc-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -17,6 +17,7 @@

<modules>
<module>bmc-apache-connector-provider</module>
<module>bmc-resteasy-client-configurator</module>
</modules>

</project>
4 changes: 2 additions & 2 deletions bmc-audit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -19,7 +19,7 @@
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion bmc-audit/src/main/java/com/oracle/bmc/audit/Audit.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.audit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
*/
package com.oracle.bmc.audit;

Expand Down
Loading