Schnittstelle HttpConnectionBuilder


public interface HttpConnectionBuilder
Configures an HttpConnection. The connection can be created after construction.
Autor:
Stephan Fuhrmann
Siehe auch:
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    Constructs a connection from this builder.
    void
    setConnectTimeout(int timeout)
    Configures the timeout for connecting to the server.
    void
    setProxy(URI proxy)
    Sets the HTTP/HTTPS proxy to use.
    void
    setReadTimeout(int timeout)
    Configures the timeout for reading from the server.
    void
    Adds an HTTP request header field to the request.
  • Methodendetails

    • setConnectTimeout

      void setConnectTimeout(int timeout)
      Configures the timeout for connecting to the server.
      Parameter:
      timeout - the timeout in milliseconds.
    • setReadTimeout

      void setReadTimeout(int timeout)
      Configures the timeout for reading from the server.
      Parameter:
      timeout - the timeout in milliseconds.
    • setRequestProperty

      void setRequestProperty(String key, String value)
      Adds an HTTP request header field to the request.
      Parameter:
      key - the header field name, for example "User-Agent".
      value - the header field value.
    • setProxy

      void setProxy(URI proxy)
      Sets the HTTP/HTTPS proxy to use.
      Parameter:
      proxy - the URL of the proxy to use.
    • build

      HttpConnection build() throws IOException
      Constructs a connection from this builder. The connection is usually being opened by this method.
      Gibt zurück:
      an open HTTP connection.
      Löst aus:
      IOException - if building the connection with the given parameters failed.