View Javadoc
1   /*
2    * Copyright (C) 2013 4th Line GmbH, Switzerland
3    *
4    * The contents of this file are subject to the terms of either the GNU
5    * Lesser General Public License Version 2 or later ("LGPL") or the
6    * Common Development and Distribution License Version 1 or later
7    * ("CDDL") (collectively, the "License"). You may not use this file
8    * except in compliance with the License. See LICENSE.txt for more
9    * information.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14   */
15  
16  package org.fourthline.cling.transport.spi;
17  
18  import java.util.concurrent.ExecutorService;
19  
20  /**
21   * Collection of typically needed configuration settings.
22   *
23   * @author Christian Bauer
24   */
25  public interface StreamClientConfiguration {
26  
27      /**
28       * Used to execute the actual HTTP request, the StreamClient waits on the "current" thread for
29       * completion or timeout. You probably want to use the same executor service for both, so usually
30       * this is {@link org.fourthline.cling.UpnpServiceConfiguration#getSyncProtocolExecutorService()}.
31       *
32       * @return The <code>ExecutorService</code> to use for actual sending of HTTP requests.
33       */
34      public ExecutorService getRequestExecutorService();
35  
36      /**
37       * @return The number of seconds to wait for a request to expire, spanning connect and data-reads.
38       */
39      public int getTimeoutSeconds();
40  
41      /**
42       * @return If the request completion takes longer than this, a warning will be logged (<code>0</code> to disable)
43       */
44      public int getLogWarningSeconds();
45  
46      /**
47       * Used for outgoing HTTP requests if no other value was already set on messages.
48       *
49       * @param majorVersion The UPnP UDA major version.
50       * @param minorVersion The UPnP UDA minor version.
51       * @return The HTTP user agent value.
52       */
53      public String getUserAgentValue(int majorVersion, int minorVersion);
54  
55  }