mirror of https://github.com/apache/jclouds.git
Issue 145:Add custom user agent
This commit is contained in:
parent
bc9634165f
commit
22fc14fc09
|
@ -51,6 +51,7 @@ import javax.net.ssl.SSLContext;
|
|||
import javax.ws.rs.core.HttpHeaders;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.JcloudsVersion;
|
||||
import org.jclouds.crypto.CryptoStreams;
|
||||
import org.jclouds.http.HttpCommandExecutorService;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
|
@ -77,7 +78,9 @@ import com.google.common.io.CountingOutputStream;
|
|||
@Singleton
|
||||
public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorService<HttpURLConnection> {
|
||||
|
||||
public static final String USER_AGENT = "jclouds/1.0 java/" + System.getProperty("java.version");
|
||||
public static final String USER_AGENT = String.format("jclouds/%s java/%s", JcloudsVersion.get(), System
|
||||
.getProperty("java.version"));
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
private final Supplier<SSLContext> untrustedSSLContextProvider;
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Properties;
|
|||
|
||||
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
||||
import org.jclouds.http.internal.JavaUrlHttpCommandExecutorService;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
@ -35,6 +36,7 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test
|
||||
public class JavaUrlHttpCommandExecutorServiceIntegrationTest extends BaseHttpCommandExecutorServiceIntegrationTest {
|
||||
|
||||
protected Module createConnectionModule() {
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.apache.http.entity.FileEntity;
|
|||
import org.apache.http.entity.InputStreamEntity;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.params.CoreProtocolPNames;
|
||||
import org.jclouds.JcloudsVersion;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.io.payloads.BasePayload;
|
||||
|
@ -59,8 +60,8 @@ import com.google.common.base.Throwables;
|
|||
*/
|
||||
@Singleton
|
||||
public class ApacheHCUtils {
|
||||
|
||||
public static final String USER_AGENT = "jclouds/1.0 httpclient/4.0.1";
|
||||
//TODO: look up httpclient version
|
||||
public static final String USER_AGENT = String.format("jclouds/%s httpclient/%s", JcloudsVersion.get(), "4.1.1");
|
||||
|
||||
public static HttpUriRequest convertToApacheRequest(HttpRequest request) {
|
||||
HttpUriRequest apacheRequest;
|
||||
|
|
|
@ -26,6 +26,7 @@ import javax.inject.Named;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.JcloudsVersion;
|
||||
import org.jclouds.concurrent.SingleThreaded;
|
||||
import org.jclouds.http.HttpCommandExecutorService;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
|
@ -50,8 +51,9 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
@SingleThreaded
|
||||
@Singleton
|
||||
public class GaeHttpCommandExecutorService extends BaseHttpCommandExecutorService<HTTPRequest> {
|
||||
public static final String USER_AGENT = "jclouds/1.0 urlfetch/1.3.5";
|
||||
|
||||
//TODO: look up gae version
|
||||
public static final String USER_AGENT = String.format("jclouds/%s urlfetch/%s", JcloudsVersion.get(), "1.4.3");
|
||||
|
||||
private final URLFetchService urlFetchService;
|
||||
private final ConvertToGaeRequest convertToGaeRequest;
|
||||
private final ConvertToJcloudsResponse convertToJcloudsResponse;
|
||||
|
|
|
@ -63,6 +63,7 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test
|
||||
public class AsyncGaeHttpCommandExecutorServiceIntegrationTest extends BaseHttpCommandExecutorServiceIntegrationTest {
|
||||
Logger logger = Logger.CONSOLE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue