Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2011-2015 Amazon Technologies, Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at:
   *
   *    http://aws.amazon.com/apache2.0
   *
  * 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.s3.model;
 
 import java.util.List;

Container for rules of cross origin configuration.
 
 public class CORSRule {
 
     private String id;
     private List<AllowedMethodsallowedMethods;
     private List<StringallowedOrigins;
     private int maxAgeSeconds;
     private List<StringexposedHeaders;
     private List<StringallowedHeaders;
    
    
Sets the ID of this rule. Rules must be less than 255 alphanumeric characters, and must be unique for a bucket. If you do not assign an ID, one will be generated.
 
     public void setId(String id) {
         this. = id;
     }
    
    
Returns the Id of this rule.
 
     public String getId() {
         return ;
     }

    
Sets the ID of this rule and returns a reference to this object for method chaining.

 
     public CORSRule withId(String id) {
         this. = id;
         return this;
     }

    
Sets the allowed methods of the rule.
 
     public void setAllowedMethods(List<AllowedMethodsallowedMethods) {
         this. = allowedMethods;
     }
    
    
Convenience array style method for setAllowedMethods(java.util.List)
 
     public void setAllowedMethods(AllowedMethods... allowedMethods) {
     	this. = Arrays.asList(allowedMethods);  
     }
    
    
Returns the allowed methods of this rule.
 
     public List<AllowedMethodsgetAllowedMethods() {
         return ;
     }

    
Sets the allowed methods of this rule and returns a reference to this object for method chaining.

 
     public CORSRule withAllowedMethods(List<AllowedMethodsallowedMethods) {
         this. = allowedMethods;
         return this;
     }
    
    
Sets the allowed origins of the rule.
 
     public void setAllowedOrigins(List<StringallowedOrigins) {
         this. = allowedOrigins;
     }
    
    
Convenience array style method for setAllowedOrigins(java.util.List)
    public void setAllowedOrigins(String... allowedOrigins) {
        this. = Arrays.asList(allowedOrigins);
    }
    
    
Returns the allowed origins of this rule and returns a reference to this object for method chaining.
    public List<StringgetAllowedOrigins() {
        return ;
    }

    
Sets the allowed origins of this rule and returns a reference to this object for method chaining.

    public CORSRule withAllowedOrigins(List<StringallowedOrigins) {
        this. = allowedOrigins;
        return this;
    }
    
    
Sets the max age in seconds of the rule.
    public void setMaxAgeSeconds(int maxAgeSeconds) {
    	this. = maxAgeSeconds;
    }
    
    
Sets the ID of this rule and returns a reference to this object for method chaining.

    public int getMaxAgeSeconds() {
    	return ;
    }
    
    
Sets the max age in seconds of this rule and returns a reference to this object for method chaining.

    public CORSRule withMaxAgeSeconds(int maxAgeSeconds) {
    	this. = maxAgeSeconds;
    	return this;
    }
 
    
Sets the expose headers of the rule.
    public void setExposedHeaders(List<StringexposedHeaders) {
    	this. = exposedHeaders;
    }
    
    
Convenience array style method for setExposedHeaders(java.util.List)
    public void setExposedHeaders(String... exposedHeaders) {
    	this. = Arrays.asList(exposedHeaders);
    }
    
    
    
Returns expose headers of this rule and returns a reference to this object for method chaining.
    public List<StringgetExposedHeaders() {
    	return ;
    }
    
    
Sets the exposeHeaders of this rule and returns a reference to this object for method chaining.

    public CORSRule withExposedHeaders(List<StringexposedHeaders) {
    	this. = exposedHeaders;
    	return this;
    }
    
    
Sets the allowed headers for the rule.
    public void setAllowedHeaders(List<StringallowedHeaders) {
    	this. = allowedHeaders;
    }
    
    
Convenience array style method for setAllowedHeaders(java.util.List)
    public void setAllowedHeaders(String... allowedHeaders) {
    	this. = Arrays.asList(allowedHeaders);
    }
                     
    
Returns allowed headers of this rule.
    public List<StringgetAllowedHeaders() {
    	return ;
    }
    
    
Sets the allowed headers of this rule and returns a reference to this object for method chaining.

    public CORSRule withAllowedHeaders(List<StringallowedHeaders) {
    	this. = allowedHeaders;
    	return this;
    }
    
    
Enumeration of names of the all the allowed methods.
    public static enum AllowedMethods {
		 GET("GET"),
		 PUT("PUT"),
		 HEAD("HEAD"),
		 POST("POST"),
		 DELETE("DELETE");
		 private final String AllowedMethod;
		  private AllowedMethods(String AllowedMethod) {
		       this. = AllowedMethod;
		 }
		    /* (non-Javadoc)
		     * @see java.lang.Enum#toString()
		     */
		  public String toString() {
		       return ;
		   }
		  public static AllowedMethods fromValue(String allowedMethodthrows IllegalArgumentException {
		       for (AllowedMethods method : AllowedMethods.values()) {
		           String methodString = method.toString();
		           if (methodString == null && allowedMethod == nullreturn method;
		           if (methodString != null && methodString.equals(allowedMethod)) return method;
		   }
		      throw new IllegalArgumentException(
		          "Cannot create enum from " + allowedMethod + " value!");
		   }
	 }
	 
New to GrepCode? Check out our FAQ X