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 Summary
Constructors Constructor Description PushBuilderImpl(HttpServletRequestImpl servletRequest)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PushBuilderaddHeader(String name, String value)Add a request header to be used for the push.StringgetHeader(String name)Return the header of the given name to be used for the push.Set<String>getHeaderNames()Return the set of header to be used for the push.StringgetMethod()Return the method to be used for the push.StringgetPath()Return the URI path to be used for the push.StringgetQueryString()Return the query string to be used for the push.StringgetSessionId()Return the SessionID to be used for the push.PushBuildermethod(String method)Set the method to be used for the push.PushBuilderpath(String path)Set the URI path to be used for the push.voidpush()Push a resource given the current state of the builder, the method must be non-blocking.PushBuilderqueryString(String queryString)Set the query string to be used for the push.PushBuilderremoveHeader(String name)Remove the named request header.PushBuildersessionId(String sessionId)Set the SessionID to be used for the push.PushBuildersetHeader(String name, String value)Set a request header to be used for the push.
-
-
-
Constructor Detail
-
PushBuilderImpl
public PushBuilderImpl(HttpServletRequestImpl servletRequest)
-
-
Method Detail
-
method
public PushBuilder method(String method)
Description copied from interface:PushBuilderSet the method to be used for the push.
- Specified by:
methodin interfacePushBuilder- Parameters:
method- the method to be used for the push.- Returns:
- this builder.
-
queryString
public PushBuilder queryString(String queryString)
Description copied from interface:PushBuilderSet the query string to be used for the push. The query string will be appended to any query String included in a call toPushBuilder.path(String). Any duplicate parameters must be preserved. This method should be used instead of a query inPushBuilder.path(String)when multiplePushBuilder.push()calls are to be made with the same query string.- Specified by:
queryStringin interfacePushBuilder- Parameters:
queryString- the query string to be used for the push.- Returns:
- this builder.
-
sessionId
public PushBuilder sessionId(String sessionId)
Description copied from interface:PushBuilderSet 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:
sessionIdin interfacePushBuilder- 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:PushBuilderSet 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:
setHeaderin interfacePushBuilder- Parameters:
name- The header name to setvalue- The header value to set- Returns:
- this builder.
-
addHeader
public PushBuilder addHeader(String name, String value)
Description copied from interface:PushBuilderAdd a request header to be used for the push.
- Specified by:
addHeaderin interfacePushBuilder- Parameters:
name- The header name to addvalue- The header value to add- Returns:
- this builder.
-
removeHeader
public PushBuilder removeHeader(String name)
Description copied from interface:PushBuilderRemove the named request header. If the header does not exist, take no action.
- Specified by:
removeHeaderin interfacePushBuilder- Parameters:
name- The name of the header to remove- Returns:
- this builder.
-
path
public PushBuilder path(String path)
Description copied from interface:PushBuilderSet 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 andPushBuilder.path(String)must be called before every call toPushBuilder.push(). If a query string is present in the argumentpath, its contents must be merged with the contents previously passed toPushBuilder.queryString(java.lang.String), preserving duplicates.- Specified by:
pathin interfacePushBuilder- 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:PushBuilderPush 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:
pushin interfacePushBuilder
-
getMethod
public String getMethod()
Description copied from interface:PushBuilderReturn the method to be used for the push.- Specified by:
getMethodin interfacePushBuilder- Returns:
- the method to be used for the push.
-
getQueryString
public String getQueryString()
Description copied from interface:PushBuilderReturn the query string to be used for the push.- Specified by:
getQueryStringin interfacePushBuilder- Returns:
- the query string to be used for the push.
-
getSessionId
public String getSessionId()
Description copied from interface:PushBuilderReturn the SessionID to be used for the push.- Specified by:
getSessionIdin interfacePushBuilder- Returns:
- the SessionID to be used for the push.
-
getHeaderNames
public Set<String> getHeaderNames()
Description copied from interface:PushBuilderReturn the set of header to be used for the push.The returned set is not backed by the
PushBuilderobject, so changes in the returned set are not reflected in thePushBuilderobject, and vice-versa.- Specified by:
getHeaderNamesin interfacePushBuilder- Returns:
- the set of header to be used for the push.
-
getHeader
public String getHeader(String name)
Description copied from interface:PushBuilderReturn the header of the given name to be used for the push.- Specified by:
getHeaderin interfacePushBuilder- 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:PushBuilderReturn the URI path to be used for the push.- Specified by:
getPathin interfacePushBuilder- Returns:
- the URI path to be used for the push.
-
-