Search in sources :

Example 6 with LinkedMultiValueMap

use of org.springframework.util.LinkedMultiValueMap in project spring-framework by spring-projects.

the class AsyncRestTemplateIntegrationTests method multipart.

@Test
public void multipart() throws Exception {
    MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
    parts.add("name 1", "value 1");
    parts.add("name 2", "value 2+1");
    parts.add("name 2", "value 2+2");
    Resource logo = new ClassPathResource("/org/springframework/http/converter/logo.jpg");
    parts.add("logo", logo);
    HttpEntity<MultiValueMap<String, Object>> requestBody = new HttpEntity<>(parts);
    Future<URI> future = template.postForLocation(baseUrl + "/multipart", requestBody);
    future.get();
}
Also used : HttpEntity(org.springframework.http.HttpEntity) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) ClassPathResource(org.springframework.core.io.ClassPathResource) Resource(org.springframework.core.io.Resource) URI(java.net.URI) ClassPathResource(org.springframework.core.io.ClassPathResource) MultiValueMap(org.springframework.util.MultiValueMap) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) Test(org.junit.Test)

Example 7 with LinkedMultiValueMap

use of org.springframework.util.LinkedMultiValueMap in project spring-framework by spring-projects.

the class RestTemplateIntegrationTests method multipart.

@Test
public void multipart() throws UnsupportedEncodingException {
    MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
    parts.add("name 1", "value 1");
    parts.add("name 2", "value 2+1");
    parts.add("name 2", "value 2+2");
    Resource logo = new ClassPathResource("/org/springframework/http/converter/logo.jpg");
    parts.add("logo", logo);
    template.postForLocation(baseUrl + "/multipart", parts);
}
Also used : LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) ClassPathResource(org.springframework.core.io.ClassPathResource) Resource(org.springframework.core.io.Resource) ClassPathResource(org.springframework.core.io.ClassPathResource) Test(org.junit.Test)

Example 8 with LinkedMultiValueMap

use of org.springframework.util.LinkedMultiValueMap in project spring-framework by spring-projects.

the class ReactorClientHttpResponse method getCookies.

@Override
public MultiValueMap<String, ResponseCookie> getCookies() {
    MultiValueMap<String, ResponseCookie> result = new LinkedMultiValueMap<>();
    this.response.cookies().values().stream().flatMap(Collection::stream).forEach(cookie -> {
        ResponseCookie responseCookie = ResponseCookie.from(cookie.name(), cookie.value()).domain(cookie.domain()).path(cookie.path()).maxAge(cookie.maxAge()).secure(cookie.isSecure()).httpOnly(cookie.isHttpOnly()).build();
        result.add(cookie.name(), responseCookie);
    });
    return CollectionUtils.unmodifiableMultiValueMap(result);
}
Also used : LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) ResponseCookie(org.springframework.http.ResponseCookie)

Example 9 with LinkedMultiValueMap

use of org.springframework.util.LinkedMultiValueMap in project spring-framework by spring-projects.

the class CandidateComponentsIndex method parseIndex.

private static MultiValueMap<String, String> parseIndex(List<Properties> content) {
    MultiValueMap<String, String> index = new LinkedMultiValueMap<>();
    for (Properties entry : content) {
        for (Map.Entry<Object, Object> entries : entry.entrySet()) {
            String type = (String) entries.getKey();
            String[] stereotypes = ((String) entries.getValue()).split(",");
            for (String stereotype : stereotypes) {
                index.add(stereotype, type);
            }
        }
    }
    return index;
}
Also used : LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) Properties(java.util.Properties) Map(java.util.Map) MultiValueMap(org.springframework.util.MultiValueMap) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap)

Example 10 with LinkedMultiValueMap

use of org.springframework.util.LinkedMultiValueMap in project spring-framework by spring-projects.

the class AnnotationMetadataReadingVisitor method getAllAnnotationAttributes.

@Override
public MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationName, boolean classValuesAsString) {
    MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<>();
    List<AnnotationAttributes> attributes = this.attributesMap.get(annotationName);
    if (attributes == null) {
        return null;
    }
    for (AnnotationAttributes raw : attributes) {
        for (Map.Entry<String, Object> entry : AnnotationReadingVisitorUtils.convertClassValues("class '" + getClassName() + "'", this.classLoader, raw, classValuesAsString).entrySet()) {
            allAttributes.add(entry.getKey(), entry.getValue());
        }
    }
    return allAttributes;
}
Also used : AnnotationAttributes(org.springframework.core.annotation.AnnotationAttributes) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) MultiValueMap(org.springframework.util.MultiValueMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap)

Aggregations

LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)413 Test (org.junit.Test)153 HttpHeaders (org.springframework.http.HttpHeaders)126 MultiValueMap (org.springframework.util.MultiValueMap)94 Test (org.junit.jupiter.api.Test)88 HttpEntity (org.springframework.http.HttpEntity)60 List (java.util.List)42 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)40 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)37 HashMap (java.util.HashMap)36 MediaType (org.springframework.http.MediaType)34 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)33 URI (java.net.URI)33 Map (java.util.Map)31 AbstractReadWriteDtoControllerRestTest (eu.bcvsolutions.idm.core.api.rest.AbstractReadWriteDtoControllerRestTest)30 ArrayList (java.util.ArrayList)27 UUID (java.util.UUID)27 lombok.val (lombok.val)27 IOException (java.io.IOException)26 Assert (org.junit.Assert)25