Class SpdyHeaders

  • All Implemented Interfaces:
    java.lang.Iterable<java.util.Map.Entry<java.lang.String,​java.lang.String>>
    Direct Known Subclasses:
    DefaultSpdyHeaders

    public abstract class SpdyHeaders
    extends java.lang.Object
    implements java.lang.Iterable<java.util.Map.Entry<java.lang.String,​java.lang.String>>
    Provides the constants for the standard SPDY HTTP header names and commonly used utility methods that access a SpdyHeadersFrame.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  SpdyHeaders.HttpNames
      SPDY HTTP header names
    • Constructor Summary

      Constructors 
      Constructor Description
      SpdyHeaders()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract SpdyHeaders add​(java.lang.String name, java.lang.Iterable<?> values)
      Adds a new header with the specified name and values.
      abstract SpdyHeaders add​(java.lang.String name, java.lang.Object value)
      Adds a new header with the specified name and value.
      static void addHeader​(SpdyHeadersFrame frame, java.lang.String name, java.lang.Object value)
      Adds a new header with the specified name and value.
      abstract SpdyHeaders clear()
      Removes all headers from this frame.
      abstract boolean contains​(java.lang.String name)
      Returns true if and only if there is a header with the specified header name.
      abstract java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.String>> entries()
      Returns all header names and values that this frame contains.
      abstract java.lang.String get​(java.lang.String name)
      Returns the header value with the specified header name.
      abstract java.util.List<java.lang.String> getAll​(java.lang.String name)
      Returns the header values with the specified header name.
      static java.lang.String getHeader​(SpdyHeadersFrame frame, java.lang.String name)
      Returns the header value with the specified header name.
      static java.lang.String getHeader​(SpdyHeadersFrame frame, java.lang.String name, java.lang.String defaultValue)
      Returns the header value with the specified header name.
      static java.lang.String getHost​(SpdyHeadersFrame frame)
      Returns the SPDY host header.
      static HttpMethod getMethod​(int spdyVersion, SpdyHeadersFrame frame)
      Returns the HttpMethod represented by the HTTP method header.
      static java.lang.String getScheme​(int spdyVersion, SpdyHeadersFrame frame)
      Returns the value of the URL scheme header.
      static HttpResponseStatus getStatus​(int spdyVersion, SpdyHeadersFrame frame)
      Returns the HttpResponseStatus represented by the HTTP response status header.
      static java.lang.String getUrl​(int spdyVersion, SpdyHeadersFrame frame)
      Returns the value of the URL path header.
      static HttpVersion getVersion​(int spdyVersion, SpdyHeadersFrame frame)
      Returns the HttpVersion represented by the HTTP version header.
      abstract boolean isEmpty()
      Checks if no header exists.
      java.util.Iterator<java.util.Map.Entry<java.lang.String,​java.lang.String>> iterator()  
      abstract java.util.Set<java.lang.String> names()
      Returns the Set of all header names that this frame contains.
      abstract SpdyHeaders remove​(java.lang.String name)
      Removes the header with the specified name.
      static void removeHost​(SpdyHeadersFrame frame)
      Removes the SPDY host header.
      static void removeMethod​(int spdyVersion, SpdyHeadersFrame frame)
      Removes the HTTP method header.
      static void removeScheme​(int spdyVersion, SpdyHeadersFrame frame)
      Removes the URL scheme header.
      static void removeStatus​(int spdyVersion, SpdyHeadersFrame frame)
      Removes the HTTP response status header.
      static void removeUrl​(int spdyVersion, SpdyHeadersFrame frame)
      Removes the URL path header.
      static void removeVersion​(int spdyVersion, SpdyHeadersFrame frame)
      Removes the HTTP version header.
      abstract SpdyHeaders set​(java.lang.String name, java.lang.Iterable<?> values)
      Sets a new header with the specified name and values.
      abstract SpdyHeaders set​(java.lang.String name, java.lang.Object value)
      Sets a new header with the specified name and value.
      static void setHeader​(SpdyHeadersFrame frame, java.lang.String name, java.lang.Iterable<?> values)
      Sets a new header with the specified name and values.
      static void setHeader​(SpdyHeadersFrame frame, java.lang.String name, java.lang.Object value)
      Sets a new header with the specified name and value.
      static void setHost​(SpdyHeadersFrame frame, java.lang.String host)
      Set the SPDY host header.
      static void setMethod​(int spdyVersion, SpdyHeadersFrame frame, HttpMethod method)
      Sets the HTTP method header.
      static void setScheme​(int spdyVersion, SpdyHeadersFrame frame, java.lang.String scheme)
      Sets the URL scheme header.
      static void setStatus​(int spdyVersion, SpdyHeadersFrame frame, HttpResponseStatus status)
      Sets the HTTP response status header.
      static void setUrl​(int spdyVersion, SpdyHeadersFrame frame, java.lang.String path)
      Sets the URL path header.
      static void setVersion​(int spdyVersion, SpdyHeadersFrame frame, HttpVersion httpVersion)
      Sets the HTTP version header.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • EMPTY_HEADERS

        public static final SpdyHeaders EMPTY_HEADERS
    • Constructor Detail

      • SpdyHeaders

        public SpdyHeaders()
    • Method Detail

      • getHeader

        public static java.lang.String getHeader​(SpdyHeadersFrame frame,
                                                 java.lang.String name)
        Returns the header value with the specified header name. If there are more than one header value for the specified header name, the first value is returned.
        Returns:
        the header value or null if there is no such header
      • getHeader

        public static java.lang.String getHeader​(SpdyHeadersFrame frame,
                                                 java.lang.String name,
                                                 java.lang.String defaultValue)
        Returns the header value with the specified header name. If there are more than one header value for the specified header name, the first value is returned.
        Returns:
        the header value or the defaultValue if there is no such header
      • setHeader

        public static void setHeader​(SpdyHeadersFrame frame,
                                     java.lang.String name,
                                     java.lang.Object value)
        Sets a new header with the specified name and value. If there is an existing header with the same name, the existing header is removed.
      • setHeader

        public static void setHeader​(SpdyHeadersFrame frame,
                                     java.lang.String name,
                                     java.lang.Iterable<?> values)
        Sets a new header with the specified name and values. If there is an existing header with the same name, the existing header is removed.
      • addHeader

        public static void addHeader​(SpdyHeadersFrame frame,
                                     java.lang.String name,
                                     java.lang.Object value)
        Adds a new header with the specified name and value.
      • removeHost

        public static void removeHost​(SpdyHeadersFrame frame)
        Removes the SPDY host header.
      • getHost

        public static java.lang.String getHost​(SpdyHeadersFrame frame)
        Returns the SPDY host header.
      • setHost

        public static void setHost​(SpdyHeadersFrame frame,
                                   java.lang.String host)
        Set the SPDY host header.
      • removeMethod

        public static void removeMethod​(int spdyVersion,
                                        SpdyHeadersFrame frame)
        Removes the HTTP method header.
      • setMethod

        public static void setMethod​(int spdyVersion,
                                     SpdyHeadersFrame frame,
                                     HttpMethod method)
        Sets the HTTP method header.
      • removeScheme

        public static void removeScheme​(int spdyVersion,
                                        SpdyHeadersFrame frame)
        Removes the URL scheme header.
      • getScheme

        public static java.lang.String getScheme​(int spdyVersion,
                                                 SpdyHeadersFrame frame)
        Returns the value of the URL scheme header.
      • setScheme

        public static void setScheme​(int spdyVersion,
                                     SpdyHeadersFrame frame,
                                     java.lang.String scheme)
        Sets the URL scheme header.
      • removeStatus

        public static void removeStatus​(int spdyVersion,
                                        SpdyHeadersFrame frame)
        Removes the HTTP response status header.
      • removeUrl

        public static void removeUrl​(int spdyVersion,
                                     SpdyHeadersFrame frame)
        Removes the URL path header.
      • getUrl

        public static java.lang.String getUrl​(int spdyVersion,
                                              SpdyHeadersFrame frame)
        Returns the value of the URL path header.
      • setUrl

        public static void setUrl​(int spdyVersion,
                                  SpdyHeadersFrame frame,
                                  java.lang.String path)
        Sets the URL path header.
      • removeVersion

        public static void removeVersion​(int spdyVersion,
                                         SpdyHeadersFrame frame)
        Removes the HTTP version header.
      • setVersion

        public static void setVersion​(int spdyVersion,
                                      SpdyHeadersFrame frame,
                                      HttpVersion httpVersion)
        Sets the HTTP version header.
      • iterator

        public java.util.Iterator<java.util.Map.Entry<java.lang.String,​java.lang.String>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.util.Map.Entry<java.lang.String,​java.lang.String>>
      • get

        public abstract java.lang.String get​(java.lang.String name)
        Returns the header value with the specified header name. If there is more than one header value for the specified header name, the first value is returned.
        Returns:
        the header value or null if there is no such header
      • getAll

        public abstract java.util.List<java.lang.String> getAll​(java.lang.String name)
        Returns the header values with the specified header name.
        Returns:
        the List of header values. An empty list if there is no such header.
      • entries

        public abstract java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.String>> entries()
        Returns all header names and values that this frame contains.
        Returns:
        the List of the header name-value pairs. An empty list if there is no header in this message.
      • contains

        public abstract boolean contains​(java.lang.String name)
        Returns true if and only if there is a header with the specified header name.
      • names

        public abstract java.util.Set<java.lang.String> names()
        Returns the Set of all header names that this frame contains.
      • add

        public abstract SpdyHeaders add​(java.lang.String name,
                                        java.lang.Object value)
        Adds a new header with the specified name and value.
      • add

        public abstract SpdyHeaders add​(java.lang.String name,
                                        java.lang.Iterable<?> values)
        Adds a new header with the specified name and values. If there is an existing header with the same name, the existing header is removed.
      • set

        public abstract SpdyHeaders set​(java.lang.String name,
                                        java.lang.Object value)
        Sets a new header with the specified name and value. If there is an existing header with the same name, the existing header is removed.
      • set

        public abstract SpdyHeaders set​(java.lang.String name,
                                        java.lang.Iterable<?> values)
        Sets a new header with the specified name and values. If there is an existing header with the same name, the existing header is removed.
      • remove

        public abstract SpdyHeaders remove​(java.lang.String name)
        Removes the header with the specified name.
      • clear

        public abstract SpdyHeaders clear()
        Removes all headers from this frame.
      • isEmpty

        public abstract boolean isEmpty()
        Checks if no header exists.