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

org.springframework.util.WebUtil Maven / Gradle / Ivy

package org.springframework.util;

import java.net.HttpCookie;
import java.util.Collection;
import java.util.LinkedHashSet;

/**
 * @see org.springframework.http.MediaType#includes(org.springframework.http.MediaType)
 */
public final class WebUtil {
  /**
   * 
    private static Collection parseCookie(Collection cookies) {
      return cookies.stream().map(x -> HttpCookie.parse(x).stream().filter((httpCookie) -> {
        return StringUtils.hasText(httpCookie.getValue());
      }).map(HttpCookie::toString).collect(Collectors.toSet())).flatMap(Set::stream).collect(Collectors.toSet());
    }
   * 
*/ public static Collection parseCookie(Collection cookies) { Collection result = new LinkedHashSet(); for (String cookie : cookies) { result.addAll(parseCookie(cookie)); } return result; } private static Collection parseCookie(String header) { Collection result = new LinkedHashSet(); for (HttpCookie cookie : HttpCookie.parse(header)) { result.add(cookie.toString()); } return result; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy