Modifier and Type | Method and Description |
---|---|
static Response |
blockingCall(Handler handler,
Context context,
Request request)
Executes a blocking call with the given
handler , context and request , returning
the Response when fully available. |
static Response |
newInternalServerError()
Generates an empty Internal Server Error response (500).
|
static Response |
newInternalServerError(Exception exception)
Generates an Internal Server Error response (500) whose content is set to the given
exception 's message. |
static Response |
newInternalServerError(String message)
Generates an Internal Server Error response (500) whose content is set to the given
message . |
static Response |
newInternalServerError(String message,
Exception exception)
Generates an Internal Server Error response (500) whose content is set to a concatenation
of the given
message and exception 's message. |
static Response |
newNotFound()
Generates an empty Not Found response (404).
|
static Response |
newNotFound(String message)
Generates a Not Found response (404) whose content is set to the given
message . |
public static Response newInternalServerError()
public static Response newInternalServerError(Exception exception)
exception
's message.exception
- wrapped exceptionpublic static Response newInternalServerError(String message, Exception exception)
message
and exception
's message.message
- first part of the response's contentexception
- wrapped exceptionpublic static Response newInternalServerError(String message)
message
.message
- response's contentpublic static Response newNotFound()
public static Response newNotFound(String message)
message
.message
- response's contentpublic static Response blockingCall(Handler handler, Context context, Request request) throws InterruptedException
handler
, context
and request
, returning
the Response
when fully available.
This function is here to fix a concurrency issue where a caller thread is blocking a promise and is
resumed before all of the ResultHandlers and Function of the blocked promise have been invoked.
That may lead to concurrent consumption of BranchingInputStream
that is a
not thread safe object.
handler
- Handler for handling the given requestcontext
- Context to be used for the invocationrequest
- request to be executedResponse
InterruptedException
- if either Promise.getOrThrow()
or
CountDownLatch.await()
is interrupted.Copyright 2011-2015 ForgeRock AS.