Interface Network


public interface Network
Interface for the platform-specific mechanism for network access. HTTP requests are sent asynchronously to avoid blocking the application. These asynchronous operations will return a Subject that applications can use to await the result. Callback methods will be invoked from a thread that is compatible with the current renderer.
  • Method Summary

    Modifier and Type
    Method
    Description
    nl.colorize.util.Subject<nl.colorize.util.http.URLResponse>
    get(String url, nl.colorize.util.http.Headers headers)
    Sends a HTTP GET request to the specified URL.
    boolean
    Returns true if this renderer supports peer-to-peer connections on the current platform.
    Opens a peer-to-peer connection.
    nl.colorize.util.Subject<nl.colorize.util.http.URLResponse>
    post(String url, nl.colorize.util.http.Headers headers, nl.colorize.util.http.PostData body)
    Sends a HTTP POST request to the specified URL.
  • Method Details

    • get

      nl.colorize.util.Subject<nl.colorize.util.http.URLResponse> get(String url, nl.colorize.util.http.Headers headers)
      Sends a HTTP GET request to the specified URL. The request will be performed asyncrhonously, the returned Subject can be used to subscribe to the response.
    • post

      nl.colorize.util.Subject<nl.colorize.util.http.URLResponse> post(String url, nl.colorize.util.http.Headers headers, nl.colorize.util.http.PostData body)
      Sends a HTTP POST request to the specified URL. The request will be performed asyncrhonously, the returned Subject can be used to subscribe to the response.
    • openPeerConnection

      PeerConnection openPeerConnection()
      Opens a peer-to-peer connection. The protocol used for the connection depends on both the renderer and the current platform.
      Throws:
      UnsupportedOperationException - if peer-to-peer connections are not supported by the current platform and/or renderer.
    • isPeerToPeerSupported

      boolean isPeerToPeerSupported()
      Returns true if this renderer supports peer-to-peer connections on the current platform. If this method returns false, trying to open peer-to-peer connections using openPeerConnection() will result in an exception.