@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 @Deprecated public void setStatus(int sc, String sm) { setStatusWithReason(sc,sm); }
@Override @Deprecated public void setStatus(int sc, String sm) { setStatusWithReason(sc,sm); }
@Override @Deprecated public void setStatus(int sc, String sm) { setStatusWithReason(sc,sm); }
@Override @Deprecated public void setStatus(int sc, String sm) { setStatusWithReason(sc,sm); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { String msg = (String)request.getAttribute(RequestDispatcher.ERROR_MESSAGE); if (StringUtils.isEmpty(msg) || msg.contains("org.apache.cxf.interceptor.Fault")) { msg = HttpStatus.getMessage(response.getStatus()); request.setAttribute(RequestDispatcher.ERROR_MESSAGE, msg); } if (response instanceof Response) { ((Response)response).setStatusWithReason(response.getStatus(), msg); } super.handle(target, baseRequest, request, response); }
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { String msg = (String)request.getAttribute(RequestDispatcher.ERROR_MESSAGE); if (StringUtils.isEmpty(msg) || msg.contains("org.apache.cxf.interceptor.Fault")) { msg = HttpStatus.getMessage(response.getStatus()); request.setAttribute(RequestDispatcher.ERROR_MESSAGE, msg); } if (response instanceof Response) { ((Response)response).setStatusWithReason(response.getStatus(), msg); } super.handle(target, baseRequest, request, response); }
_request.setAttribute(RequestDispatcher.ERROR_REQUEST_URI,_request.getRequestURI()); _response.setStatusWithReason(500,reason);
_request.setAttribute(RequestDispatcher.ERROR_REQUEST_URI, _request.getRequestURI()); _response.setStatusWithReason(HttpStatus.INTERNAL_SERVER_ERROR_500, reason);