/** * The numeric HTTP status code, e.g. 200, 404 and so on. * * @return the numeric HTTP status code */ public int getStatus() { return parentResponse.getStatus(); }
/** Returns the status code. Throws an exception if handleResponse is not called prior to calling this */ public int getStatus() { return response.getStatus(); }
private static void setStatus_holdingLock(Response jdiscResponse, HttpServletResponse servletResponse) { if (jdiscResponse instanceof HttpResponse) { setStatus(servletResponse, jdiscResponse.getStatus(), Optional.ofNullable(((HttpResponse) jdiscResponse).getMessage())); } else { setStatus(servletResponse, jdiscResponse.getStatus(), getErrorMessage(jdiscResponse)); } }
private void setResponse(Response jdiscResponse) { synchronized (monitor) { if (responseCommitted) { log.log(Level.FINE, jdiscResponse.getError(), () -> "Response already committed, can't change response code. " + "From: " + servletResponse.getStatus() + ", To: " + jdiscResponse.getStatus()); //TODO: should throw an exception here, but this breaks unit tests. //The failures will now instead happen when writing buffers. servletOutputStreamWriter.close(); return; } setStatus_holdingLock(jdiscResponse, servletResponse); setHeaders_holdingLock(jdiscResponse, servletResponse); } }
public Response getResponse() { try { closedLatch.await(); } catch (InterruptedException e) { throw new ApplicationException(e); } byte[] totalBuffer = concatenateBuffers(responseBuffers); Response response = new Response(discResponse.getStatus(), totalBuffer); copyResponseHeaders(response, discResponse); return response; }
@Override public ContentChannel handleResponse(Response response) { Reply reply; if (response instanceof MbusResponse) { reply = ((MbusResponse)response).getReply(); } else { reply = new EmptyReply(); reply.swapState(msg); } Error err = StatusCodes.toMbusError(response.getStatus()); if (err != null) { if (err.isFatal()) { if (!reply.hasFatalErrors()) { reply.addError(err); } } else { if (!reply.hasErrors()) { reply.addError(err); } } } if (reply.getTrace().shouldTrace(6)) { reply.getTrace().trace(6, "Sending reply from MbusServer."); } session.sendReply(reply); return null; } }