ApplicationPushBuilder (Apache Tomcat 9.0.111 API Documentation)
Description: declaration: package: org.apache.catalina.core, class: ApplicationPushBuilder

# Class ApplicationPushBuilder

java.lang.Object
org.apache.catalina.core.ApplicationPushBuilder

All Implemented Interfaces:
  `PushBuilder`

public class ApplicationPushBuilder extends Object implements PushBuilder

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ApplicationPushBuilder(Request catalinaRequest, HttpServletRequest request)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PushBuilder`
  `addHeader(String name, String value)`
  Adds an HTTP header to the request.
  `String`
  `getHeader(String name)`
  Obtain a value for the given HTTP header.
  `Set<String>`
  `getHeaderNames()`
  `String`
  `getMethod()`
  Obtain the name of the HTTP method that will be used for push requests generated by future calls to `push()`.
  `String`
  `getPath()`
  Obtain the path that will be used for the push request that will be generated by the next call to `push()`.
  `String`
  `getQueryString()`
  Obtain the query string that will be used for push requests generated by future calls to `push()`.
  `String`
  `getSessionId()`
  Obtain the session ID that will be used for push requests generated by future calls to `push()`.
  `PushBuilder`
  `method(String method)`
  Specify the HTTP method to use for the push request.
  `PushBuilder`
  `path(String path)`
  Sets the URI path to be used for the push request.
  `void`
  `push()`
  Generates the push request and sends it to the client unless pushes are not available for some reason.
  `PushBuilder`
  `queryString(String queryString)`
  Specifies the query string to use in subsequent push requests generated by a call to `PushBuilder.push()`.
  `PushBuilder`
  `removeHeader(String name)`
  Removes an HTTP header from the request.
  `PushBuilder`
  `sessionId(String sessionId)`
  Specifies the session ID to use in subsequent push requests generated by a call to `PushBuilder.push()`.
  `PushBuilder`
  `setHeader(String name, String value)`
  Sets an HTTP header on the request.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ApplicationPushBuilder

    public ApplicationPushBuilder(Request catalinaRequest, HttpServletRequest request)

- ## Method Details

  - ### path

    public PushBuilder path(String path)
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Sets the URI path to be used for the push request. This must be called before every call to `PushBuilder.push()`. If the path includes a query string, the query string will be appended to the existing query string (if any) and no de-duplication will occur.
    Specified by:
      `path` in interface `PushBuilder`
    Parameters:
      `path` - Paths beginning with '/' are treated as absolute paths. All other paths are treated as relative to the context path of the request used to create this builder instance. The path may include a query string.
    Returns:
      This builder instance

  - ### getPath

    public String getPath()
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Obtain the path that will be used for the push request that will be generated by the next call to `push()`.
    Specified by:
      `getPath` in interface `PushBuilder`
    Returns:
      The path value that will be associated with the next push request

  - ### method

    public PushBuilder method(String method)
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Specify the HTTP method to use for the push request.
    Specified by:
      `method` in interface `PushBuilder`
    Parameters:
      `method` - The method to use for the push request
    Returns:
      This builder instance

  - ### getMethod

    public String getMethod()
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Obtain the name of the HTTP method that will be used for push requests generated by future calls to `push()`.
    Specified by:
      `getMethod` in interface `PushBuilder`
    Returns:
      The HTTP method to be used for future push requests

  - ### queryString

    public PushBuilder queryString(String queryString)
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Specifies the query string to use in subsequent push requests generated by a call to `PushBuilder.push()`. This will be appended to any query string specified in the call to `PushBuilder.path(String)`.
    Specified by:
      `queryString` in interface `PushBuilder`
    Parameters:
      `queryString` - The query string to use to generate push requests
    Returns:
      This builder instance

  - ### getQueryString

    public String getQueryString()
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Obtain the query string that will be used for push requests generated by future calls to `push()`.
    Specified by:
      `getQueryString` in interface `PushBuilder`
    Returns:
      The query string that will be appended to push requests.

  - ### sessionId

    public PushBuilder sessionId(String sessionId)
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Specifies the session ID to use in subsequent push requests generated by a call to `PushBuilder.push()`. The session ID will be presented the same way as it is on the original request (cookie or URL parameter). The default is determined in the following order:
    - the requested session ID for the originating request
    - the session ID generated in the originated request
    - `null`
    Specified by:
      `sessionId` in interface `PushBuilder`
    Parameters:
      `sessionId` - The session ID to use to generate push requests
    Returns:
      This builder instance

  - ### getSessionId

    public String getSessionId()
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Obtain the session ID that will be used for push requests generated by future calls to `push()`.
    Specified by:
      `getSessionId` in interface `PushBuilder`
    Returns:
      The session that will be used for push requests.

  - ### addHeader

    public PushBuilder addHeader(String name, String value)
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Adds an HTTP header to the request.
    Specified by:
      `addHeader` in interface `PushBuilder`
    Parameters:
      `name` - The name of the header to add
      `value` - The value of the header to add
    Returns:
      This builder instance

  - ### setHeader

    public PushBuilder setHeader(String name, String value)
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Sets an HTTP header on the request. Any existing headers of the same name are first remove.
    Specified by:
      `setHeader` in interface `PushBuilder`
    Parameters:
      `name` - The name of the header to set
      `value` - The value of the header to set
    Returns:
      This builder instance

  - ### removeHeader

    public PushBuilder removeHeader(String name)
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Removes an HTTP header from the request.
    Specified by:
      `removeHeader` in interface `PushBuilder`
    Parameters:
      `name` - The name of the header to remove
    Returns:
      This builder instance

  - ### getHeaderNames

    public Set<String> getHeaderNames()
    Specified by:
      `getHeaderNames` in interface `PushBuilder`
    Returns:
      The current set of names of HTTP headers to be used the next time `push()` is called.

  - ### getHeader

    public String getHeader(String name)
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Obtain a value for the given HTTP header. TODO Servlet 4.0 Clarify the behaviour of this method
    Specified by:
      `getHeader` in interface `PushBuilder`
    Parameters:
      `name` - The name of the header whose value is to be returned
    Returns:
      The value of the given header. If multiple values are defined then any may be returned

  - ### push

    public void push()
    Description copied from interface: `javax.servlet.http.PushBuilder`
    Generates the push request and sends it to the client unless pushes are not available for some reason. After calling this method the following fields are set to `null`:
    - `path`
    - conditional request headers (`if-none-match` and `if-modified-since`)
    Specified by:
      `push` in interface `PushBuilder`