@Override public boolean hasEntity() { return messageContext.hasEntity(); }
@Override public boolean hasEntity() { return messageContext.hasEntity(); }
@Override public boolean hasEntity() { if (closed) { throw new IllegalStateException(LocalizationMessages.RESPONSE_CLOSED()); } return context.hasEntity(); }
@Override public boolean hasEntity() { if (closed) { throw new IllegalStateException(LocalizationMessages.RESPONSE_CLOSED()); } return context.hasEntity(); }
@Override public String toString() { return "OutboundJaxrsResponse{" + "status=" + status.getStatusCode() + ", reason=" + status.getReasonPhrase() + ", hasEntity=" + context.hasEntity() + ", closed=" + closed + ", buffered=" + buffered + "}"; }
@Override public String toString() { return "OutboundJaxrsResponse{" + "status=" + status.getStatusCode() + ", reason=" + status.getReasonPhrase() + ", hasEntity=" + context.hasEntity() + ", closed=" + closed + ", buffered=" + buffered + "}"; }
/** * Closes the context. Flushes and closes the entity stream. */ public void close() { if (hasEntity()) { try { final OutputStream es = getEntityStream(); es.flush(); es.close(); } catch (IOException e) { // Happens when the client closed connection before receiving the full response. // This is OK and not interesting in vast majority of the cases // hence the log level set to FINE to make sure it does not flood the log unnecessarily // (especially for clients disconnecting from SSE listening, which is very common). Logger.getLogger(OutboundMessageContext.class.getName()).log(Level.FINE, e.getMessage(), e); } finally { // In case some of the output stream wrapper does not delegate close() call we // close the root stream manually to make sure it commits the data. if (!committingOutputStream.isClosed()) { try { committingOutputStream.close(); } catch (IOException e) { // Just log the exception Logger.getLogger(OutboundMessageContext.class.getName()).log(Level.FINE, e.getMessage(), e); } } } } } }
/** * Closes the context. Flushes and closes the entity stream. */ public void close() { if (hasEntity()) { try { final OutputStream es = getEntityStream(); es.flush(); es.close(); } catch (IOException e) { // Happens when the client closed connection before receiving the full response. // This is OK and not interesting in vast majority of the cases // hence the log level set to FINE to make sure it does not flood the log unnecessarily // (especially for clients disconnecting from SSE listening, which is very common). Logger.getLogger(OutboundMessageContext.class.getName()).log(Level.FINE, e.getMessage(), e); } finally { // In case some of the output stream wrapper does not delegate close() call we // close the root stream manually to make sure it commits the data. if (!committingOutputStream.isClosed()) { try { committingOutputStream.close(); } catch (IOException e) { // Just log the exception Logger.getLogger(OutboundMessageContext.class.getName()).log(Level.FINE, e.getMessage(), e); } } } } } }
@Override public javax.ws.rs.core.Response build() { StatusType st = status; if (st == null) { st = context.hasEntity() ? Status.OK : Status.NO_CONTENT; } return new OutboundJaxrsResponse(st, new OutboundMessageContext(context)); }
@Override public javax.ws.rs.core.Response build() { StatusType st = status; if (st == null) { st = context.hasEntity() ? Status.OK : Status.NO_CONTENT; } return new OutboundJaxrsResponse(st, new OutboundMessageContext(context)); }
@Override public void close() throws ProcessingException { closed = true; context.close(); if (buffered) { // release buffer context.setEntity(null); } else if (context.hasEntity() && InputStream.class.isAssignableFrom(context.getEntityClass())) { try { InputStream.class.cast(context.getEntity()).close(); } catch (IOException ex) { throw new ProcessingException(ex); } } }
@Override public void close() throws ProcessingException { closed = true; context.close(); if (buffered) { // release buffer context.setEntity(null); } else if (context.hasEntity() && InputStream.class.isAssignableFrom(context.getEntityClass())) { try { InputStream.class.cast(context.getEntity()).close(); } catch (IOException ex) { throw new ProcessingException(ex); } } }
if (!context.hasEntity() || !InputStream.class.isAssignableFrom(context.getEntityClass())) { return false;
if (!context.hasEntity() || !InputStream.class.isAssignableFrom(context.getEntityClass())) { return false;
@Override public boolean hasEntity() { return messageContext.hasEntity(); }
@Override public boolean hasEntity() { if (closed) { throw new IllegalStateException(LocalizationMessages.RESPONSE_CLOSED()); } return context.hasEntity(); }
@Override public String toString() { return "OutboundJaxrsResponse{" + "status=" + status.getStatusCode() + ", reason=" + status.getReasonPhrase() + ", hasEntity=" + context.hasEntity() + ", closed=" + closed + ", buffered=" + buffered + "}"; }
@Override public String toString() { return "OutboundJaxrsResponse{" + "status=" + status.getStatusCode() + ", reason=" + status.getReasonPhrase() + ", hasEntity=" + context.hasEntity() + ", closed=" + closed + ", buffered=" + buffered + "}"; }
@Override public javax.ws.rs.core.Response build() { StatusType st = status; if (st == null) { st = context.hasEntity() ? Status.OK : Status.NO_CONTENT; } return new OutboundJaxrsResponse(st, new OutboundMessageContext(context)); }
@Override public javax.ws.rs.core.Response build() { StatusType st = status; if (st == null) { st = context.hasEntity() ? Status.OK : Status.NO_CONTENT; } return new OutboundJaxrsResponse(st, new OutboundMessageContext(context)); }