
nl.tweeenveertig.openstack.headers.account.AccountMetadata Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of joss Show documentation
Show all versions of joss Show documentation
Java Client library for OpenStack Storage (Swift)
package nl.tweeenveertig.openstack.headers.account;
import nl.tweeenveertig.openstack.headers.Metadata;
import org.apache.http.HttpResponse;
import java.util.Map;
import java.util.TreeMap;
public class AccountMetadata extends Metadata {
public static final String X_ACCOUNT_META_PREFIX = "X-Account-Meta-";
public AccountMetadata(String name, String value) {
super(name, value);
}
@Override
public String getHeaderName() {
return X_ACCOUNT_META_PREFIX + getName();
}
public static Map fromResponse(HttpResponse response) {
Map metadata = new TreeMap();
for (org.apache.http.Header header : getResponseHeadersStartingWith(response, X_ACCOUNT_META_PREFIX)) {
AccountMetadata accountMetadata = new AccountMetadata(header.getName().substring(X_ACCOUNT_META_PREFIX.length()), header.getValue());
metadata.put(accountMetadata.getName(), accountMetadata);
}
return metadata;
}
}