All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.azure.storage.CorsRule Maven / Gradle / Ivy

/**
 * Copyright Microsoft Corporation
 * 
 * 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://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License 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.microsoft.azure.storage;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

/**
 * Represents a Cross-Origin Resource Sharing (CORS) rule.
 */
public class CorsRule {

    /**
     * The domain names allowed via CORS.
     */
    private List allowedOrigins = new ArrayList();

    /**
     * The response headers that should be exposed to client via CORS.
     */
    private List exposedHeaders = new ArrayList();

    /**
     * The headers allowed to be part of the CORS request.
     */
    private List allowedHeaders = new ArrayList();

    /**
     * The HTTP methods permitted to execute for the allowedOrigins.
     */
    private EnumSet allowedMethods = EnumSet.noneOf(CorsHttpMethods.class);

    /**
     * The length of time in seconds that a preflight response should be cached by browser.
     */
    private int maxAgeInSeconds = 0;

    /**
     * Gets the allowed origins.
     * 
     * @return A List object which contains the allowed origins.
     */
    public List getAllowedOrigins() {
        return this.allowedOrigins;
    }

    /**
     * Sets the allowed origins.
     * 
     * Limited to 64 origins OR "*" to allow all origins, no more than 256 characters each.
     * 
     * @param allowedOrigins
     *            A List object which contains the allowed origins.
     */
    public void setAllowedOrigins(List allowedOrigins) {
        this.allowedOrigins = allowedOrigins;
    }

    /**
     * Gets the exposed headers.
     * 
     * @return A List object which contains the exposed headers.
     */
    public List getExposedHeaders() {
        return this.exposedHeaders;
    }

    /**
     * Sets the exposed headers.
     * 
     * Limited to 64 defined headers and two prefixed headers, no more than 256 characters each.
     * 
     * @param exposedHeaders
     *            A List object which contains the exposed headers.
     */
    public void setExposedHeaders(List exposedHeaders) {
        this.exposedHeaders = exposedHeaders;
    }

    /**
     * Gets the allowed headers.
     * 
     * @return A List object which contains the allowed headers.
     */
    public List getAllowedHeaders() {
        return this.allowedHeaders;
    }

    /**
     * Sets the allowed headers.
     * 
     * Limited to 64 defined headers and two prefixed headers, no more than 256 characters each.
     * 
     * @param allowedHeaders
     *            A List object which contains the allowed headers.
     */
    public void setAllowedHeaders(List allowedHeaders) {
        this.allowedHeaders = allowedHeaders;
    }

    /**
     * Gets the allowed methods.
     * 
     * @return A List object which contains the allowed methods.
     */
    public EnumSet getAllowedMethods() {
        return this.allowedMethods;
    }

    /**
     * Sets the allowed methods.
     * 
     * @param allowedMethods
     *            A List object which contains the allowed methods.
     */
    public void setAllowedMethods(EnumSet allowedMethods) {
        this.allowedMethods = allowedMethods;
    }

    /**
     * Gets the maximum age in seconds.
     * 
     * @return An int which represents the the maximum age in seconds.
     */
    public int getMaxAgeInSeconds() {
        return this.maxAgeInSeconds;
    }

    /**
     * Sets the maximum age in seconds.
     * 
     * @param maxAgeInSeconds
     *            An int which represents the the maximum age in seconds.
     */
    public void setMaxAgeInSeconds(int maxAgeInSeconds) {
        this.maxAgeInSeconds = maxAgeInSeconds;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy