/** * Flush bytes or chars contained in the buffer. * * @throws IOException An underlying IOException occurred */ public void flush() throws IOException { if (response.getRequest().getUpgradeHandler() != null) { return; } doFlush(true); }
public void setWriteListener(WriteListener writeListener) { if (writeHandler != null) { throw new IllegalStateException(rb.getString(LogFacade.WRITE_LISTENER_BEEN_SET)); } Request req = (Request)response.getRequest(); if (!(req.isAsyncStarted() || req.isUpgrade())) { throw new IllegalStateException(rb.getString(LogFacade.NON_ASYNC_UPGRADE_WRITER_EXCEPTION)); } writeHandler = new WriteHandlerImpl(writeListener); if (isReady()) { try { writeHandler.onWritePossible(); } catch(Throwable t) { log.log(Level.WARNING, LogFacade.WRITE_LISTENER_ON_WRITE_POSSIBLE_ERROR, t); } } }
public void setWriteListener(WriteListener writeListener) { if (this.writeListener != null) { throw MESSAGES.writeListenerAlreadySet(); } if (writeListener == null) { throw MESSAGES.nullListener(); } if (!response.getRequest().isEventMode()) { throw MESSAGES.cannotSetListenerWithoutUpgradeOrAsync(); } this.writeListener = writeListener; coyoteResponse.action(ActionCode.ACTION_EVENT_WRITE_BEGIN, (response.getRequest().getUpgradeHandler() != null) ? writeListener : null); }
/* */ public void sendError(int status, String message) /* */ throws IOException /* */ { /* 1188 */ if (isCommitted()) { /* 1189 */ throw new IllegalStateException(sm.getString("coyoteResponse.sendError.ise")); /* */ } /* */ /* 1193 */ if (this.included) { /* 1194 */ return; /* */ } /* 1196 */ Wrapper wrapper = getRequest().getWrapper(); /* 1197 */ if (wrapper != null) { /* 1198 */ wrapper.incrementErrorCount(); /* */ } /* */ /* 1201 */ setError(); /* */ /* 1203 */ this.coyoteResponse.setStatus(status); /* 1204 */ this.coyoteResponse.setMessage(message); /* */ /* 1207 */ resetBuffer(); /* */ /* 1210 */ setSuspended(true); /* */ } /* */
/** * Send an error response with the specified status and message. * * @param status HTTP status code to send * @param message Corresponding message to send * * @exception IllegalStateException if this response has * already been committed * @exception IOException if an input/output error occurs */ public void sendError(int status, String message) throws IOException { if (isCommitted()) throw new IllegalStateException (sm.getString("coyoteResponse.sendError.ise")); // Ignore any call from an included servlet if (included) return; Wrapper wrapper = getRequest().getWrapper(); if (wrapper != null) { wrapper.incrementErrorCount(); } setError(); coyoteResponse.setStatus(status); coyoteResponse.setMessage(message); // Clear any data content that has been buffered resetBuffer(); // Cause the response to be finished (from the application perspective) setSuspended(true); }
Wrapper wrapper = getRequest().getWrapper(); if (wrapper != null) { wrapper.incrementErrorCount();
return; Wrapper wrapper = getRequest().getWrapper(); if (wrapper != null) { wrapper.incrementErrorCount();
/** * Send an error response with the specified status and message. * * @param status HTTP status code to send * @param message Corresponding message to send * * @exception IllegalStateException if this response has * already been committed * @exception IOException if an input/output error occurs */ public void sendError(int status, String message) throws IOException { if (isCommitted()) throw new IllegalStateException (sm.getString("coyoteResponse.sendError.ise")); // Ignore any call from an included servlet if (included) return; Wrapper wrapper = getRequest().getWrapper(); if (wrapper != null) { wrapper.incrementErrorCount(); } setError(); coyoteResponse.setStatus(status); coyoteResponse.setMessage(message); // Clear any data content that has been buffered resetBuffer(); // Cause the response to be finished (from the application perspective) setSuspended(true); }
return; Wrapper wrapper = getRequest().getWrapper(); if (wrapper != null) { wrapper.incrementErrorCount();
return; Wrapper wrapper = getRequest().getWrapper(); if (wrapper != null) { wrapper.incrementErrorCount();
Wrapper wrapper = getRequest().getWrapper(); if (wrapper != null) { wrapper.incrementErrorCount();
Wrapper wrapper = getRequest().getWrapper(); if (wrapper != null) { wrapper.incrementErrorCount();
private void writeBytes(byte b[], int off, int len) throws IOException { if (closed) return; if (response.getRequest().getUpgradeHandler() != null) { // If we really have something to write if (len > 0) { // real write to the adapter ByteChunk output = new ByteChunk(); output.setBytes(b, off, len); try { coyoteResponse.doWrite(output); } catch (IOException e) { // An IOException on a write is almost always due to // the remote client aborting the request. Wrap this // so that it can be handled better by the error dispatcher. throw new ClientAbortException(e); } } } else { bb.append(b, off, len); bytesWritten += len; // if called from within flush(), then immediately flush // remaining bytes if (doFlush) { bb.flushBuffer(); } } }
private void addSessionCookies() throws IOException { Request req = (Request) response.getRequest(); if (req.isRequestedSessionIdFromURL()) { return; } StandardContext ctx = (StandardContext) response.getContext(); if (ctx == null || !ctx.getCookies()) { // cookies disabled return; } Session sess = req.getSessionInternal(false); if (sess != null) { addSessionVersionCookie(req, ctx); addSessionCookieWithJvmRoute(req, ctx, sess); addSessionCookieWithJReplica(req, ctx, sess); addPersistedSessionCookie(req, ctx, sess); addJrouteCookie(req, ctx, sess); addSsoVersionCookie(req, ctx); } }
/** * Send an error response with the specified status and message. * * @param status HTTP status code to send * @param message Corresponding message to send * * @exception IllegalStateException if this response has * already been committed * @exception IOException if an input/output error occurs */ public void sendError(int status, String message) throws IOException { if (isCommitted()) throw MESSAGES.cannotSendError(); // Ignore any call from an included servlet if (included) return; Wrapper wrapper = getRequest().getWrapper(); if (wrapper != null) { wrapper.incrementErrorCount(); } setError(); coyoteResponse.setStatus(status); coyoteResponse.setMessage(message); // Clear any data content that has been buffered resetBuffer(); // Cause the response to be finished (from the application perspective) setSuspended(true); }
String locationUri; if (getRequest().getCoyoteRequest().getSupportsRelativeRedirects() && getContext().getUseRelativeRedirects()) { locationUri = location;
String locationUri; if (getRequest().getCoyoteRequest().getSupportsRelativeRedirects() && getContext().getUseRelativeRedirects()) { locationUri = location;
return; Request request = response.getRequest(); if (request.getUpgradeHandler() != null && request.isEventMode()) { request.getEvent().close();