@Override @SuppressWarnings("MagicNumber") public void failure(final Throwable error) { try { if (!grizzlyResponse.isCommitted()) { try { if (configSetStatusOverSendError) { grizzlyResponse.reset(); grizzlyResponse.setStatus(500, "Request failed."); } else { grizzlyResponse.sendError(500, "Request failed."); } } catch (final IllegalStateException ex) { // a race condition externally committing the response can still occur... logger.log(Level.FINER, "Unable to reset failed response.", ex); } catch (final IOException ex) { throw new ContainerException( LocalizationMessages.EXCEPTION_SENDING_ERROR_RESPONSE(500, "Request failed."), ex); } } } finally { logger.debugLog("{0} - failure(...) called", name); rethrow(error); } }
/** * {@inheritDoc} */ @Override public boolean isCommitted() { if (response == null) { throw new IllegalStateException("Null response object"); } return response.isCommitted(); }
/** * {@inheritDoc} */ @Override public boolean isCommitted() { if (response == null) { throw new IllegalStateException("Null response object"); } return response.isCommitted(); }
/** * {@inheritDoc} */ @Override public boolean isCommitted() { if (response == null) { throw new IllegalStateException("Null response object"); } return response.isCommitted(); }
/** * Set the specified integer header to the specified value. * * @param name Name of the header to set * @param value Integer value to be set */ public void setIntHeader(String name, int value) { if (isCommitted()) return; setHeader(name, "" + value); }
/** * Add the specified integer header to the specified value. * * @param name Name of the header to set * @param value Integer value to be set */ public void addIntHeader(final String name, final int value) { if (isCommitted()) return; addHeader(name, "" + value); }
/** * Add the specified integer header to the specified value. * * @param name Name of the header to set * @param value Integer value to be set */ public void addIntHeader(final String name, final int value) { if (isCommitted()) return; addHeader(name, "" + value); }
/** * Set the specified integer header to the specified value. * * @param name Name of the header to set * @param value Integer value to be set */ public void setIntHeader(String name, int value) { if (isCommitted()) return; setHeader(name, "" + value); }
/** * Add the specified integer header to the specified value. * * @param name Name of the header to set * @param value Integer value to be set */ public void addIntHeader(final String name, final int value) { if (isCommitted()) return; addHeader(name, "" + value); }
/** * Set the specified header to the specified value. * * @param name Name of the header to set * @param value Value to be set */ public void setHeader(final String name, final String value) { checkResponse(); if (isCommitted()) return; response.setHeader(name, value); }
/** * Add the specified header to the specified value. * * @param name Name of the header to set * @param value Value to be set */ public void addHeader(final String name, final String value) { checkResponse(); if (isCommitted()) return; response.addHeader(name, value); }
public void setCharacterEncoding(String charset) { checkResponse(); if (isCommitted()) return; // Ignore any call made after the getWriter has been invoked // The default should be used if (usingWriter) return; response.setCharacterEncoding(charset); }
/** * Set the Locale that is appropriate for this response, including * setting the appropriate character encoding. * * @param locale The new locale */ public void setLocale(final Locale locale) { checkResponse(); if (isCommitted()) return; response.setLocale(locale); }
/** * Set the specified header to the specified value. * * @param name Name of the header to set * @param value Value to be set */ public void setHeader(final String name, final String value) { checkResponse(); if (isCommitted()) return; response.setHeader(name, value); }
/** * Add the specified header to the specified value. * * @param name Name of the header to set * @param value Value to be set */ public void addHeader(final String name, final String value) { checkResponse(); if (isCommitted()) return; response.addHeader(name, value); }
/** * Add the specified header to the specified value. * * @param name Name of the header to set * @param value Value to be set */ public void addHeader(final String name, final String value) { checkResponse(); if (isCommitted()) return; response.addHeader(name, value); }
public void setCharacterEncoding(String charset) { checkResponse(); if (isCommitted()) return; // Ignore any call made after the getWriter has been invoked // The default should be used if (usingWriter) return; response.setCharacterEncoding(charset); }
/** * Set the specified header to the specified value. * * @param name Name of the header to set * @param value Value to be set */ public void setHeader(final String name, final String value) { checkResponse(); if (isCommitted()) return; response.setHeader(name, value); }
/** * Set the HTTP status and message to be returned with this response. * @param status {@link HttpStatus} to set */ public void setStatus(HttpStatus status) { checkResponse(); if (isCommitted()) return; status.setValues(response); }
/** * Set the specified header to the specified value. * * @param name Name of the header to set * @param value Value to be set */ public void setHeader(final String name, final String value) { checkResponse(); if (isCommitted()) return; response.setHeader(name, value); }