tus / tus-java-client

The tus client for Java.
https://tus.io
MIT License
213 stars 88 forks source link

Override TusClient.createUpload to provide custom HttpURLConnection #48

Closed kevinetore closed 2 years ago

kevinetore commented 2 years ago

Greetings,

My TUS server is only available through a VPN connection. In order for me to setup said connection, I need to use a provided SDK, this SDK basically enables the VPN connection for either OkHttpClient or HttpURLConnection. This library, tus-java-client, current supports the latter. In order for my use case to work correctly, I want to override the createUpload method. By doing so, I can customize the used HttpURLConnection as needed.

There are currently 2 issues by doing so:

urlStore https://github.com/tus/tus-java-client/blob/66b96701ee49100e3a4e26bfaa4146f52335c41a/src/main/java/io/tus/java/client/TusClient.java#L206

'urlStore' has private access in 'io.tus.java.client.TusClient'

getTusInputStream https://github.com/tus/tus-java-client/blob/66b96701ee49100e3a4e26bfaa4146f52335c41a/src/main/java/io/tus/java/client/TusClient.java#L209

'getTusInputStream()' is not public in 'io.tus.java.client.TusUpload'. Cannot be accessed from outside package

Is there perhaps a solution available from this library? If needed, I could help on a PR.

Update I just came across prepareConnection, this might satisfy my requirements.

Acconut commented 2 years ago

I just came across prepareConnection, this might satisfy my requirements.

Exactly! This method is intended to allow for customizations of HttpUrlConnection. Does it suffice in your situation?

kevinetore commented 2 years ago

I just came across prepareConnection, this might satisfy my requirements.

Exactly! This method is intended to allow for customizations of HttpUrlConnection. Does it suffice in your situation?

Yes, seems to fulfill my needs. Closing this issue, thanks!