private void init() { exceptionUnmarshallers.add(new PackedPolicyTooLargeExceptionUnmarshaller()); exceptionUnmarshallers.add(new MalformedPolicyDocumentExceptionUnmarshaller()); exceptionUnmarshallers.add(new StandardErrorUnmarshaller()); setEndpoint("sts.amazonaws.com"); signer = new AWS4Signer(); signer.setServiceName("sts"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandlers.addAll( chainFactory.newRequestHandlerChain( "/com/amazonaws/services/securitytoken/request.handlers")); }
/** * Overrides the default endpoint for this client ("https://sts.amazonaws.com") and explicitly * provides an AWS region ID and AWS service name to use when the client calculates a signature * for requests. In almost all cases, this region ID and service name are automatically determined * from the endpoint, and callers should use the simpler one-argument form of setEndpoint instead * of this method. * * <p><b>This method is not threadsafe. Endpoints should be configured when the client is created * and before any service requests are made. Changing it afterwards creates inevitable race * conditions for any service requests in transit.</b> * * <p>Callers can pass in just the endpoint (ex: "sts.amazonaws.com") or a full URL, including the * protocol (ex: "https://sts.amazonaws.com"). If the protocol is not specified here, the default * protocol from this client's {@link ClientConfiguration} will be used, which by default is * HTTPS. * * <p>For more information on using AWS regions with the AWS SDK for Java, and a complete list of * all available endpoints for all AWS services, see: <a * href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912"> * http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912</a> * * @param endpoint The endpoint (ex: "sts.amazonaws.com") or a full URL, including the protocol * (ex: "https://sts.amazonaws.com") of the region specific AWS endpoint this client will * communicate with. * @param serviceName The name of the AWS service to use when signing requests. * @param regionId The ID of the region in which this service resides. * @throws IllegalArgumentException If any problems are detected with the specified endpoint. */ public void setEndpoint(String endpoint, String serviceName, String regionId) throws IllegalArgumentException { setEndpoint(endpoint); signer.setServiceName(serviceName); signer.setRegionName(regionId); }