public void resume(){ completionHandler.resumed(attachment); try{ response.sendHeaders(); response.flush(); response.finish(); } catch (IOException ex){ LoggerUtils.getLogger().log(Level.FINEST,"resume",ex); } }
public void resume() { invokeCompletionHandler(); try { response.sendHeaders(); response.flush(); response.finish(); } catch (IOException ex) { if (LoggerUtils.getLogger().isLoggable(Level.FINE)) { LoggerUtils.getLogger().log(Level.FINEST, "resume", ex); } } }
public void timeout(boolean forceClose){ // If the buffers are empty, commit the response header try{ completionHandler.cancelled(attachment); } finally { if (forceClose &&!response.isCommitted()){ try{ response.sendHeaders(); response.flush(); response.finish(); } catch (IOException ex){ // Swallow? } } } }
private static void handleUnsupportedVersion(final Response response) throws IOException { response.setStatus(400); response.setMessage("Bad Request"); response.addHeader(WebSocketEngine.SEC_WS_VERSION, Version.getSupportedWireProtocolVersions()); response.sendHeaders(); response.flush(); }
/** * Method will be called to notify about async HTTP processing timeout * @return <tt>true</tt>, if async processing has been finished, or <tt>false</tt> * if we should re-register the channel to continue async HTTP request processing */ public boolean timeout() { // If the buffers are empty, commit the response header try { cancel(); } finally { if (!response.isCommitted()) { try { response.sendHeaders(); response.flush(); response.finish(); } catch (IOException ex) { // Swallow? } } } return true; }
(outputBuffer instanceof FileOutputBuffer) && ((FileOutputBuffer) outputBuffer).isSupportFileSend()) { res.flush();
/** * Send the cached resource. */ protected void sendCache(Request request, FileCacheEntry entry) throws IOException{ boolean flushBody = checkIfHeaders(request, entry); request.getResponse().setContentType(entry.contentType); request.getResponse().setContentLength(Integer.valueOf(entry.contentLength)); if (flushBody) { ByteBuffer sliced = entry.bb.slice(); ByteBuffer ob = ((SocketChannelOutputBuffer)request.getResponse() .getOutputBuffer()).getOutputByteBuffer(); int left = ob.remaining(); // It's better to execute a byte copy than two network operation. if (left > sliced.limit()){ request.getResponse().action(ActionCode.ACTION_COMMIT, null); ob.put(sliced); ((SocketChannelOutputBuffer)request.getResponse() .getOutputBuffer()).flushBuffer(); } else { request.getResponse().flush(); OutputWriter.flushChannel(request.getResponse().getChannel(),sliced); } } else { request.getResponse().flush(); } }
(outputBuffer instanceof FileOutputBuffer) && ((FileOutputBuffer) outputBuffer).isSupportFileSend()) { res.flush();
public void respond(WebSocketApplication application, Response response) { response.setStatus(101); response.setMessage("Web Socket Protocol Handshake"); response.setHeader("Upgrade", "websocket"); response.setHeader("Connection", "Upgrade"); setHeaders(response); if (!getSubProtocol().isEmpty()) { response.setHeader(WebSocketEngine.SEC_WS_PROTOCOL_HEADER, join(application.getSupportedProtocols(getSubProtocol()))); } try { response.sendHeaders(); response.flush(); } catch (IOException e) { throw new HandshakeException(e.getMessage(), e); } }