Package play.mvc

Class Http.Headers

  • Enclosing class:
    Http

    public static class Http.Headers
    extends Object
    • Method Detail

      • asMap

        public Map<String,​List<String>> asMap()
        Returns:
        all the headers as an unmodifiable map.
      • contains

        public boolean contains​(String headerName)
        Checks if the given header is present.
        Parameters:
        headerName - The name of the header (case-insensitive)
        Returns:
        true if the request did contain the header.
      • get

        public Optional<String> get​(String name)
        Gets the header value. If more than one value is associated with this header, then returns the first one.
        Parameters:
        name - the header name
        Returns:
        the first header value or empty if no value available.
      • getAll

        public List<String> getAll​(String name)
        Get all the values associated with the header name.
        Parameters:
        name - the header name.
        Returns:
        the list of values associates with the header of empty.
      • asScala

        public play.api.mvc.Headers asScala()
        Returns:
        the scala version of this headers.
      • addHeader

        @Deprecated
        public Http.Headers addHeader​(String name,
                                      String value)
        Deprecated.
        Deprecated as of 2.8.0. Use adding(String, String) instead.
        Add a new header with the given value.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        this with the new header added
      • adding

        public Http.Headers adding​(String name,
                                   String value)
        Add a new header with the given value.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        a new Header instance with the new header added
      • addHeader

        @Deprecated
        public Http.Headers addHeader​(String name,
                                      List<String> values)
        Deprecated.
        Deprecated as of 2.8.0. Use adding(String, List) instead.
        Add a new header with the given values.
        Parameters:
        name - the header name
        values - the header values
        Returns:
        this with the new header added
      • adding

        public Http.Headers adding​(String name,
                                   List<String> values)
        Add a new header with the given values.
        Parameters:
        name - the header name
        values - the header values
        Returns:
        a new Header instance with the new header added
      • remove

        @Deprecated
        public Http.Headers remove​(String name)
        Deprecated.
        Deprecated as of 2.8.0. Use removing(String) instead.
        Remove a header.
        Parameters:
        name - the header name.
        Returns:
        this without the removed header.
      • removing

        public Http.Headers removing​(String name)
        Remove a header.
        Parameters:
        name - the header name.
        Returns:
        a new Header instance without the removed header.