Refine search
if (responseContext.hasEntity() && contentLength != -1 && contentLength < Integer.MAX_VALUE) { response.setContentLength((int) contentLength); final MultivaluedMap<String, String> headers = getResponseContext().getStringHeaders(); for (final Map.Entry<String, List<String>> e : headers.entrySet()) { final Iterator<String> it = e.getValue().iterator(); final String reasonPhrase = responseContext.getStatusInfo().getReasonPhrase(); if (reasonPhrase != null) { response.setStatus(responseContext.getStatus(), reasonPhrase); throw new ContainerException(e);
final boolean hasEntity = responseContext.hasEntity(); final Response.StatusType status = responseContext.getStatusInfo(); if (!hasEntity && status != null && status.getStatusCode() >= 400 && !(useSetStatusOn404 && status == Response.Status.NOT_FOUND)) { throw new ContainerException( LocalizationMessages.EXCEPTION_SENDING_ERROR_RESPONSE(status, reason != null ? reason : "--"), ex);
/** * Rethrow the original exception as required by JAX-RS, 3.3.4. * * @param error throwable to be re-thrown */ private void rethrow(final Throwable error) { if (error instanceof RuntimeException) { throw (RuntimeException) error; } else { throw new ContainerException(error); } }
@Override public OutputStream writeResponseStatusAndHeaders(final long contentLength, final ContainerResponse context) throws ContainerException { final javax.ws.rs.core.Response.StatusType statusInfo = context.getStatusInfo(); final int code = statusInfo.getStatusCode(); final String reason = statusInfo.getReasonPhrase() == null ? HttpStatus.getMessage(code) : statusInfo.getReasonPhrase(); response.setStatusWithReason(code, reason); if (contentLength != -1 && contentLength < Integer.MAX_VALUE) { response.setContentLength((int) contentLength); } for (final Map.Entry<String, List<String>> e : context.getStringHeaders().entrySet()) { for (final String value : e.getValue()) { response.addHeader(e.getKey(), value); } } try { return response.getOutputStream(); } catch (final IOException ioe) { throw new ContainerException("Error during writing out the response headers.", ioe); } }
@Override public OutputStream writeResponseStatusAndHeaders(final long contentLength, final ContainerResponse context) throws ContainerException { final MultivaluedMap<String, String> responseHeaders = context.getStringHeaders(); final Headers serverHeaders = exchange.getResponseHeaders(); for (final Map.Entry<String, List<String>> e : responseHeaders.entrySet()) { for (final String value : e.getValue()) { serverHeaders.add(e.getKey(), value); } } try { if (context.getStatus() == Response.Status.NO_CONTENT.getStatusCode()) { // Work around bug in LW HTTP server // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6886436 exchange.sendResponseHeaders(context.getStatus(), -1); } else { exchange.sendResponseHeaders(context.getStatus(), getResponseLength(contentLength)); } } catch (final IOException ioe) { throw new ContainerException(LocalizationMessages.ERROR_RESPONSEWRITER_WRITING_HEADERS(), ioe); } return exchange.getResponseBody(); }
@Override public Response toResponse(ContainerException exception) { if (TenacityExceptionMapper.isTenacityException(exception.getCause())) { return Response.status(statusCode).build(); } else { return Response.serverError().build(); } }
final boolean hasEntity = responseContext.hasEntity(); final Response.StatusType status = responseContext.getStatusInfo(); if (!hasEntity && status != null && status.getStatusCode() >= 400 && !(useSetStatusOn404 && status == Response.Status.NOT_FOUND)) { throw new ContainerException( LocalizationMessages.EXCEPTION_SENDING_ERROR_RESPONSE(status, reason != null ? reason : "--"), ex);
/** * Rethrow the original exception as required by JAX-RS, 3.3.4 * * @param error throwable to be re-thrown */ private void rethrow(final Throwable error) { if (error instanceof RuntimeException) { throw (RuntimeException) error; } else { throw new ContainerException(error); } }
@Override public OutputStream writeResponseStatusAndHeaders(final long contentLength, final ContainerResponse context) throws ContainerException { final javax.ws.rs.core.Response.StatusType statusInfo = context.getStatusInfo(); final int code = statusInfo.getStatusCode(); final String reason = statusInfo.getReasonPhrase() == null ? Status.getDescription(code) : statusInfo.getReasonPhrase(); response.setCode(code); response.setDescription(reason); if (contentLength != -1) { response.setContentLength(contentLength); } for (final Map.Entry<String, List<String>> e : context.getStringHeaders().entrySet()) { for (final String value : e.getValue()) { response.addValue(e.getKey(), value); } } try { return response.getOutputStream(); } catch (final IOException ioe) { throw new ContainerException("Error during writing out the response headers.", ioe); } }
@Override public OutputStream writeResponseStatusAndHeaders(final long contentLength, final ContainerResponse context) throws ContainerException { final MultivaluedMap<String, String> responseHeaders = context.getStringHeaders(); final Headers serverHeaders = exchange.getResponseHeaders(); for (final Map.Entry<String, List<String>> e : responseHeaders.entrySet()) { for (final String value : e.getValue()) { serverHeaders.add(e.getKey(), value); } } try { if (context.getStatus() == Response.Status.NO_CONTENT.getStatusCode()) { // Work around bug in LW HTTP server // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6886436 exchange.sendResponseHeaders(context.getStatus(), -1); } else { exchange.sendResponseHeaders(context.getStatus(), getResponseLength(contentLength)); } } catch (final IOException ioe) { throw new ContainerException(LocalizationMessages.ERROR_RESPONSEWRITER_WRITING_HEADERS(), ioe); } return exchange.getResponseBody(); }
@Override public Response toResponse(ContainerException exception) { if (TenacityExceptionMapper.isTenacityException(exception.getCause())) { return Response.status(statusCode).build(); } else { return Response.serverError().build(); } }
if (responseContext.hasEntity() && contentLength != -1 && contentLength < Integer.MAX_VALUE) { response.setContentLength((int) contentLength); final MultivaluedMap<String, String> headers = getResponseContext().getStringHeaders(); for (final Map.Entry<String, List<String>> e : headers.entrySet()) { final Iterator<String> it = e.getValue().iterator(); final String reasonPhrase = responseContext.getStatusInfo().getReasonPhrase(); if (reasonPhrase != null) { response.setStatus(responseContext.getStatus(), reasonPhrase); throw new ContainerException(e);
throw new ContainerException(LocalizationMessages.SERVLET_PATH_MISMATCH(servletPath, filterContextPath)); if (responseWriter.responseContextResolved()) { final ContainerResponse responseContext = responseWriter.getResponseContext(); hasEntity = responseContext.hasEntity(); status = responseContext.getStatusInfo();
/** * Rethrow the original exception as required by JAX-RS, 3.3.4 * * @param error throwable to be re-thrown */ private void rethrow(final Throwable error) { if (error instanceof RuntimeException) { throw (RuntimeException) error; } else { throw new ContainerException(error); } }
@Override public OutputStream writeResponseStatusAndHeaders(final long contentLength, final ContainerResponse context) throws ContainerException { final javax.ws.rs.core.Response.StatusType statusInfo = context.getStatusInfo(); final int code = statusInfo.getStatusCode(); final String reason = statusInfo.getReasonPhrase() == null ? Status.getDescription(code) : statusInfo.getReasonPhrase(); response.setCode(code); response.setDescription(reason); if (contentLength != -1) { response.setContentLength(contentLength); } for (final Map.Entry<String, List<String>> e : context.getStringHeaders().entrySet()) { for (final String value : e.getValue()) { response.addValue(e.getKey(), value); } } try { return response.getOutputStream(); } catch (final IOException ioe) { throw new ContainerException("Error during writing out the response headers.", ioe); } }
if (responseContext.hasEntity() && contentLength != -1 && contentLength < Integer.MAX_VALUE) { response.setContentLength((int) contentLength); final MultivaluedMap<String, String> headers = getResponseContext().getStringHeaders(); for (final Map.Entry<String, List<String>> e : headers.entrySet()) { final Iterator<String> it = e.getValue().iterator(); final String reasonPhrase = responseContext.getStatusInfo().getReasonPhrase(); if (reasonPhrase != null) { response.setStatus(responseContext.getStatus(), reasonPhrase); throw new ContainerException(e);
throw new ContainerException(LocalizationMessages.SERVLET_PATH_MISMATCH(servletPath, filterContextPath)); if (responseWriter.responseContextResolved()) { final ContainerResponse responseContext = responseWriter.getResponseContext(); hasEntity = responseContext.hasEntity(); status = responseContext.getStatusInfo();
/** * Rethrow the original exception as required by JAX-RS, 3.3.4 * * @param error throwable to be re-thrown */ private void rethrow(final Throwable error) { if (error instanceof RuntimeException) { throw (RuntimeException) error; } else { throw new ContainerException(error); } }
if (responseContext.hasEntity() && contentLength != -1 && contentLength < Integer.MAX_VALUE) { response.setContentLength((int) contentLength); final MultivaluedMap<String, String> headers = getResponseContext().getStringHeaders(); for (final Map.Entry<String, List<String>> e : headers.entrySet()) { final Iterator<String> it = e.getValue().iterator(); final String reasonPhrase = responseContext.getStatusInfo().getReasonPhrase(); if (reasonPhrase != null) { response.setStatus(responseContext.getStatus(), reasonPhrase); throw new ContainerException(e);
final boolean hasEntity = responseContext.hasEntity(); final Response.StatusType status = responseContext.getStatusInfo(); if (!hasEntity && status != null && status.getStatusCode() >= 400 && !(useSetStatusOn404 && status == Response.Status.NOT_FOUND)) { throw new ContainerException( LocalizationMessages.EXCEPTION_SENDING_ERROR_RESPONSE(status, reason != null ? reason : "--"), ex);