コード例 #1
0
  private void init() {
    exceptionUnmarshallers.add(new AuthorizationErrorExceptionUnmarshaller());
    exceptionUnmarshallers.add(new TopicLimitExceededExceptionUnmarshaller());
    exceptionUnmarshallers.add(new NotFoundExceptionUnmarshaller());
    exceptionUnmarshallers.add(new InternalErrorExceptionUnmarshaller());
    exceptionUnmarshallers.add(new SubscriptionLimitExceededExceptionUnmarshaller());
    exceptionUnmarshallers.add(new InvalidParameterExceptionUnmarshaller());

    exceptionUnmarshallers.add(new StandardErrorUnmarshaller());
    setEndpoint("sns.us-east-1.amazonaws.com");

    signer = new AWS4Signer();

    signer.setServiceName("sns");

    HandlerChainFactory chainFactory = new HandlerChainFactory();
    requestHandlers.addAll(
        chainFactory.newRequestHandlerChain("/com/amazonaws/services/sns/request.handlers"));
  }
コード例 #2
0
 /**
  * Overrides the default endpoint for this client ("https://sns.us-east-1.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: "sns.us-east-1.amazonaws.com") or a full URL,
  * including the protocol (ex: "https://sns.us-east-1.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: "sns.us-east-1.amazonaws.com") or a full URL, including the
  *     protocol (ex: "https://sns.us-east-1.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);
 }