mirror of https://github.com/apache/jclouds.git
Issue 113: signature logger
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2006 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
903254a6f9
commit
5b95c35ca7
|
@ -34,12 +34,14 @@ import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.jclouds.atmosonline.saas.reference.AtmosStorageConstants;
|
import org.jclouds.atmosonline.saas.reference.AtmosStorageConstants;
|
||||||
import org.jclouds.atmosonline.saas.reference.AtmosStorageHeaders;
|
import org.jclouds.atmosonline.saas.reference.AtmosStorageHeaders;
|
||||||
import org.jclouds.http.HttpException;
|
import org.jclouds.http.HttpException;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpRequestFilter;
|
import org.jclouds.http.HttpRequestFilter;
|
||||||
import org.jclouds.http.HttpUtils;
|
import org.jclouds.http.HttpUtils;
|
||||||
|
import org.jclouds.http.internal.SignatureWire;
|
||||||
import org.jclouds.util.TimeStamp;
|
import org.jclouds.util.TimeStamp;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
@ -54,14 +56,17 @@ import com.google.common.annotations.VisibleForTesting;
|
||||||
@Singleton
|
@Singleton
|
||||||
public class SignRequest implements HttpRequestFilter {
|
public class SignRequest implements HttpRequestFilter {
|
||||||
|
|
||||||
|
private final SignatureWire signatureWire;
|
||||||
private final String uid;
|
private final String uid;
|
||||||
private final byte[] key;
|
private final byte[] key;
|
||||||
private final Provider<String> timeStampProvider;
|
private final Provider<String> timeStampProvider;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SignRequest(@Named(AtmosStorageConstants.PROPERTY_EMCSAAS_UID) String uid,
|
public SignRequest(SignatureWire signatureWire,
|
||||||
|
@Named(AtmosStorageConstants.PROPERTY_EMCSAAS_UID) String uid,
|
||||||
@Named(AtmosStorageConstants.PROPERTY_EMCSAAS_KEY) String encodedKey,
|
@Named(AtmosStorageConstants.PROPERTY_EMCSAAS_KEY) String encodedKey,
|
||||||
@TimeStamp Provider<String> timeStampProvider) {
|
@TimeStamp Provider<String> timeStampProvider) {
|
||||||
|
this.signatureWire = signatureWire;
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
this.key = HttpUtils.fromBase64String(encodedKey);
|
this.key = HttpUtils.fromBase64String(encodedKey);
|
||||||
this.timeStampProvider = timeStampProvider;
|
this.timeStampProvider = timeStampProvider;
|
||||||
|
@ -80,12 +85,16 @@ public class SignRequest implements HttpRequestFilter {
|
||||||
appendHttpHeaders(request, buffer);
|
appendHttpHeaders(request, buffer);
|
||||||
appendCanonicalizedResource(request, buffer);
|
appendCanonicalizedResource(request, buffer);
|
||||||
appendCanonicalizedHeaders(request, buffer);
|
appendCanonicalizedHeaders(request, buffer);
|
||||||
|
if (signatureWire.enabled())
|
||||||
|
signatureWire.output(buffer.toString());
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calculateAndReplaceAuthHeader(HttpRequest request, String toSign)
|
private void calculateAndReplaceAuthHeader(HttpRequest request, String toSign)
|
||||||
throws HttpException {
|
throws HttpException {
|
||||||
String signature = signString(toSign);
|
String signature = signString(toSign);
|
||||||
|
if (signatureWire.enabled())
|
||||||
|
signatureWire.input(IOUtils.toInputStream(signature));
|
||||||
request.getHeaders().replaceValues(AtmosStorageHeaders.SIGNATURE,
|
request.getHeaders().replaceValues(AtmosStorageHeaders.SIGNATURE,
|
||||||
Collections.singletonList(signature));
|
Collections.singletonList(signature));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,32 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
Copyright (C) 2009 Cloud Conscious, LLC.
|
||||||
|
<info@cloudconscious.com>
|
||||||
|
|
||||||
====================================================================
|
====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one or
|
||||||
or more contributor license agreements. See the NOTICE file
|
more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information regarding
|
||||||
regarding copyright ownership. The ASF licenses this file
|
copyright ownership. The ASF licenses this file to you under the
|
||||||
to you under the Apache License, Version 2.0 (the
|
Apache License, Version 2.0 (the "License"); you may not use
|
||||||
"License"); you may not use this file except in compliance
|
this file except in compliance with the License. You may obtain
|
||||||
with the License. You may obtain a copy of the License at
|
a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||||
|
applicable law or agreed to in writing, software distributed
|
||||||
Unless required by applicable law or agreed to in writing,
|
under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
software distributed under the License is distributed on an
|
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
See the License for the specific language governing permissions
|
||||||
KIND, either express or implied. See the License for the
|
and limitations under the License.
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
====================================================================
|
====================================================================
|
||||||
|
-->
|
||||||
-->
|
|
||||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
For more configuration infromation and examples see the Apache Log4j
|
For more configuration infromation and examples see the Apache
|
||||||
website: http://logging.apache.org/log4j/
|
Log4j website: http://logging.apache.org/log4j/
|
||||||
-->
|
-->
|
||||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
|
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
|
||||||
debug="false">
|
debug="false">
|
||||||
|
@ -48,9 +46,9 @@
|
||||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
|
The full pattern: Date MS Priority [Category]
|
||||||
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
|
(Thread:NDC) Message\n <param name="ConversionPattern"
|
||||||
%m%n"/>
|
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
||||||
-->
|
-->
|
||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
|
@ -70,9 +68,9 @@
|
||||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
|
The full pattern: Date MS Priority [Category]
|
||||||
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
|
(Thread:NDC) Message\n <param name="ConversionPattern"
|
||||||
%m%n"/>
|
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
||||||
-->
|
-->
|
||||||
</layout>
|
</layout>
|
||||||
</appender>
|
</appender>
|
||||||
|
@ -104,6 +102,12 @@
|
||||||
<appender-ref ref="ASYNCWIRE" />
|
<appender-ref ref="ASYNCWIRE" />
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
|
<category name="jclouds.signature.wire">
|
||||||
|
<priority value="DEBUG" />
|
||||||
|
<appender-ref ref="ASYNCWIRE" />
|
||||||
|
</category>
|
||||||
|
|
||||||
|
|
||||||
<!-- ======================= -->
|
<!-- ======================= -->
|
||||||
<!-- Setup the Root category -->
|
<!-- Setup the Root category -->
|
||||||
<!-- ======================= -->
|
<!-- ======================= -->
|
||||||
|
|
|
@ -36,11 +36,13 @@ import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.jclouds.aws.s3.reference.S3Constants;
|
import org.jclouds.aws.s3.reference.S3Constants;
|
||||||
import org.jclouds.http.HttpException;
|
import org.jclouds.http.HttpException;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpRequestFilter;
|
import org.jclouds.http.HttpRequestFilter;
|
||||||
import org.jclouds.http.HttpUtils;
|
import org.jclouds.http.HttpUtils;
|
||||||
|
import org.jclouds.http.internal.SignatureWire;
|
||||||
import org.jclouds.util.TimeStamp;
|
import org.jclouds.util.TimeStamp;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
@ -57,14 +59,16 @@ public class RequestAuthorizeSignature implements HttpRequestFilter {
|
||||||
private final String[] firstHeadersToSign = new String[] { "Content-MD5",
|
private final String[] firstHeadersToSign = new String[] { "Content-MD5",
|
||||||
HttpHeaders.CONTENT_TYPE, HttpHeaders.DATE };
|
HttpHeaders.CONTENT_TYPE, HttpHeaders.DATE };
|
||||||
|
|
||||||
|
private final SignatureWire signatureWire;
|
||||||
private final String accessKey;
|
private final String accessKey;
|
||||||
private final String secretKey;
|
private final String secretKey;
|
||||||
private final Provider<String> timeStampProvider;
|
private final Provider<String> timeStampProvider;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RequestAuthorizeSignature(@Named(S3Constants.PROPERTY_AWS_ACCESSKEYID) String accessKey,
|
public RequestAuthorizeSignature(SignatureWire signatureWire, @Named(S3Constants.PROPERTY_AWS_ACCESSKEYID) String accessKey,
|
||||||
@Named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY) String secretKey,
|
@Named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY) String secretKey,
|
||||||
@TimeStamp Provider<String> timeStampProvider) {
|
@TimeStamp Provider<String> timeStampProvider) {
|
||||||
|
this.signatureWire = signatureWire;
|
||||||
this.accessKey = accessKey;
|
this.accessKey = accessKey;
|
||||||
this.secretKey = secretKey;
|
this.secretKey = secretKey;
|
||||||
this.timeStampProvider = timeStampProvider;
|
this.timeStampProvider = timeStampProvider;
|
||||||
|
@ -84,12 +88,16 @@ public class RequestAuthorizeSignature implements HttpRequestFilter {
|
||||||
appendAmzHeaders(request, buffer);
|
appendAmzHeaders(request, buffer);
|
||||||
appendBucketName(request, buffer);
|
appendBucketName(request, buffer);
|
||||||
appendUriPath(request, buffer);
|
appendUriPath(request, buffer);
|
||||||
|
if(signatureWire.enabled())
|
||||||
|
signatureWire.output(buffer.toString());
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calculateAndReplaceAuthHeader(HttpRequest request, String toSign)
|
private void calculateAndReplaceAuthHeader(HttpRequest request, String toSign)
|
||||||
throws HttpException {
|
throws HttpException {
|
||||||
String signature = signString(toSign);
|
String signature = signString(toSign);
|
||||||
|
if (signatureWire.enabled())
|
||||||
|
signatureWire.input(IOUtils.toInputStream(signature));
|
||||||
request.getHeaders().replaceValues(HttpHeaders.AUTHORIZATION,
|
request.getHeaders().replaceValues(HttpHeaders.AUTHORIZATION,
|
||||||
Collections.singletonList("AWS " + accessKey + ":" + signature));
|
Collections.singletonList("AWS " + accessKey + ":" + signature));
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,13 @@ import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import javax.ws.rs.core.HttpHeaders;
|
import javax.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.jclouds.azure.storage.reference.AzureStorageConstants;
|
import org.jclouds.azure.storage.reference.AzureStorageConstants;
|
||||||
import org.jclouds.http.HttpException;
|
import org.jclouds.http.HttpException;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpRequestFilter;
|
import org.jclouds.http.HttpRequestFilter;
|
||||||
import org.jclouds.http.HttpUtils;
|
import org.jclouds.http.HttpUtils;
|
||||||
|
import org.jclouds.http.internal.SignatureWire;
|
||||||
import org.jclouds.util.TimeStamp;
|
import org.jclouds.util.TimeStamp;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
@ -55,15 +57,17 @@ public class SharedKeyAuthentication implements HttpRequestFilter {
|
||||||
private final String[] firstHeadersToSign = new String[] { "Content-MD5",
|
private final String[] firstHeadersToSign = new String[] { "Content-MD5",
|
||||||
HttpHeaders.CONTENT_TYPE, HttpHeaders.DATE };
|
HttpHeaders.CONTENT_TYPE, HttpHeaders.DATE };
|
||||||
|
|
||||||
|
private final SignatureWire signatureWire;
|
||||||
private final String account;
|
private final String account;
|
||||||
private final byte[] key;
|
private final byte[] key;
|
||||||
private final Provider<String> timeStampProvider;
|
private final Provider<String> timeStampProvider;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SharedKeyAuthentication(
|
public SharedKeyAuthentication(SignatureWire signatureWire,
|
||||||
@Named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT) String account,
|
@Named(AzureStorageConstants.PROPERTY_AZURESTORAGE_ACCOUNT) String account,
|
||||||
@Named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY) String encodedKey,
|
@Named(AzureStorageConstants.PROPERTY_AZURESTORAGE_KEY) String encodedKey,
|
||||||
@TimeStamp Provider<String> timeStampProvider) {
|
@TimeStamp Provider<String> timeStampProvider) {
|
||||||
|
this.signatureWire = signatureWire;
|
||||||
this.account = account;
|
this.account = account;
|
||||||
this.key = HttpUtils.fromBase64String(encodedKey);
|
this.key = HttpUtils.fromBase64String(encodedKey);
|
||||||
this.timeStampProvider = timeStampProvider;
|
this.timeStampProvider = timeStampProvider;
|
||||||
|
@ -82,12 +86,16 @@ public class SharedKeyAuthentication implements HttpRequestFilter {
|
||||||
appendHttpHeaders(request, buffer);
|
appendHttpHeaders(request, buffer);
|
||||||
appendCanonicalizedHeaders(request, buffer);
|
appendCanonicalizedHeaders(request, buffer);
|
||||||
appendCanonicalizedResource(request, buffer);
|
appendCanonicalizedResource(request, buffer);
|
||||||
|
if (signatureWire.enabled())
|
||||||
|
signatureWire.output(buffer.toString());
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calculateAndReplaceAuthHeader(HttpRequest request, String toSign)
|
private void calculateAndReplaceAuthHeader(HttpRequest request, String toSign)
|
||||||
throws HttpException {
|
throws HttpException {
|
||||||
String signature = signString(toSign);
|
String signature = signString(toSign);
|
||||||
|
if (signatureWire.enabled())
|
||||||
|
signatureWire.input(IOUtils.toInputStream(signature));
|
||||||
request.getHeaders().replaceValues(HttpHeaders.AUTHORIZATION,
|
request.getHeaders().replaceValues(HttpHeaders.AUTHORIZATION,
|
||||||
Collections.singletonList("SharedKey " + account + ":" + signature));
|
Collections.singletonList("SharedKey " + account + ":" + signature));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ public interface HttpConstants {
|
||||||
public static final String PROPERTY_HTTP_MAX_REDIRECTS = "jclouds.http.max-redirects";
|
public static final String PROPERTY_HTTP_MAX_REDIRECTS = "jclouds.http.max-redirects";
|
||||||
public static final String HTTP_HEADERS_LOGGER = "jclouds.http.headers";
|
public static final String HTTP_HEADERS_LOGGER = "jclouds.http.headers";
|
||||||
public static final String HTTP_WIRE_LOGGER = "jclouds.http.wire";
|
public static final String HTTP_WIRE_LOGGER = "jclouds.http.wire";
|
||||||
|
public static final String SIGNATURE_WIRE_LOGGER = "jclouds.signature.wire";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* longest time a single request can take before throwing an exception.
|
* longest time a single request can take before throwing an exception.
|
||||||
|
|
|
@ -54,10 +54,10 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
|
||||||
@Named(HttpConstants.HTTP_HEADERS_LOGGER)
|
@Named(HttpConstants.HTTP_HEADERS_LOGGER)
|
||||||
protected Logger headerLog = Logger.NULL;
|
protected Logger headerLog = Logger.NULL;
|
||||||
|
|
||||||
private final Wire wire;
|
private final HttpWire wire;
|
||||||
|
|
||||||
protected BaseHttpCommandExecutorService(ExecutorService executorService,
|
protected BaseHttpCommandExecutorService(ExecutorService executorService,
|
||||||
DelegatingRetryHandler retryHandler, DelegatingErrorHandler errorHandler, Wire wire) {
|
DelegatingRetryHandler retryHandler, DelegatingErrorHandler errorHandler, HttpWire wire) {
|
||||||
this.retryHandler = retryHandler;
|
this.retryHandler = retryHandler;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
this.executorService = executorService;
|
this.executorService = executorService;
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
package org.jclouds.http.internal;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.jclouds.http.HttpConstants;
|
||||||
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.logging.internal.Wire;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs data to the wire LOG.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
* @see org.apache.HttpWire.impl.conn.Wire
|
||||||
|
*/
|
||||||
|
public class HttpWire extends Wire {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Named(HttpConstants.HTTP_WIRE_LOGGER)
|
||||||
|
Logger wireLog = Logger.NULL;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public HttpWire(ExecutorService exec) {
|
||||||
|
super(exec);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Logger getWireLog() {
|
||||||
|
return wireLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -66,7 +66,7 @@ public class JavaUrlHttpCommandExecutorService extends
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public JavaUrlHttpCommandExecutorService(ExecutorService executorService,
|
public JavaUrlHttpCommandExecutorService(ExecutorService executorService,
|
||||||
DelegatingRetryHandler retryHandler, DelegatingErrorHandler errorHandler, Wire wire) {
|
DelegatingRetryHandler retryHandler, DelegatingErrorHandler errorHandler, HttpWire wire) {
|
||||||
super(executorService, retryHandler, errorHandler, wire);
|
super(executorService, retryHandler, errorHandler, wire);
|
||||||
sslMap = Maps.newHashMap();
|
sslMap = Maps.newHashMap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
package org.jclouds.http.internal;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.jclouds.http.HttpConstants;
|
||||||
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.logging.internal.Wire;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs data to the wire LOG.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
* @see org.apache.HttpWire.impl.conn.Wire
|
||||||
|
*/
|
||||||
|
public class SignatureWire extends Wire {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Named(HttpConstants.SIGNATURE_WIRE_LOGGER)
|
||||||
|
Logger wireLog = Logger.NULL;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public SignatureWire(ExecutorService exec) {
|
||||||
|
super(exec);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Logger getWireLog() {
|
||||||
|
return wireLog;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
* Copyright (C) 2009 Global Cloud Specialists, Inc. <info@globalcloudspecialists.com>
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
package org.jclouds.http.internal;
|
package org.jclouds.logging.internal;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
@ -37,34 +37,28 @@ import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.io.input.TeeInputStream;
|
import org.apache.commons.io.input.TeeInputStream;
|
||||||
import org.jclouds.concurrent.SingleThreaded;
|
import org.jclouds.concurrent.SingleThreaded;
|
||||||
import org.jclouds.http.HttpConstants;
|
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs data to the wire LOG.
|
* Logs data to the wire LOG.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see org.apache.http.impl.conn.Wire
|
* @see org.apache.HttpWire.impl.conn.Wire
|
||||||
*/
|
*/
|
||||||
public class Wire {
|
public abstract class Wire {
|
||||||
|
|
||||||
@Resource
|
|
||||||
@Named(HttpConstants.HTTP_WIRE_LOGGER)
|
|
||||||
protected Logger wireLog = Logger.NULL;
|
|
||||||
@Resource
|
@Resource
|
||||||
protected Logger logger = Logger.NULL;
|
protected Logger logger = Logger.NULL;
|
||||||
|
protected final ExecutorService exec;
|
||||||
private final ExecutorService exec;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public Wire(ExecutorService exec) {
|
public Wire(ExecutorService exec) {
|
||||||
this.exec = checkNotNull(exec, "executor");
|
this.exec = checkNotNull(exec, "executor");
|
||||||
}
|
}
|
||||||
|
protected abstract Logger getWireLog();
|
||||||
|
|
||||||
private void wire(String header, InputStream instream) {
|
private void wire(String header, InputStream instream) {
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
@ -77,7 +71,7 @@ public class Wire {
|
||||||
buffer.append("[\\n]\"");
|
buffer.append("[\\n]\"");
|
||||||
buffer.insert(0, "\"");
|
buffer.insert(0, "\"");
|
||||||
buffer.insert(0, header);
|
buffer.insert(0, header);
|
||||||
wireLog.debug(buffer.toString());
|
getWireLog().debug(buffer.toString());
|
||||||
buffer.setLength(0);
|
buffer.setLength(0);
|
||||||
} else if ((ch < 32) || (ch > 127)) {
|
} else if ((ch < 32) || (ch > 127)) {
|
||||||
buffer.append("[0x");
|
buffer.append("[0x");
|
||||||
|
@ -91,7 +85,7 @@ public class Wire {
|
||||||
buffer.append('\"');
|
buffer.append('\"');
|
||||||
buffer.insert(0, '\"');
|
buffer.insert(0, '\"');
|
||||||
buffer.insert(0, header);
|
buffer.insert(0, header);
|
||||||
wireLog.debug(buffer.toString());
|
getWireLog().debug(buffer.toString());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e, "Error tapping line");
|
logger.error(e, "Error tapping line");
|
||||||
|
@ -99,7 +93,7 @@ public class Wire {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean enabled() {
|
public boolean enabled() {
|
||||||
return wireLog.isDebugEnabled();
|
return getWireLog().isDebugEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputStream copy(final String header, InputStream instream) {
|
public InputStream copy(final String header, InputStream instream) {
|
||||||
|
@ -141,7 +135,7 @@ public class Wire {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T output(T data) {
|
public <T> T output(T data) {
|
||||||
checkNotNull(data, "data must be set before calling generateETag()");
|
checkNotNull(data, "data");
|
||||||
if (data instanceof InputStream) {
|
if (data instanceof InputStream) {
|
||||||
if (exec.getClass().isAnnotationPresent(SingleThreaded.class))
|
if (exec.getClass().isAnnotationPresent(SingleThreaded.class))
|
||||||
return (T) copy(">> ", (InputStream) data);
|
return (T) copy(">> ", (InputStream) data);
|
|
@ -39,7 +39,7 @@ import org.jclouds.http.TransformingHttpCommandExecutorServiceImpl;
|
||||||
import org.jclouds.http.TransformingHttpCommandImpl;
|
import org.jclouds.http.TransformingHttpCommandImpl;
|
||||||
import org.jclouds.http.functions.ReturnStringIf200;
|
import org.jclouds.http.functions.ReturnStringIf200;
|
||||||
import org.jclouds.http.internal.JavaUrlHttpCommandExecutorService;
|
import org.jclouds.http.internal.JavaUrlHttpCommandExecutorService;
|
||||||
import org.jclouds.http.internal.Wire;
|
import org.jclouds.http.internal.HttpWire;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.logging.Logger.LoggerFactory;
|
import org.jclouds.logging.Logger.LoggerFactory;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
|
@ -93,7 +93,7 @@ public class BackoffLimitedRetryHandlerTest {
|
||||||
void setupExecutorService() throws Exception {
|
void setupExecutorService() throws Exception {
|
||||||
ExecutorService execService = Executors.newCachedThreadPool();
|
ExecutorService execService = Executors.newCachedThreadPool();
|
||||||
JavaUrlHttpCommandExecutorService httpService = new JavaUrlHttpCommandExecutorService(
|
JavaUrlHttpCommandExecutorService httpService = new JavaUrlHttpCommandExecutorService(
|
||||||
execService, new DelegatingRetryHandler(), new DelegatingErrorHandler(), new Wire(
|
execService, new DelegatingRetryHandler(), new DelegatingErrorHandler(), new HttpWire(
|
||||||
Executors.newCachedThreadPool()));
|
Executors.newCachedThreadPool()));
|
||||||
executorService = new TransformingHttpCommandExecutorServiceImpl(httpService, execService,
|
executorService = new TransformingHttpCommandExecutorServiceImpl(httpService, execService,
|
||||||
new LoggerFactory() {
|
new LoggerFactory() {
|
||||||
|
|
|
@ -40,6 +40,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.jclouds.concurrent.WithinThreadExecutorService;
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
import org.jclouds.http.HttpUtils;
|
import org.jclouds.http.HttpUtils;
|
||||||
|
import org.jclouds.http.internal.HttpWire;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ public class WireLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
Wire wire = setUp();
|
HttpWire wire = setUp();
|
||||||
InputStream in = wire.input(fromServer);
|
InputStream in = wire.input(fromServer);
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
IOUtils.copy(in, out);
|
IOUtils.copy(in, out);
|
||||||
|
@ -69,7 +70,7 @@ public class WireLiveTest {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
assertEquals(HttpUtils.toHexString(compare), checkNotNull(sysHttpStreamMd5,
|
assertEquals(HttpUtils.toHexString(compare), checkNotNull(sysHttpStreamMd5,
|
||||||
sysHttpStreamMd5));
|
sysHttpStreamMd5));
|
||||||
assertEquals(((BufferLogger) wire.wireLog).buff.toString().getBytes().length, 3331484);
|
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,19 +126,19 @@ public class WireLiveTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Wire setUp() throws Exception {
|
public static HttpWire setUp() throws Exception {
|
||||||
ExecutorService service = Executors.newCachedThreadPool();
|
ExecutorService service = Executors.newCachedThreadPool();
|
||||||
BufferLogger bufferLogger = new BufferLogger();
|
BufferLogger bufferLogger = new BufferLogger();
|
||||||
Wire wire = new Wire(service);
|
HttpWire wire = new HttpWire(service);
|
||||||
wire.wireLog = bufferLogger;
|
wire.wireLog = (bufferLogger);
|
||||||
return wire;
|
return wire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wire setUpSynch() throws Exception {
|
public HttpWire setUpSynch() throws Exception {
|
||||||
ExecutorService service = new WithinThreadExecutorService();
|
ExecutorService service = new WithinThreadExecutorService();
|
||||||
BufferLogger bufferLogger = new BufferLogger();
|
BufferLogger bufferLogger = new BufferLogger();
|
||||||
Wire wire = new Wire(service);
|
HttpWire wire = new HttpWire(service);
|
||||||
wire.wireLog = bufferLogger;
|
wire.wireLog = (bufferLogger);
|
||||||
return wire;
|
return wire;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,12 +146,12 @@ public class WireLiveTest {
|
||||||
public void testRemoteInputInputStream() throws Exception {
|
public void testRemoteInputInputStream() throws Exception {
|
||||||
URL url = new URL(checkNotNull(sysHttpStreamUrl, "sysHttpStreamUrl"));
|
URL url = new URL(checkNotNull(sysHttpStreamUrl, "sysHttpStreamUrl"));
|
||||||
URLConnection connection = url.openConnection();
|
URLConnection connection = url.openConnection();
|
||||||
Wire wire = setUp();
|
HttpWire wire = setUp();
|
||||||
InputStream in = wire.input(connection.getInputStream());
|
InputStream in = wire.input(connection.getInputStream());
|
||||||
byte[] compare = HttpUtils.md5(in);
|
byte[] compare = HttpUtils.md5(in);
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
assertEquals(HttpUtils.toHexString(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5));
|
assertEquals(HttpUtils.toHexString(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5));
|
||||||
assertEquals(((BufferLogger) wire.wireLog).buff.toString().getBytes().length, 3331484);
|
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = "live")
|
@Test(groups = "live")
|
||||||
|
@ -166,12 +167,12 @@ public class WireLiveTest {
|
||||||
public void testRemoteInputInputStreamSynch() throws Exception {
|
public void testRemoteInputInputStreamSynch() throws Exception {
|
||||||
URL url = new URL(checkNotNull(sysHttpStreamUrl, "sysHttpStreamUrl"));
|
URL url = new URL(checkNotNull(sysHttpStreamUrl, "sysHttpStreamUrl"));
|
||||||
URLConnection connection = url.openConnection();
|
URLConnection connection = url.openConnection();
|
||||||
Wire wire = setUpSynch();
|
HttpWire wire = setUpSynch();
|
||||||
InputStream in = wire.input(connection.getInputStream());
|
InputStream in = wire.input(connection.getInputStream());
|
||||||
byte[] compare = HttpUtils.md5(in);
|
byte[] compare = HttpUtils.md5(in);
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
assertEquals(HttpUtils.toHexString(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5));
|
assertEquals(HttpUtils.toHexString(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5));
|
||||||
assertEquals(((BufferLogger) wire.wireLog).buff.toString().getBytes().length, 3331484);
|
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import org.jclouds.concurrent.WithinThreadExecutorService;
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
|
import org.jclouds.http.internal.HttpWire;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.util.Utils;
|
import org.jclouds.util.Utils;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -93,57 +94,57 @@ public class WireTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wire setUp() throws Exception {
|
public HttpWire setUp() throws Exception {
|
||||||
ExecutorService service = Executors.newCachedThreadPool();
|
ExecutorService service = Executors.newCachedThreadPool();
|
||||||
BufferLogger bufferLogger = new BufferLogger();
|
BufferLogger bufferLogger = new BufferLogger();
|
||||||
Wire wire = new Wire(service);
|
HttpWire wire = new HttpWire(service);
|
||||||
wire.wireLog = bufferLogger;
|
wire.wireLog = (bufferLogger);
|
||||||
return wire;
|
return wire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wire setUpSynch() throws Exception {
|
public HttpWire setUpSynch() throws Exception {
|
||||||
ExecutorService service = new WithinThreadExecutorService();
|
ExecutorService service = new WithinThreadExecutorService();
|
||||||
BufferLogger bufferLogger = new BufferLogger();
|
BufferLogger bufferLogger = new BufferLogger();
|
||||||
Wire wire = new Wire(service);
|
HttpWire wire = new HttpWire(service);
|
||||||
wire.wireLog = bufferLogger;
|
wire.wireLog = (bufferLogger);
|
||||||
return wire;
|
return wire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInputInputStream() throws Exception {
|
public void testInputInputStream() throws Exception {
|
||||||
Wire wire = setUp();
|
HttpWire wire = setUp();
|
||||||
InputStream in = wire.input(new ByteArrayInputStream("foo".getBytes()));
|
InputStream in = wire.input(new ByteArrayInputStream("foo".getBytes()));
|
||||||
String compare = Utils.toStringAndClose(in);
|
String compare = Utils.toStringAndClose(in);
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
assertEquals(compare, "foo");
|
assertEquals(compare, "foo");
|
||||||
assertEquals(((BufferLogger) wire.wireLog).buff.toString(), "<< \"foo\"");
|
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString(), "<< \"foo\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInputInputStreamSynch() throws Exception {
|
public void testInputInputStreamSynch() throws Exception {
|
||||||
Wire wire = setUpSynch();
|
HttpWire wire = setUpSynch();
|
||||||
InputStream in = wire.input(new ByteArrayInputStream("foo".getBytes()));
|
InputStream in = wire.input(new ByteArrayInputStream("foo".getBytes()));
|
||||||
String compare = Utils.toStringAndClose(in);
|
String compare = Utils.toStringAndClose(in);
|
||||||
assertEquals(compare, "foo");
|
assertEquals(compare, "foo");
|
||||||
assertEquals(((BufferLogger) wire.wireLog).buff.toString(), "<< \"foo\"");
|
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString(), "<< \"foo\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOutputInputStream() throws Exception {
|
public void testOutputInputStream() throws Exception {
|
||||||
Wire wire = setUp();
|
HttpWire wire = setUp();
|
||||||
InputStream in = wire.output(new ByteArrayInputStream("foo".getBytes()));
|
InputStream in = wire.output(new ByteArrayInputStream("foo".getBytes()));
|
||||||
String compare = Utils.toStringAndClose(in);
|
String compare = Utils.toStringAndClose(in);
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
assertEquals(compare, "foo");
|
assertEquals(compare, "foo");
|
||||||
assertEquals(((BufferLogger) wire.wireLog).buff.toString(), ">> \"foo\"");
|
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString(), ">> \"foo\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOutputBytes() throws Exception {
|
public void testOutputBytes() throws Exception {
|
||||||
Wire wire = setUp();
|
HttpWire wire = setUp();
|
||||||
wire.output("foo".getBytes());
|
wire.output("foo".getBytes());
|
||||||
assertEquals(((BufferLogger) wire.wireLog).buff.toString(), ">> \"foo\"");
|
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString(), ">> \"foo\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOutputString() throws Exception {
|
public void testOutputString() throws Exception {
|
||||||
Wire wire = setUp();
|
HttpWire wire = setUp();
|
||||||
wire.output("foo");
|
wire.output("foo");
|
||||||
assertEquals(((BufferLogger) wire.wireLog).buff.toString(), ">> \"foo\"");
|
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString(), ">> \"foo\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
||||||
import org.jclouds.http.internal.BaseHttpCommandExecutorService;
|
import org.jclouds.http.internal.BaseHttpCommandExecutorService;
|
||||||
import org.jclouds.http.internal.Wire;
|
import org.jclouds.http.internal.HttpWire;
|
||||||
|
|
||||||
import com.google.appengine.api.urlfetch.FetchOptions;
|
import com.google.appengine.api.urlfetch.FetchOptions;
|
||||||
import com.google.appengine.api.urlfetch.HTTPHeader;
|
import com.google.appengine.api.urlfetch.HTTPHeader;
|
||||||
|
@ -68,7 +68,7 @@ public class GaeHttpCommandExecutorService extends BaseHttpCommandExecutorServic
|
||||||
@Inject
|
@Inject
|
||||||
public GaeHttpCommandExecutorService(URLFetchService urlFetchService,
|
public GaeHttpCommandExecutorService(URLFetchService urlFetchService,
|
||||||
ExecutorService executorService, DelegatingRetryHandler retryHandler,
|
ExecutorService executorService, DelegatingRetryHandler retryHandler,
|
||||||
DelegatingErrorHandler errorHandler, Wire wire) {
|
DelegatingErrorHandler errorHandler, HttpWire wire) {
|
||||||
super(executorService, retryHandler, errorHandler, wire);
|
super(executorService, retryHandler, errorHandler, wire);
|
||||||
this.urlFetchService = urlFetchService;
|
this.urlFetchService = urlFetchService;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
||||||
import org.jclouds.http.internal.Wire;
|
import org.jclouds.http.internal.HttpWire;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Parameters;
|
import org.testng.annotations.Parameters;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -71,7 +71,7 @@ public class GaeHttpCommandExecutorServiceTest {
|
||||||
endPoint = URI.create("http://localhost:80/foo");
|
endPoint = URI.create("http://localhost:80/foo");
|
||||||
client = new GaeHttpCommandExecutorService(createNiceMock(URLFetchService.class),
|
client = new GaeHttpCommandExecutorService(createNiceMock(URLFetchService.class),
|
||||||
createNiceMock(ExecutorService.class), createNiceMock(DelegatingRetryHandler.class),
|
createNiceMock(ExecutorService.class), createNiceMock(DelegatingRetryHandler.class),
|
||||||
createNiceMock(DelegatingErrorHandler.class), createNiceMock(Wire.class));
|
createNiceMock(DelegatingErrorHandler.class), createNiceMock(HttpWire.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.jclouds.http.HttpRequestFilter;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
||||||
import org.jclouds.http.httpnio.util.NioHttpUtils;
|
import org.jclouds.http.httpnio.util.NioHttpUtils;
|
||||||
import org.jclouds.http.internal.Wire;
|
import org.jclouds.http.internal.HttpWire;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +57,7 @@ public class NioHttpCommandExecutionHandler implements NHttpRequestExecutionHand
|
||||||
private final ConsumingNHttpEntityFactory entityFactory;
|
private final ConsumingNHttpEntityFactory entityFactory;
|
||||||
private final DelegatingRetryHandler retryHandler;
|
private final DelegatingRetryHandler retryHandler;
|
||||||
private final DelegatingErrorHandler errorHandler;
|
private final DelegatingErrorHandler errorHandler;
|
||||||
private final Wire wire;
|
private final HttpWire wire;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* inputOnly: nothing is taken from this queue.
|
* inputOnly: nothing is taken from this queue.
|
||||||
|
@ -73,7 +73,7 @@ public class NioHttpCommandExecutionHandler implements NHttpRequestExecutionHand
|
||||||
@Inject
|
@Inject
|
||||||
public NioHttpCommandExecutionHandler(ConsumingNHttpEntityFactory entityFactory,
|
public NioHttpCommandExecutionHandler(ConsumingNHttpEntityFactory entityFactory,
|
||||||
BlockingQueue<HttpCommandRendezvous<?>> resubmitQueue,
|
BlockingQueue<HttpCommandRendezvous<?>> resubmitQueue,
|
||||||
DelegatingRetryHandler retryHandler, DelegatingErrorHandler errorHandler, Wire wire) {
|
DelegatingRetryHandler retryHandler, DelegatingErrorHandler errorHandler, HttpWire wire) {
|
||||||
this.entityFactory = entityFactory;
|
this.entityFactory = entityFactory;
|
||||||
this.resubmitQueue = resubmitQueue;
|
this.resubmitQueue = resubmitQueue;
|
||||||
this.retryHandler = retryHandler;
|
this.retryHandler = retryHandler;
|
||||||
|
|
Loading…
Reference in New Issue