use of com.vaadin.flow.server.RequestHandler in project flow by vaadin.
the class PwaHandler method handleRequest.
@Override
public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException {
PwaRegistry pwaRegistry = pwaRegistryGetter.get();
boolean hasPwa = pwaRegistry != null && pwaRegistry.getPwaConfiguration().isEnabled();
RequestHandler handler = null;
session.lock();
try {
if (isInitialized && !hasPwa) {
requestHandlerMap.clear();
} else if (!isInitialized && hasPwa) {
init(pwaRegistry);
}
if (hasPwa) {
handler = requestHandlerMap.get(request.getPathInfo());
}
} finally {
session.unlock();
}
if (handler == null) {
return false;
} else {
return handler.handleRequest(session, request, response);
}
}
use of com.vaadin.flow.server.RequestHandler in project flow by vaadin.
the class SessionRequestHandler method handleRequest.
@Override
public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException {
// Use a copy to avoid ConcurrentModificationException
session.lock();
List<RequestHandler> requestHandlers;
try {
requestHandlers = new ArrayList<>(session.getRequestHandlers());
} finally {
session.unlock();
}
for (RequestHandler handler : requestHandlers) {
if (handler.handleRequest(session, request, response)) {
return true;
}
}
// If not handled
return false;
}
Aggregations