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

com.obs.services.model.OptionsInfoResult Maven / Gradle / Ivy

There is a newer version: 3.24.9
Show newest version
/**
* Copyright 2019 Huawei Technologies Co.,Ltd.
* 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.obs.services.model;

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

/**
 * Response to a bucket or object preflight request
 *
 */
public class OptionsInfoResult extends HeaderResponse {
    protected String allowOrigin;

    protected List allowHeaders;

    protected int maxAge;

    protected List allowMethods;

    protected List exposeHeaders;

    public OptionsInfoResult(String allowOrigin, List allowHeaders, int maxAge, List allowMethods,
            List exposeHeaders) {
        super();
        this.allowOrigin = allowOrigin;
        this.allowHeaders = allowHeaders;
        this.maxAge = maxAge;
        this.allowMethods = allowMethods;
        this.exposeHeaders = exposeHeaders;
    }

    protected OptionsInfoResult() {
    }
    
    /**
     * Obtain the origin of the allowed cross-origin request.
     * 
     * @return Origin of the allowed cross-origin request
     */
    public String getAllowOrigin() {
        return allowOrigin;
    }

    /**
     * Obtain the list of allowed request headers.
     * 
     * @return List of allowed request headers
     */
    public List getAllowHeaders() {
        if (this.allowHeaders == null) {
            allowHeaders = new ArrayList();
        }
        return allowHeaders;
    }

    /**
     * Obtain the cache duration (in seconds) of the request result in the
     * instance of ObsClient.
     * 
     * @return Cache duration of the request result in the instance of ObsClient
     */
    public int getMaxAge() {
        return maxAge;
    }

    /**
     * Obtain the list of allowed cross-origin request methods.
     * 
     * @return List of allowed cross-origin request methods
     */
    public List getAllowMethods() {
        if (this.allowMethods == null) {
            this.allowMethods = new ArrayList();
        }
        return allowMethods;
    }

    /**
     * Obtain the list of allowed additional headers in the response.
     * 
     * @return List of allowed additional headers in the response
     */
    public List getExposeHeaders() {
        if (this.exposeHeaders == null) {
            this.exposeHeaders = new ArrayList();
        }
        return exposeHeaders;
    }

    @Override
    public String toString() {
        return "OptionsInfoResult [allowOrigin=" + allowOrigin + ", allowHeaders=" + allowHeaders + ", maxAge=" + maxAge
                + ", allowMethods=" + allowMethods + ", exposeHeaders=" + exposeHeaders + "]";
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy