public abstract class SynchronizedRequestHandler extends Object implements RequestHandler
synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse)
is called and unlocked after it has completed.| Modifier and Type | Class and Description |
|---|---|
static interface |
SynchronizedRequestHandler.ResponseWriter
ResponseWriter is optionally returned by request handlers which implement
synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse, String)
The ResponseWriter will be executed by
handleRequest(VaadinSession, VaadinRequest, VaadinResponse)
without holding Vaadin session lock. |
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_BUFFER_SIZE |
| Constructor and Description |
|---|
SynchronizedRequestHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canHandleRequest(VaadinRequest request)
Check whether a request may be handled by this handler.
|
static String |
getRequestBody(Reader reader) |
boolean |
handleRequest(VaadinSession session,
VaadinRequest request,
VaadinResponse response)
Called when a request needs to be handled.
|
boolean |
isReadAndWriteOutsideSessionLock()
Gets if request body should be read and the response written without
holding
VaadinSession lock |
abstract boolean |
synchronizedHandleRequest(VaadinSession session,
VaadinRequest request,
VaadinResponse response)
Identical to
handleRequest(VaadinSession, VaadinRequest, VaadinResponse)
except the VaadinSession is locked before this is called and
unlocked after this has completed. |
Optional<SynchronizedRequestHandler.ResponseWriter> |
synchronizedHandleRequest(VaadinSession session,
VaadinRequest request,
VaadinResponse response,
String requestBody)
Identical to
synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse)
except the VaadinSession is locked before this is called and the
response requestBody has been read before locking the session and is
provided as a separate parameter. |
public static final int MAX_BUFFER_SIZE
public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException
RequestHandlertrue to indicate that no more request
handlers should be invoked for the request.
Note that request handlers by default do not lock the session. If you are
using VaadinSession or anything inside the VaadinSession you must ensure
the session is locked. This can be done by extending
SynchronizedRequestHandler or by using
VaadinSession.accessSynchronously(Command) or
UI.accessSynchronously(Command).
handleRequest in interface RequestHandlersession - The session for the requestrequest - The request to handleresponse - The response object to which a response can be written.IOException - If an IO error occurredpublic abstract boolean synchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException
handleRequest(VaadinSession, VaadinRequest, VaadinResponse)
except the VaadinSession is locked before this is called and
unlocked after this has completed.session - The session for the requestrequest - The request to handleresponse - The response object to which a response can be written.IOException - If an IO error occurredhandleRequest(VaadinSession, VaadinRequest, VaadinResponse)public boolean isReadAndWriteOutsideSessionLock()
VaadinSession locksynchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse, String)
should be called. Returns false if
synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse)
should be called.public Optional<SynchronizedRequestHandler.ResponseWriter> synchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response, String requestBody) throws IOException, UnsupportedOperationException
synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse)
except the VaadinSession is locked before this is called and the
response requestBody has been read before locking the session and is
provided as a separate parameter.session - The session for the requestrequest - The request to handleresponse - The response object to which a response can be written.requestBody - Request body pre-read from the request objectIOException - If an IO error occurredUnsupportedOperationExceptionhandleRequest(VaadinSession, VaadinRequest, VaadinResponse)protected boolean canHandleRequest(VaadinRequest request)
true which means that all requests will be handled by
calling
synchronizedHandleRequest(VaadinSession, VaadinRequest, VaadinResponse)
with the session locked.request - the request to handletrue if the request handling should continue once
the session has been locked; false if there's no
need to lock the session since the request would still not be
handled.public static String getRequestBody(Reader reader) throws IOException
IOExceptionCopyright © 2025. All rights reserved.