Class WebUtilitiesKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static URLConnection timedConnection(URL $self, Integer connectTimeout, Integer readTimeout) Opens a connection to this URL with connectTimeout and readTimeout applied, in milliseconds.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • timedConnection

         final static URLConnection timedConnection(URL $self, Integer connectTimeout, Integer readTimeout)

        Opens a connection to this URL with connectTimeout and readTimeout applied, in milliseconds.

        The single place that knows how a timeout is applied. WebUtilities.openTimedConnection is the usual way in and supplies the configured values, but the settings groups cannot use it — WebUtilities is constructed from ApiProperties, so a group inside ApiProperties reaching for it would close a cycle. They call this directly with values from their own de.griefed.serverpackcreator.api.settings.NetworkConfig instead, which keeps the mechanism in one place even though the values arrive by two routes.

        Returns URLConnection, not HttpURLConnection: the timeout setters live on URLConnection, and a file: URL yields a FileURLConnection whose cast would throw ClassCastException — which is not an IOException, and so escapes callers' error handling. Callers needing responseCode cast themselves.

        Parameters:
        connectTimeout - Milliseconds to wait for the connection.
        readTimeout - Milliseconds a single read may block.