Class PushBuilderImpl

java.lang.Object
io.undertow.servlet.spec.PushBuilderImpl
All Implemented Interfaces:
PushBuilder

public class PushBuilderImpl extends Object implements PushBuilder
Author:
Stuart Douglas, Richard Opalka
  • Constructor Details

  • Method Details

    • method

      public PushBuilder method(String method)
      Description copied from interface: PushBuilder

      Set the method to be used for the push.

      Specified by:
      method in interface PushBuilder
      Parameters:
      method - the method to be used for the push.
      Returns:
      this builder.
    • queryString

      public PushBuilder queryString(String queryString)
      Description copied from interface: PushBuilder
      Set the query string to be used for the push. The query string will be appended to any query String included in a call to PushBuilder.path(String). Any duplicate parameters must be preserved. This method should be used instead of a query in PushBuilder.path(String) when multiple PushBuilder.push() calls are to be made with the same query string.
      Specified by:
      queryString in interface PushBuilder
      Parameters:
      queryString - the query string to be used for the push.
      Returns:
      this builder.
    • sessionId

      public PushBuilder sessionId(String sessionId)
      Description copied from interface: PushBuilder
      Set the SessionID to be used for the push. The session ID will be set in the same way it was on the associated request (ie as a cookie if the associated request used a cookie, or as a url parameter if the associated request used a url parameter). Defaults to the requested session ID or any newly assigned session id from a newly created session.
      Specified by:
      sessionId in interface PushBuilder
      Parameters:
      sessionId - the SessionID to be used for the push.
      Returns:
      this builder.
    • setHeader

      public PushBuilder setHeader(String name, String value)
      Description copied from interface: PushBuilder

      Set a request header to be used for the push. If the builder has an existing header with the same name, its value is overwritten.

      Specified by:
      setHeader in interface PushBuilder
      Parameters:
      name - The header name to set
      value - The header value to set
      Returns:
      this builder.
    • addHeader

      public PushBuilder addHeader(String name, String value)
      Description copied from interface: PushBuilder

      Add a request header to be used for the push.

      Specified by:
      addHeader in interface PushBuilder
      Parameters:
      name - The header name to add
      value - The header value to add
      Returns:
      this builder.
    • removeHeader

      public PushBuilder removeHeader(String name)
      Description copied from interface: PushBuilder

      Remove the named request header. If the header does not exist, take no action.

      Specified by:
      removeHeader in interface PushBuilder
      Parameters:
      name - The name of the header to remove
      Returns:
      this builder.
    • path

      public PushBuilder path(String path)
      Description copied from interface: PushBuilder
      Set the URI path to be used for the push. The path may start with "/" in which case it is treated as an absolute path, otherwise it is relative to the context path of the associated request. There is no path default and PushBuilder.path(String) must be called before every call to PushBuilder.push(). If a query string is present in the argument path, its contents must be merged with the contents previously passed to PushBuilder.queryString(java.lang.String), preserving duplicates.
      Specified by:
      path in interface PushBuilder
      Parameters:
      path - the URI path to be used for the push, which may include a query string.
      Returns:
      this builder.
    • push

      public void push()
      Description copied from interface: PushBuilder
      Push a resource given the current state of the builder, the method must be non-blocking.

      Push a resource based on the current state of the PushBuilder. Calling this method does not guarantee the resource will actually be pushed, since it is possible the client can decline acceptance of the pushed resource using the underlying HTTP/2 protocol.

      If the builder has a session ID, then the pushed request will include the session ID either as a Cookie or as a URI parameter as appropriate. The builders query string is merged with any passed query string.

      Before returning from this method, the builder has its path, conditional headers (defined in RFC 7232) nulled. All other fields are left as is for possible reuse in another push.

      Specified by:
      push in interface PushBuilder
    • getMethod

      public String getMethod()
      Description copied from interface: PushBuilder
      Return the method to be used for the push.
      Specified by:
      getMethod in interface PushBuilder
      Returns:
      the method to be used for the push.
    • getQueryString

      public String getQueryString()
      Description copied from interface: PushBuilder
      Return the query string to be used for the push.
      Specified by:
      getQueryString in interface PushBuilder
      Returns:
      the query string to be used for the push.
    • getSessionId

      public String getSessionId()
      Description copied from interface: PushBuilder
      Return the SessionID to be used for the push.
      Specified by:
      getSessionId in interface PushBuilder
      Returns:
      the SessionID to be used for the push.
    • getHeaderNames

      public Set<String> getHeaderNames()
      Description copied from interface: PushBuilder
      Return the set of header to be used for the push.

      The returned set is not backed by the PushBuilder object, so changes in the returned set are not reflected in the PushBuilder object, and vice-versa.

      Specified by:
      getHeaderNames in interface PushBuilder
      Returns:
      the set of header to be used for the push.
    • getHeader

      public String getHeader(String name)
      Description copied from interface: PushBuilder
      Return the header of the given name to be used for the push.
      Specified by:
      getHeader in interface PushBuilder
      Parameters:
      name - the name of the header
      Returns:
      the header of the given name to be used for the push.
    • getPath

      public String getPath()
      Description copied from interface: PushBuilder
      Return the URI path to be used for the push.
      Specified by:
      getPath in interface PushBuilder
      Returns:
      the URI path to be used for the push.