public class Blocking extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Blocking.UserBlockingSpec |
Modifier and Type | Method and Description |
---|---|
static Blocking.UserBlockingSpec |
forUser(String userId)
Starts a user-blocking action.
|
static void |
setBlockingService(BlockingService service)
Controls the implementation for blocking.
|
static boolean |
tryCommitBlockingResponse(int statusCode,
BlockingContentType contentType)
Equivalent to calling
#tryCommitBlockingResponse(int, BlockingContentType, Map with the last parameter being an empty map. |
static boolean |
tryCommitBlockingResponse(int statusCode,
BlockingContentType contentType,
Map<String,String> extraHeaders)
Tries to commit an HTTP response with the specified status code and content type.
|
public static Blocking.UserBlockingSpec forUser(String userId)
userId
- a non-null unique identifier for the currently identified userpublic static boolean tryCommitBlockingResponse(int statusCode, BlockingContentType contentType, Map<String,String> extraHeaders)
This method returns false
if blocking cannot be attempted because of the
following conditions:
This method does not return false if a blocking response has already been committed, or if there is an error when trying to write the response. This is because the writing may happen asynchronously, after the caller has returned.
statusCode
- the status code of the responsecontentType
- the content-type of the response.extraHeaders
- map of headers to set in the responsepublic static boolean tryCommitBlockingResponse(int statusCode, BlockingContentType contentType)
#tryCommitBlockingResponse(int, BlockingContentType, Map)
with the last parameter being an empty map.statusCode
- the status code of the responsecontentType
- the content-type of the response.public static void setBlockingService(BlockingService service)
service
- the implementation for blocking.