Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.cloudfront.model;
 

A complex type that describes how you'd prefer CloudFront to respond to requests that result in either a 4xx or 5xx response. You can control whether a custom error page should be displayed, what the desired response code should be for this error page and how long should the error response be cached by CloudFront. If you don't want to specify any custom error responses, include only an empty CustomErrorResponses element. To delete all custom error responses in an existing distribution, update the distribution configuration and include only an empty CustomErrorResponses element. To add, change, or remove one or more custom error responses, update the distribution configuration and specify all of the custom error responses that you want to include in the updated distribution.

 
 public class CustomErrorResponse implements SerializableCloneable {

    
The 4xx or 5xx HTTP status code that you want to customize. For a list of HTTP status codes that you can customize, see CloudFront documentation.
 
     private Integer errorCode;

    
The path of the custom error page (for example, /custom_404.html). The path is relative to the distribution and must begin with a slash (/). If the path includes any non-ASCII characters or unsafe characters as defined in RFC 1783 (http://www.ietf.org/rfc/rfc1738.txt), URL encode those characters. Do not URL encode any other characters in the path, or CloudFront will not return the custom error page to the viewer.
 
     private String responsePagePath;

    
The HTTP status code that you want CloudFront to return with the custom error page to the viewer. For a list of HTTP status codes that you can replace, see CloudFront Documentation.
 
     private String responseCode;

    
The minimum amount of time you want HTTP error codes to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. You can specify a value from 0 to 31,536,000.
 
     private Long errorCachingMinTTL;

    
The 4xx or 5xx HTTP status code that you want to customize. For a list of HTTP status codes that you can customize, see CloudFront documentation.

Returns:
The 4xx or 5xx HTTP status code that you want to customize. For a list of HTTP status codes that you can customize, see CloudFront documentation.
 
     public Integer getErrorCode() {
         return ;
     }
    
    
The 4xx or 5xx HTTP status code that you want to customize. For a list of HTTP status codes that you can customize, see CloudFront documentation.

Parameters:
errorCode The 4xx or 5xx HTTP status code that you want to customize. For a list of HTTP status codes that you can customize, see CloudFront documentation.
 
     public void setErrorCode(Integer errorCode) {
         this. = errorCode;
     }
    
    
The 4xx or 5xx HTTP status code that you want to customize. For a list of HTTP status codes that you can customize, see CloudFront documentation.

Returns a reference to this object so that method calls can be chained together.

Parameters:
errorCode The 4xx or 5xx HTTP status code that you want to customize. For a list of HTTP status codes that you can customize, see CloudFront documentation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CustomErrorResponse withErrorCode(Integer errorCode) {
        this. = errorCode;
        return this;
    }

    
The path of the custom error page (for example, /custom_404.html). The path is relative to the distribution and must begin with a slash (/). If the path includes any non-ASCII characters or unsafe characters as defined in RFC 1783 (http://www.ietf.org/rfc/rfc1738.txt), URL encode those characters. Do not URL encode any other characters in the path, or CloudFront will not return the custom error page to the viewer.

Returns:
The path of the custom error page (for example, /custom_404.html). The path is relative to the distribution and must begin with a slash (/). If the path includes any non-ASCII characters or unsafe characters as defined in RFC 1783 (http://www.ietf.org/rfc/rfc1738.txt), URL encode those characters. Do not URL encode any other characters in the path, or CloudFront will not return the custom error page to the viewer.
    public String getResponsePagePath() {
        return ;
    }
    
    
The path of the custom error page (for example, /custom_404.html). The path is relative to the distribution and must begin with a slash (/). If the path includes any non-ASCII characters or unsafe characters as defined in RFC 1783 (http://www.ietf.org/rfc/rfc1738.txt), URL encode those characters. Do not URL encode any other characters in the path, or CloudFront will not return the custom error page to the viewer.

Parameters:
responsePagePath The path of the custom error page (for example, /custom_404.html). The path is relative to the distribution and must begin with a slash (/). If the path includes any non-ASCII characters or unsafe characters as defined in RFC 1783 (http://www.ietf.org/rfc/rfc1738.txt), URL encode those characters. Do not URL encode any other characters in the path, or CloudFront will not return the custom error page to the viewer.
    public void setResponsePagePath(String responsePagePath) {
        this. = responsePagePath;
    }
    
    
The path of the custom error page (for example, /custom_404.html). The path is relative to the distribution and must begin with a slash (/). If the path includes any non-ASCII characters or unsafe characters as defined in RFC 1783 (http://www.ietf.org/rfc/rfc1738.txt), URL encode those characters. Do not URL encode any other characters in the path, or CloudFront will not return the custom error page to the viewer.

Returns a reference to this object so that method calls can be chained together.

Parameters:
responsePagePath The path of the custom error page (for example, /custom_404.html). The path is relative to the distribution and must begin with a slash (/). If the path includes any non-ASCII characters or unsafe characters as defined in RFC 1783 (http://www.ietf.org/rfc/rfc1738.txt), URL encode those characters. Do not URL encode any other characters in the path, or CloudFront will not return the custom error page to the viewer.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CustomErrorResponse withResponsePagePath(String responsePagePath) {
        this. = responsePagePath;
        return this;
    }

    
The HTTP status code that you want CloudFront to return with the custom error page to the viewer. For a list of HTTP status codes that you can replace, see CloudFront Documentation.

Returns:
The HTTP status code that you want CloudFront to return with the custom error page to the viewer. For a list of HTTP status codes that you can replace, see CloudFront Documentation.
    public String getResponseCode() {
        return ;
    }
    
    
The HTTP status code that you want CloudFront to return with the custom error page to the viewer. For a list of HTTP status codes that you can replace, see CloudFront Documentation.

Parameters:
responseCode The HTTP status code that you want CloudFront to return with the custom error page to the viewer. For a list of HTTP status codes that you can replace, see CloudFront Documentation.
    public void setResponseCode(String responseCode) {
        this. = responseCode;
    }
    
    
The HTTP status code that you want CloudFront to return with the custom error page to the viewer. For a list of HTTP status codes that you can replace, see CloudFront Documentation.

Returns a reference to this object so that method calls can be chained together.

Parameters:
responseCode The HTTP status code that you want CloudFront to return with the custom error page to the viewer. For a list of HTTP status codes that you can replace, see CloudFront Documentation.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CustomErrorResponse withResponseCode(String responseCode) {
        this. = responseCode;
        return this;
    }

    
The minimum amount of time you want HTTP error codes to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. You can specify a value from 0 to 31,536,000.

Returns:
The minimum amount of time you want HTTP error codes to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. You can specify a value from 0 to 31,536,000.
    public Long getErrorCachingMinTTL() {
        return ;
    }
    
    
The minimum amount of time you want HTTP error codes to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. You can specify a value from 0 to 31,536,000.

Parameters:
errorCachingMinTTL The minimum amount of time you want HTTP error codes to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. You can specify a value from 0 to 31,536,000.
    public void setErrorCachingMinTTL(Long errorCachingMinTTL) {
        this. = errorCachingMinTTL;
    }
    
    
The minimum amount of time you want HTTP error codes to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. You can specify a value from 0 to 31,536,000.

Returns a reference to this object so that method calls can be chained together.

Parameters:
errorCachingMinTTL The minimum amount of time you want HTTP error codes to stay in CloudFront caches before CloudFront queries your origin to see whether the object has been updated. You can specify a value from 0 to 31,536,000.
Returns:
A reference to this updated object so that method calls can be chained together.
    public CustomErrorResponse withErrorCachingMinTTL(Long errorCachingMinTTL) {
        this. = errorCachingMinTTL;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getErrorCode() != nullsb.append("ErrorCode: " + getErrorCode() + ",");
        if (getResponsePagePath() != nullsb.append("ResponsePagePath: " + getResponsePagePath() + ",");
        if (getResponseCode() != nullsb.append("ResponseCode: " + getResponseCode() + ",");
        if (getErrorCachingMinTTL() != nullsb.append("ErrorCachingMinTTL: " + getErrorCachingMinTTL() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getErrorCode() == null) ? 0 : getErrorCode().hashCode()); 
        hashCode = prime * hashCode + ((getResponsePagePath() == null) ? 0 : getResponsePagePath().hashCode()); 
        hashCode = prime * hashCode + ((getResponseCode() == null) ? 0 : getResponseCode().hashCode()); 
        hashCode = prime * hashCode + ((getErrorCachingMinTTL() == null) ? 0 : getErrorCachingMinTTL().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof CustomErrorResponse == falsereturn false;
        CustomErrorResponse other = (CustomErrorResponse)obj;
        
        if (other.getErrorCode() == null ^ this.getErrorCode() == nullreturn false;
        if (other.getErrorCode() != null && other.getErrorCode().equals(this.getErrorCode()) == falsereturn false
        if (other.getResponsePagePath() == null ^ this.getResponsePagePath() == nullreturn false;
        if (other.getResponsePagePath() != null && other.getResponsePagePath().equals(this.getResponsePagePath()) == falsereturn false
        if (other.getResponseCode() == null ^ this.getResponseCode() == nullreturn false;
        if (other.getResponseCode() != null && other.getResponseCode().equals(this.getResponseCode()) == falsereturn false
        if (other.getErrorCachingMinTTL() == null ^ this.getErrorCachingMinTTL() == nullreturn false;
        if (other.getErrorCachingMinTTL() != null && other.getErrorCachingMinTTL().equals(this.getErrorCachingMinTTL()) == falsereturn false
        return true;
    }
    
    @Override
    public CustomErrorResponse clone() {
        try {
            return (CustomErrorResponsesuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X