@Override public boolean handleSessionExpired(VaadinRequest request, VaadinResponse response) throws IOException { if (!ServletHelper.isRequestType(request, RequestType.HEARTBEAT)) { return false; } response.sendError(HttpServletResponse.SC_GONE, "Session expired"); return true; } }
@Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { if (!ServletHelper.isRequestType(request, RequestType.PUSH)) { return false; } if (request instanceof VaadinServletRequest) { if (atmosphere == null) { response.sendError(500, "Atmosphere initialization failed. No push available."); return true; } try { atmosphere.doCometSupport( AtmosphereRequestImpl .wrap((VaadinServletRequest) request), AtmosphereResponseImpl .wrap((VaadinServletResponse) response)); } catch (ServletException e) { // TODO PUSH decide how to handle throw new RuntimeException(e); } } else { throw new IllegalArgumentException( "Only VaadinServletRequests are supported"); } return true; }
.flatMap(session.getResourceRegistry()::getResource); if (!abstractStreamResource.isPresent()) { response.sendError(HttpServletResponse.SC_NOT_FOUND, "Resource is not found for path=" + pathInfo); return true;
/** * Handles a heartbeat request for the given session. Reads the GET * parameter named {@link ApplicationConstants#UI_ID_PARAMETER} to identify * the UI. If the UI is found in the session, sets it * {@link UIInternals#getLastHeartbeatTimestamp() heartbeat timestamp} to * the current time. Otherwise, writes a HTTP Not Found error to the * response. */ @Override public boolean synchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { UI ui = session.getService().findUI(request); if (ui != null) { ui.getInternals() .setLastHeartbeatTimestamp(System.currentTimeMillis()); // Ensure that the browser does not cache heartbeat responses. // iOS 6 Safari requires this (#10370) response.setHeader("Cache-Control", "no-cache"); // If Content-Type is not set, browsers assume text/html and may // complain about the empty response body (#12182) response.setHeader("Content-Type", "text/plain"); } else { response.sendError(HttpServletResponse.SC_NOT_FOUND, "UI not found"); } return true; }
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Request was not handled by any registered handler.");
response.sendError(HttpServletResponse.SC_GONE, "Session expired");