NASAWorldWind / WorldWindAndroid

The NASA WorldWind Java SDK for Android (WWA) includes the library, examples and tutorials for building 3D virtual globe applications for phones and tablets.
Other
267 stars 125 forks source link

Provide automatic HTTP to HTTPS protocol redirect capability for WMS, WMTS, and WCS retrievals #96

Open zglueck opened 7 years ago

zglueck commented 7 years ago

WMS, WMTS, and WCS servers which may use an HTTP to HTTPS redirect are not being followed by the default configuration of the Android URLConnection class. Redirects maintaining the same protocol (http or https) still work.

Some background is available in #75. The Java development team opted not to follow the protocol redirect in initial JDK design as indicated in this bug report: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4620571

jgiovino commented 7 years ago

I have encountered similar failures. The WMS layer factory per the tutorial calls the failure callback. When I give a URL that is not up and running it fails as well. I would expect it not to fail since the app should not know or care if the network or the server is up. When I have WWSK running with a properly configured URL it operates intermittently.

zglueck commented 7 years ago

@jgiovino, indeed, this issue initially captured the WMS tutorial failure. The NEO source used has implemented https protocol in the time since the tutorial was added and provided a redirect from http to https. I decided to change the title to reflect the true nature of the issue.

That's an interesting notion the app should not care. I think the current implementation kind of operates in this manner as the LayerFactory immediately returns a Layer, which on failure, has no data. So in a way, the returned layer doesn't care. Our mechanism of using the callback to indicate network, source, or other failure was the best option we could think of to communicate an issue in creating the layer, particularly because of its asynchronous nature. Can you describe a use pattern you think is optimal?

The intermittent failures with WWSK are troublesome. If you can provide any additional data on this failure, I think our team would love to review. I haven't seen any issues in my use, but I've been operating in a local network.