- Make
ProtocolRequestWriter
implementFlushable
to allow on-demand sending of already written responses.
- Fix a resource leak due to SSLSocket not being closed properly.
- Fix a NPE when
close()
is called on non-successful DataApiResponse instances.
- Fix a case in
DataApiResponseAdapter
where an API call with a non-success result code being adapted to aDataApiResponse
will result in the underlyingResponse
andConnection
not being closed (and potentially reused).
-
Deprecate
ResponseBody.writeTo()
,ResponseBody.valuesBytes()
,ResponseBody.valuesByteArray()
.The one-shot stream of data being held by a
ResponseBody
needs to be decoded by aProtocolReader
before use.ResponseBody.reader()
returns such an instance which is already configured and ready for reading making these methods redundant. Also the aforementioned methods bring some behavior ambiguity in cases where the stream may be partially consumed through the exposedProtocolReader
.The methods will now throw an
IllegalStateException
if called when the response has been partially read via aProtocolReader
.The methods will be removed in the next major release of the library.
-
Fix potential connection leaks in
Call.enqueue()
andCall.enqueueAndWait()
implementations. -
Review connection closing/recycling in the
MultiCall
implementation. -
Add more assertions regarding connection recycling/closure in
Call
andMultiCall
unit tests.
- Fix a bug in
BytesReader.skipValue()
. - Make read scope checks more consistent in
BytesReader
- Add the
ResponseBody.writeTo(BufferedSink)
method.
- Fix a bug in
BytesReader.peek()
where anTypeToken.END_ARRAY
instead of aTypeToken.END_OBJECT
would be returned. - Reduce memory allocations in
BytesReader
by replacing the internal structure storing scopes.
- Add the
methodName()
property toCall<T>
to allow for better error reporting. - Add the API method name in the stacktrace when an error is thrown via an
Observable
created with a RxJava adapter. - Add the ability to override the target endpoint of a
Call<T>
is being made by adding a singleEndpoint
method parameter. Example:interface MyInterface { @Method("someapicall") Call<ResponseBody> getResponseBody(Endpoint endpoint); @Method("someapicallwithparams") Call<ResponseBody> getResponseBody(@Request SomeRequest request, Endpoint endpoint); }
- Extract the composer-related annotations in a separate module and the
composer-annotations
maven artifact.
- Extract the composer-related annotations in a separate module and the
- Add an
endpoint()
property toResponseData
that returns the sourceEndpoint
.
- Give a better error message when trying to serialize a type as a request parameter not resulting in a single value.
- Update to Okio 1.17.4
- Drop the peeking source implementation in favor of the one shipped with Okio.
BytesReader
instances returned fromBytesReader.peek()
will not close their parent when being closed.BytesReader
instances returned fromBytesReader.peek()
will throw exceptions if used when their parent has bytes consumed beyond the peek start point.
- Update to Gradle 5.6.2
- Refactor the project build scripts
- Simplify the connection establishment and error reporting logic.
- Code style improvements & small bugfixes.
- Fix a bug where
boolean
primitive fields where not serialized.
- Update the default
HostnameVerifier
implementation to the skip the fallback to the use of Common Name, which has been deprecated. - Update the socket connection establishing logic to properly honor read and connect timeouts.
- Reduce the object allocation count by modifying
ClassTypeAdapter.Binding
's API and introducing primitive-specificLongBinding
,IntBinding
, ... - Extract a new
serialization-annotations
artifact containing only serialization-related annotations.
- Reduce the object allocation count in
BytesReader.readNumber()
and similar underlying number reading operations.
- Fix a
ConcurrentModificationException
when creating newApiComposer.Builder
instances.
- Update Okio to v1.14.0
RxCallAdapter
has been renamed toRxObservableCallAdapter
- Add
RxSingleCallAdapter
to allow declaring methods that returnrx.Single<T>
- Update to the latest release of the 1.x branch of RxJava
ProtocolWriter
no longer implementsFlushable
BytesWriter
instances can be reused for writing multiple requests.- Internal optimizations in
BytesWriter
to minimize allocations - More unit tests for
BytesWriter
- ProtocolResponseReader can now directly read the data after data-enriched responses.
- Added the
SCOPE_DATA
scope inProtocolResponseReader
will be entered after all the values of a data-enriched response are read and theProtocolResponseReader
is at the begging of the attached data bytes. - Add delegating implementations for
ProtocolReader
,ProtocolResponseReader
,ProtocolRequestWriter
andProtocolWriter
.
- Add the
ApiChannel
low-level interface for writing and reading binary-encoded data to an API connection.- This addition exposes the lowest possible level of detail when writing/reading messages from the API by still abstracting away the details of connection establishment, TLS handshaking and so on.
- The interface allows for pipelining of requests and reading/writing on separate threads.
- Instances of the interface can be opened via
PCloudApiClient.newChannel()
.
- Move the
UnserializableTypeException
to the serialization module (was in theprotocol
module). - Add built-in support for the
char
andCharacter
primitive types. - Add logic for serializing objects of arbitrary types that get transformed to a single value. Serializing a collection or an array of such a type will produce a single comma-separated
String
object containing all the serialized values converted viaString.valueOf()
to a their string representation.
Previously it was not possible to serialize custom types due to the unability to force an object to be serialized to a single value (e.g with a single call to
ProtocolWriter.writeValue()
).
Example:
// An adapter that serializes a custom type to a single int/long/float/double/.../String primitive value
TypeAdapter<MyType> adapter = new TypeAdapter<MyType>() {
...
@Override
public void serialize(ProtocolWriter writer, MyType value) throws IOException {
if (value != null) {
writer.writeValue("some value");
}
}
};
// Get an adapter for a collection or an array
TypeAdapter<Collection<MyType>> collectionAdapter = ...
ProtocolWriter writer = ...
Collection<MyType> collection = ...
Calling:
collectionAdapter.serialize(writer, collection);
is equivalent to:
writer.writeValue("some value,some value,some value");
- Allow
null
objects to be assigned as@Parameter
-annotated method arguments. - Allow
@Parameter
-annotated method arguments of arbitrary types. - Disallow
null
objects to be assigned as@ResponseData
-annotated method arguments.
- Fix a bug where a call to
Call<T>.clone()
or toMultiCall<T>.clone()
was causing anIllegalStateException
.
- Enums can now be deserialized from both
NUMBER
andSTRING
protocol types.
- The only modification is the change of the Maven
groupId
property frompcloud-networking-java
tocom.pcloud.pcloud-networking-java
. Users wanting to use this version or any other futures will need to update their dependencies list.
For Gradle users
dependencies {
...
compile "pcloud-networking-java:composer:1.2.2"
}
becomes
dependencies {
...
compile "com.pcloud.pcloud-networking-java:composer:1.2.3"
}
- Fix a bug leading to
NullPointerException
errors when calling no-arg methods of objects returned byApiComposer.compose()
.
- Add a missing getter in
PCloudAPIClient
for theEndpointProvider
supplied byPCloudAPIClient.Builder.endpointProvider(EndpointProvider)
method.
- The ability ot set an
EndpointProvider
has been moved one level below in the abstraction layers and now can be set to aPCloudAPIClient
instance via thePCloudAPIClient.Builder.endpointProvider()
method. See the example below on how to migrate from the previous version:
EndpointProvider myEndpointProvider = new ...;
// Building an ApiComposer instance with custom EndpointProvider as of version 1.1.0 and below:
ApiComposer composer = new APiComposer.Builder()
.endpointProvider(myEndpointProvider)
.build();
// Setting a custom EndpointProvider for version 1.2.0 and above:
PCloudAPIClient client = PCloudAPIClient.newClient()
.endpointProvider(myEndpointProvider)
.create();
ApiComposer composer = new APiComposer.Builder()
.apiClient(client)
.build();
-
EndpointProvider.endpointConnectionError()
will now be properly called for errors during connection initiation and for all reads/writes. -
Request.endpoint()
can now return a nullEndpoint
if none or null has been set viaRequest.Builder.endpoint(Endpoint)
. -
Call
instances created viaPCloudAPIClient.newCall(Request)
forRequest
objects without an explictly setEndpoint
, will be done to an endpoint returned by the supplied or defaultEndpointProiver
instance. -
MultiCall
instances can now created for a user-specifiedEndpoint
via thePCloudAPIClient.newCall(List<Request>, Endpoint)
method. Previous behavior was to pick up theEndpoint
set to the firstRequest
instance from the request list. -
Fixes for potential race conditions leading to NPEs when cancelling/closing
Call
andMultiCall
instances too early.
- The ApiComposer.Builder.endpointProvider() method has been removed (see the related changes in the
Client
module).
- Add the
Transformer.Builder().addTypeAlias()
method for adding type aliases. The method can be used to register concrete implementations of interface types such as in the example below:
interface Model {
...
}
class DefaultModel implements Model {
...
}
Transformer transformer = Transformer.create()
...
.addTypeAlias(Model.class, DefaultModel.class)
...
.build();
- Fix a bug where
PCloudAPIClient
instances sharing a commonConnectionPool
having different timeout settings would use recycled connections with timeouts different from the ones set viaPCLoudAPIClient.Builder
. The changes are entirely internal.
This is a maintenance release with updated documentation and removed unused classes
- Remove the unused
ByteCountingSource
from theutils
module. - Move
FixedLengthSource
fromutils
to thebinapi-client
module
- Remove
MultiCallProducer
andMultiCallOnSubscribe
as they are not used anymore.
- Adapted interface methods will always use
Endpoint.DEFAULT
as endpoint, to leave the opportunity to have the final endpoint resolved from thePCloudAPIClient
'sEndpointProvider
instance.
- Remove the akward ConnectException thrown from RealConnection.connect(), the method will pass-through any thrown IOExceptions in its body.
- Fix a NPE when calling
Interactor.close()
. - Throw
IOException
when callingInteractor.submitRequests()
orInteractor.nextResponse()
on a closedInteractor
instance. - Fix the non-respected read and write timeouts when using
Call
,MultiCall
orInteractor
objects.
- Supress and fix compiler warnings in some of the test utility classes.
- Initial release.