Package com.cloud.bridge.service.core.s3

Source Code of com.cloud.bridge.service.core.s3.S3AuthParams

package com.cloud.bridge.service.core.s3;

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

import com.cloud.bridge.util.HeaderParam;

/**
* We need to be able to pass in specific values into the S3 REST authentication algorithm
* where these values can be obtained from either HTTP headers directly or from the body
* of a POST request.
*/
public class S3AuthParams {

  private List<HeaderParam> headerList = new ArrayList<HeaderParam>();
 
  public S3AuthParams() {
  }
 
  public HeaderParam[] getHeaders() {
    return headerList.toArray(new HeaderParam[0]);
  }
 
  public void addHeader(HeaderParam param) {
    headerList.add( param );
  }
 
  public String getHeader( String header )
  {
    // ToDO - make this look up faster
    ListIterator it = headerList.listIterator();
    while( it.hasNext())
    {
      HeaderParam temp = (HeaderParam)it.next();
      if (header.equalsIgnoreCase( temp.getName())) {
        return temp.getValue();
      }
    }
    return null;
  }
}
TOP

Related Classes of com.cloud.bridge.service.core.s3.S3AuthParams

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.