@Override
    public void beforeRequest(Request<?> request) {
        AmazonWebServiceRequest originalRequest = request.getOriginalRequest();
        String retrieveQueueUrl = retrieveQueueUrl(originalRequest);
        try {
            if (retrieveQueueUrl == null) {
                return;
            }

            URI uri = new URI(retrieveQueueUrl);
            request.setResourcePath(uri.getPath());

            if (uri.getHost() != null) {
                // If the URI has a host specified, set the request's endpoint to the queue URLs
                // endpoint, so that queue URLs from different regions will send the request to
                // the correct endpoint.
                URI uriWithoutPath = new URI(uri.toString().replace(uri.getPath(), ""));
                appendUserAgent(request, uriWithoutPath);
                request.setEndpoint(uriWithoutPath);
            }
        } catch (URISyntaxException e) {
            throw new AmazonClientException("Unable to parse SQS queue URL '" + retrieveQueueUrl + "'", e);
        }
    }
Custom request handler for SQS that processes the request before it gets routed to the client
runtime layer.
<p>
SQS MessageQueue operations take a QueueUrl parameter that needs special handling to update the
endpoint and resource path on the request before it's executed.
aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/QueueUrlHandler.java