本文整理了Java中com.amazonaws.Request.getHandlerContext
方法的一些代码示例,展示了Request.getHandlerContext
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getHandlerContext
方法的具体详情如下:
包路径:com.amazonaws.Request
类名称:Request
方法名:getHandlerContext
暂无
代码示例来源:origin: aws/aws-sdk-java
/**
* @return True if chunked encoding has been explicitly disabled per the request. False
* otherwise.
*/
private boolean isChunkedEncodingDisabled(SignableRequest<?> signableRequest) {
if (signableRequest instanceof Request) {
Request<?> request = (Request<?>) signableRequest;
Boolean isChunkedEncodingDisabled = request
.getHandlerContext(S3HandlerContextKeys.IS_CHUNKED_ENCODING_DISABLED);
return isChunkedEncodingDisabled != null && isChunkedEncodingDisabled;
}
return false;
}
代码示例来源:origin: aws/aws-sdk-java
/**
* @param request Marshalled request.
* @param key Key to check.
* @return True if advanced config is available in the context AND the specified key is present AND has the value true,
* false otherwise.
*/
private boolean isAdvancedConfigFlagTrue(Request<?> request, AdvancedConfig.Key<Boolean> key) {
AdvancedConfig advancedConfig = request.getHandlerContext(HandlerContextKey.ADVANCED_CONFIG);
if (advancedConfig == null) {
return false;
}
Boolean flag = advancedConfig.get(key);
return Boolean.TRUE.equals(flag);
}
}
代码示例来源:origin: aws/aws-sdk-java
/**
* @return True if payload signing is explicitly enabled.
*/
private boolean isPayloadSigningEnabled(SignableRequest<?> signableRequest) {
/**
* If we aren't using https we should always sign the payload.
*/
if (!signableRequest.getEndpoint().getScheme().equals("https")) {
return true;
}
if (signableRequest instanceof Request) {
Request<?> request = (Request<?>) signableRequest;
Boolean isPayloadSigningEnabled = request
.getHandlerContext(S3HandlerContextKeys.IS_PAYLOAD_SIGNING_ENABLED);
return isPayloadSigningEnabled != null && isPayloadSigningEnabled;
}
return false;
}
代码示例来源:origin: aws/aws-sdk-java
@Override
public void beforeRequest(Request<?> request) {
if (!requestClassToPreSign.isInstance(request.getOriginalRequest())) return;
if (request.getParameters().containsKey(PARAM_PRESIGNED_URL)) return;
PresignableRequest presignableRequest = adaptRequest(requestClassToPreSign.cast(
request.getOriginalRequest()));
String sourceRegion = presignableRequest.getSourceRegion();
if (sourceRegion == null) return;
String destinationRegion = AwsHostNameUtils.parseRegion(request.getEndpoint().getHost(),
SERVICE_NAME);
Request<?> requestToPresign = presignableRequest.marshall();
requestToPresign.getParameters().remove(PARAM_SOURCE_REGION);
requestToPresign.getParameters().put(PARAM_DESTINATION_REGION, Arrays.asList(destinationRegion));
requestToPresign.setEndpoint(createEndpoint(sourceRegion, SERVICE_NAME));
requestToPresign.setHttpMethod(HttpMethodName.GET);
AWSCredentials credentials = request.getHandlerContext(HandlerContextKey.AWS_CREDENTIALS);
requestToPresign = presignRequest(requestToPresign, credentials, sourceRegion);
final String presignedUrl = generateUrl(requestToPresign);
presignableRequest.setPreSignedUrl(presignedUrl);
request.addParameter(PARAM_PRESIGNED_URL, presignedUrl);
// Remove the unmodeled params to stop them getting onto the wire
request.getParameters().remove(PARAM_SOURCE_REGION);
}
代码示例来源:origin: aws/aws-sdk-java
AWSRequestMetrics metrics = context.getRequest().getAWSRequestMetrics();
String apiName = request.getHandlerContext(HandlerContextKey.OPERATION_NAME);
String serviceId = request.getHandlerContext(HandlerContextKey.SERVICE_ID);
String sessionToken = getSessionToken(request.getHeaders());
String region = request.getHandlerContext(HandlerContextKey.SIGNING_REGION);
if (request.getHandlerContext(HandlerContextKey.AWS_CREDENTIALS) != null) {
accessKey = request.getHandlerContext(HandlerContextKey.AWS_CREDENTIALS).getAWSAccessKeyId();
代码示例来源:origin: aws/aws-sdk-java
String apiName = request.getHandlerContext(HandlerContextKey.OPERATION_NAME);
String serviceId = request.getHandlerContext(HandlerContextKey.SERVICE_ID);
String region = request.getHandlerContext(HandlerContextKey.SIGNING_REGION);
ApiCallAttemptMonitoringEvent lastApiCallAttempt = request.getHandlerContext(LAST_CALL_ATTEMPT);
代码示例来源:origin: Nextdoor/bender
/**
* @return True if chunked encoding has been explicitly disabled per the request. False
* otherwise.
*/
private boolean isChunkedEncodingDisabled(SignableRequest<?> signableRequest) {
if (signableRequest instanceof Request) {
Request<?> request = (Request<?>) signableRequest;
Boolean isChunkedEncodingDisabled = request
.getHandlerContext(S3HandlerContextKeys.IS_CHUNKED_ENCODING_DISABLED);
return isChunkedEncodingDisabled != null && isChunkedEncodingDisabled;
}
return false;
}
代码示例来源:origin: com.amazonaws/aws-java-sdk-core
AWSRequestMetrics metrics = context.getRequest().getAWSRequestMetrics();
String apiName = request.getHandlerContext(HandlerContextKey.OPERATION_NAME);
String serviceId = request.getHandlerContext(HandlerContextKey.SERVICE_ID);
String sessionToken = getSessionToken(request.getHeaders());
String region = request.getHandlerContext(HandlerContextKey.SIGNING_REGION);
if (request.getHandlerContext(HandlerContextKey.AWS_CREDENTIALS) != null) {
accessKey = request.getHandlerContext(HandlerContextKey.AWS_CREDENTIALS).getAWSAccessKeyId();
代码示例来源:origin: com.amazonaws/aws-java-sdk-core
String apiName = request.getHandlerContext(HandlerContextKey.OPERATION_NAME);
String serviceId = request.getHandlerContext(HandlerContextKey.SERVICE_ID);
String region = request.getHandlerContext(HandlerContextKey.SIGNING_REGION);
ApiCallAttemptMonitoringEvent lastApiCallAttempt = request.getHandlerContext(LAST_CALL_ATTEMPT);
代码示例来源:origin: aws/aws-xray-sdk-java
private void finalizeSubsegment(Request<?> request) {
recorder.endSubsegment();
Long executingThreadContext = request.getHandlerContext(executingThreadKey);
if (executingThreadContext != null && Thread.currentThread().getId() != executingThreadContext) {
recorder.clearTraceEntity();
}
}
代码示例来源:origin: Nextdoor/bender
/**
* @return True if payload signing is explicitly enabled.
*/
private boolean isPayloadSigningEnabled(SignableRequest<?> signableRequest) {
/**
* If we aren't using https we should always sign the payload.
*/
if (!signableRequest.getEndpoint().getScheme().equals("https")) {
return true;
}
if (signableRequest instanceof Request) {
Request<?> request = (Request<?>) signableRequest;
Boolean isPayloadSigningEnabled = request
.getHandlerContext(S3HandlerContextKeys.IS_PAYLOAD_SIGNING_ENABLED);
return isPayloadSigningEnabled != null && isPayloadSigningEnabled;
}
return false;
}
代码示例来源:origin: com.amazonaws/aws-java-sdk-rds
@Override
public void beforeRequest(Request<?> request) {
if (!requestClassToPreSign.isInstance(request.getOriginalRequest())) return;
if (request.getParameters().containsKey(PARAM_PRESIGNED_URL)) return;
PresignableRequest presignableRequest = adaptRequest(requestClassToPreSign.cast(
request.getOriginalRequest()));
String sourceRegion = presignableRequest.getSourceRegion();
if (sourceRegion == null) return;
String destinationRegion = AwsHostNameUtils.parseRegion(request.getEndpoint().getHost(),
SERVICE_NAME);
Request<?> requestToPresign = presignableRequest.marshall();
requestToPresign.getParameters().remove(PARAM_SOURCE_REGION);
requestToPresign.getParameters().put(PARAM_DESTINATION_REGION, Arrays.asList(destinationRegion));
requestToPresign.setEndpoint(createEndpoint(sourceRegion, SERVICE_NAME));
requestToPresign.setHttpMethod(HttpMethodName.GET);
AWSCredentials credentials = request.getHandlerContext(HandlerContextKey.AWS_CREDENTIALS);
requestToPresign = presignRequest(requestToPresign, credentials, sourceRegion);
final String presignedUrl = generateUrl(requestToPresign);
presignableRequest.setPreSignedUrl(presignedUrl);
request.addParameter(PARAM_PRESIGNED_URL, presignedUrl);
// Remove the unmodeled params to stop them getting onto the wire
request.getParameters().remove(PARAM_SOURCE_REGION);
}
代码示例来源:origin: aws/aws-xray-sdk-java
return;
Entity entityContext = request.getHandlerContext(entityKey);
if (null != entityContext) {
recorder.setTraceEntity(entityContext);
内容来源于网络,如有侵权,请联系作者删除!