How to use AWSRequestSigningApacheInterceptor with

2019-08-07 05:11发布

问题:

I am trying to use REST calls to Neptune SPARQL on existing Java code which already uses Apache HTTP clients. I'd like to not mix and match AWS SDK1 and SDK2 (which I use for the S3 portion of loading owl to Neptune).

I see these solutions:

  • AWSRequestSigningApacheInterceptor that works with SDK1, but can't find the equivalent in SDK2.

  • aws-request-signing-apache-interceptor on github for building an adaptor class so it can be used in SDK 2 with mix-and-match SDK 1 & 2

  • javaquery/Examples where Vicky Thakor has gone even more generic and just implemented the V4 signing for any Java REST implementation

But none of these is what I expected: an AWS or Apache implmentation of an Apache Interceptor for AWS SDK 2.

Is there such a thing? or is one of the above solutions the best available at the moment?

回答1:

So, I settled on the second option with an important caveat: it does not handle AWS_SESSION_TOKEN. This is a simple fix. I've posted it along with the original answer at http://github.com/awslabs/aws-request-signing-apache-interceptor/