Class PushBuilderImpl

java.lang.Object
org.eclipse.jetty.server.PushBuilderImpl
All Implemented Interfaces:
PushBuilder

public class PushBuilderImpl extends Object implements PushBuilder
  • Field Details

    • LOG

      private static final Logger LOG
    • JettyPush

      private static final HttpField JettyPush
    • _request

      private final Request _request
    • _fields

      private final HttpFields _fields
    • _method

      private String _method
    • _queryString

      private String _queryString
    • _sessionId

      private String _sessionId
    • _conditional

      private boolean _conditional
    • _path

      private String _path
    • _etag

      private String _etag
    • _lastModified

      private String _lastModified
  • Constructor Details

  • Method Details

    • getMethod

      public String getMethod()
      Specified by:
      getMethod in interface PushBuilder
    • method

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

      Set the method to be used for the push.

      Any non-empty String may be used for the method.

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

      public String getQueryString()
      Specified by:
      getQueryString in interface PushBuilder
    • queryString

      public PushBuilder queryString(String queryString)
      Description copied from interface: PushBuilder
      Set the query string to be used for the push. 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.
    • getSessionId

      public String getSessionId()
      Specified by:
      getSessionId in interface PushBuilder
    • 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.
    • isConditional

      public boolean isConditional()
      Specified by:
      isConditional in interface PushBuilder
    • conditional

      public PushBuilder conditional(boolean conditional)
      Description copied from interface: PushBuilder
      Set if the request is to be conditional. If the request is conditional, any available values from PushBuilder.etag(String) or PushBuilder.lastModified(String) will be set in the appropriate headers. If the request is not conditional, then etag and lastModified values are ignored. Defaults to true if the associated request was conditional.
      Specified by:
      conditional in interface PushBuilder
      Parameters:
      conditional - true if the push request is conditional
      Returns:
      this builder.
    • getHeaderNames

      public Set<String> getHeaderNames()
      Specified by:
      getHeaderNames in interface PushBuilder
    • getHeader

      public String getHeader(String name)
      Specified by:
      getHeader in interface PushBuilder
    • setHeader

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

      Set a 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 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 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.
    • getPath

      public String getPath()
      Specified by:
      getPath in interface PushBuilder
    • 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 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.
    • getEtag

      public String getEtag()
      Specified by:
      getEtag in interface PushBuilder
    • etag

      public PushBuilder etag(String etag)
      Description copied from interface: PushBuilder
      Set the etag to be used for conditional pushes. The etag will be used only if PushBuilder.isConditional() is true. Defaults to no etag. The value is nulled after every call to PushBuilder.push()
      Specified by:
      etag in interface PushBuilder
      Parameters:
      etag - the etag to be used for the push.
      Returns:
      this builder.
    • getLastModified

      public String getLastModified()
      Specified by:
      getLastModified in interface PushBuilder
    • lastModified

      public PushBuilder lastModified(String lastModified)
      Description copied from interface: PushBuilder
      Set the last modified date to be used for conditional pushes. The last modified date will be used only if PushBuilder.isConditional() is true. Defaults to no date. The value is nulled after every call to PushBuilder.push()
      Specified by:
      lastModified in interface PushBuilder
      Parameters:
      lastModified - the last modified date to be used for the push.
      Returns:
      this builder.
    • push

      public void push()
      Description copied from interface: PushBuilder
      Push a resource given the current state of the builder, returning immediately without blocking.

      Push a resource based on the current state of the PushBuilder. If PushBuilder.isConditional() is true and an etag or lastModified value is provided, then an appropriate conditional header will be generated. If both an etag and lastModified value are provided only an If-None-Match header will be generated. 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, etag and lastModified fields nulled. All other fields are left as is for possible reuse in another push.

      Specified by:
      push in interface PushBuilder