public class ApplicationPushBuilder extends Object implements PushBuilder
Constructor and Description |
---|
ApplicationPushBuilder(HttpServletRequest request) |
Modifier and Type | Method and Description |
---|---|
PushBuilder |
addHeader(String name,
String value)
Adds a HTTP header to the request.
|
PushBuilder |
conditional(boolean conditional)
Sets if the request will be conditional.
|
PushBuilder |
etag(String etag)
Sets the etag to be used for conditional push requests.
|
String |
getEtag()
Obtain the etag that will be used for the push request that will be
generated by the next call to
push() . |
String |
getHeader(String name)
Obtain a value for the given HTTP header.
|
Set<String> |
getHeaderNames() |
String |
getLastModified()
Obtain the last modified that will be used for the push request that will
be generated by the next call to
push() . |
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() . |
boolean |
isConditional()
Will push requests generated by future calls to
push() be
conditional. |
PushBuilder |
lastModified(String lastModified)
Sets the last modified to be used for conditional push requests.
|
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.
|
boolean |
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 a HTTP header on the request.
|
public ApplicationPushBuilder(HttpServletRequest request)
public PushBuilder path(String path)
javax.servlet.http.PushBuilder
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.path
in interface PushBuilder
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.public String getPath()
javax.servlet.http.PushBuilder
push()
.getPath
in interface PushBuilder
public PushBuilder method(String method)
javax.servlet.http.PushBuilder
method
in interface PushBuilder
method
- The method to use for the push requestpublic String getMethod()
javax.servlet.http.PushBuilder
push()
.getMethod
in interface PushBuilder
public PushBuilder etag(String etag)
javax.servlet.http.PushBuilder
null
after a call to PushBuilder.push()
so it must be
explicitly set for every push request that requires it.etag
in interface PushBuilder
etag
- The etag use for the push requestpublic String getEtag()
javax.servlet.http.PushBuilder
push()
.getEtag
in interface PushBuilder
public PushBuilder lastModified(String lastModified)
javax.servlet.http.PushBuilder
null
after a call to PushBuilder.push()
so it must be
explicitly set for every push request that requires it.lastModified
in interface PushBuilder
lastModified
- The last modified value to use for the push requestpublic String getLastModified()
javax.servlet.http.PushBuilder
push()
.getLastModified
in interface PushBuilder
public PushBuilder queryString(String queryString)
javax.servlet.http.PushBuilder
PushBuilder.push()
. This will be appended to any query string
specified in the call to PushBuilder.path(String)
.queryString
in interface PushBuilder
queryString
- The query string to use to generate push requestspublic String getQueryString()
javax.servlet.http.PushBuilder
push()
.getQueryString
in interface PushBuilder
public PushBuilder sessionId(String sessionId)
javax.servlet.http.PushBuilder
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:
null
sessionId
in interface PushBuilder
sessionId
- The session ID to use to generate push requestspublic String getSessionId()
javax.servlet.http.PushBuilder
push()
.getSessionId
in interface PushBuilder
public PushBuilder conditional(boolean conditional)
javax.servlet.http.PushBuilder
true
the values from
PushBuilder.getEtag()
and PushBuilder.getLastModified()
will be used to
construct appropriate headers.conditional
in interface PushBuilder
conditional
- Should generated push requests be conditionalpublic boolean isConditional()
javax.servlet.http.PushBuilder
push()
be
conditional.isConditional
in interface PushBuilder
true
if push requests will be conditionalpublic PushBuilder addHeader(String name, String value)
javax.servlet.http.PushBuilder
addHeader
in interface PushBuilder
name
- The name of the header to addvalue
- The value of the header to addpublic PushBuilder setHeader(String name, String value)
javax.servlet.http.PushBuilder
setHeader
in interface PushBuilder
name
- The name of the header to setvalue
- The value of the header to setpublic PushBuilder removeHeader(String name)
javax.servlet.http.PushBuilder
removeHeader
in interface PushBuilder
name
- The name of the header to removepublic Set<String> getHeaderNames()
getHeaderNames
in interface PushBuilder
push()
is called.public String getHeader(String name)
javax.servlet.http.PushBuilder
getHeader
in interface PushBuilder
name
- The name of the header whose value is to be returnedpublic boolean push()
javax.servlet.http.PushBuilder
null
:
path
etag
lastModified
push
in interface PushBuilder
true
if the push request was sent to the client,
otherwise false
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.