List of usage examples for com.google.common.collect ImmutableMultimap of
public static <K, V> ImmutableMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3)
From source file:org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest.java
@Override public HttpRequest filter(HttpRequest request) throws HttpException { String token = vcloudTokenProvider.get(); String acceptType = request.getFirstHeaderOrNull(HttpHeaders.ACCEPT) == null ? "application/*+xml" : request.getFirstHeaderOrNull(HttpHeaders.ACCEPT); String version = ";version=" + apiVersion; String acceptHeader = acceptType + version; return request.toBuilder().replaceHeaders(ImmutableMultimap.of(HttpHeaders.ACCEPT, acceptHeader, "x-vcloud-authorization", token, HttpHeaders.COOKIE, "vcloud-token=" + token)).build(); }
From source file:org.jclouds.examples.rackspace.cloudfiles.CrossOriginResourceSharingContainer.java
/** * Create a Cross Origin Resource Sharing container. * * Access-Control-Allow-Origin: Which URLs can make Cross Origin Requests. Format is http://www.example.com. * Separate URLs with a space. An asterisk (*) allows all. * Access-Control-Max-Age: The maximum age for the browser to cache the options request, in seconds. * Access-Control-Allow-Headers: Which custom metadata headers you allow to be assigned to objects in this container. *//*from w w w.ja v a 2 s. c o m*/ private void createCorsContainer() { System.out.format("Create Cross Origin Resource Sharing Container%n"); Multimap<String, String> headers = ImmutableMultimap.of("Access-Control-Allow-Origin", "*", "Access-Control-Max-Age", "600", "Access-Control-Allow-Headers", "X-My-Header"); CreateContainerOptions options = CreateContainerOptions.Builder.headers(headers); containerApi.create(CONTAINER, options); System.out.format(" %s%n", CONTAINER); Container container = containerApi.get(CONTAINER); System.out.format(" %s%n", container.getMetadata()); }
From source file:com.google.enterprise.connector.ldap.MockLdapHandlers.java
private static Map<String, Multimap<String, String>> makeSmallMultimapRepo() { Map<String, Multimap<String, String>> repo = Maps.newTreeMap(); String key;// w w w .j a va2 s . com ImmutableMultimap<String, String> person; key = "cn=Robert Smith,ou=people,dc=example,dc=com"; person = ImmutableMultimap.of("dn", key, "cn", "Robert Smith", "foo", "bar"); repo.put(key, person); key = "cn=Joseph Blow,ou=people,dc=example,dc=com"; person = ImmutableMultimap.of("dn", key, "cn", "Joseph Blow", "argle", "bargle"); repo.put(key, person); key = "cn=Jane Doe,ou=people,dc=example,dc=com"; person = ImmutableMultimap.of("dn", key, "cn", "Jane Doe", "foo", "baz"); repo.put(key, person); return repo; }
From source file:org.obm.sync.client.login.LoginClient.java
@Override public boolean authenticateGlobalAdmin(String login, String password) throws AuthFault { ImmutableMultimap<String, String> params = ImmutableMultimap.of("login", login, "password", password, "origin", origin); AccessToken token = newAccessToken(login, domainConfiguration.getGlobalDomain(), origin); Document doc = execute(token, "/login/authenticateGlobalAdmin", params); exceptionFactory.checkLoginExpection(doc); return Boolean.valueOf(DOMUtils.getElementText(doc.getDocumentElement(), "value")); }