final boolean buffered = entityContent.isBuffered(); if (buffered) { entityContent.reset(); entityContent.ensureNotClosed(); headers, propertiesDelegate, entityContent.getWrappedStream(), entityContent.hasContent() ? getReaderInterceptors() : Collections.<ReaderInterceptor>emptyList(), translateNce);
/** * Buffer the entity stream (if not empty). * * @return {@code true} if the entity input stream was successfully buffered. * @throws javax.ws.rs.ProcessingException in case of an IO error. */ public boolean bufferEntity() throws ProcessingException { entityContent.ensureNotClosed(); try { if (entityContent.isBuffered() || !entityContent.hasContent()) { return true; } final InputStream entityStream = entityContent.getWrappedStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ReaderWriter.writeTo(entityStream, baos); } finally { // Workaround for JRFCAF-1344: the underlying stream close() implementation may be thread-unsafe // and as such the close() may result in an IOException at the socket input stream level, // if the close() gets called at once from multiple threads somehow. // We want to ignore these exceptions in the readEntity/bufferEntity operations though. ReaderWriter.safelyClose(entityStream); } entityContent.setContent(new ByteArrayInputStream(baos.toByteArray()), true); return true; } catch (IOException ex) { throw new ProcessingException(LocalizationMessages.MESSAGE_CONTENT_BUFFERING_FAILED(), ex); } }
final boolean buffered = entityContent.isBuffered(); if (buffered) { entityContent.reset(); entityContent.ensureNotClosed(); headers, propertiesDelegate, entityContent.getWrappedStream(), entityContent.hasContent() ? getReaderInterceptors() : Collections.<ReaderInterceptor>emptyList(), translateNce);
final boolean buffered = entityContent.isBuffered(); if (buffered) { entityContent.reset(); entityContent.ensureNotClosed(); headers, propertiesDelegate, entityContent.getWrappedStream(), entityContent.hasContent() ? getReaderInterceptors() : Collections.<ReaderInterceptor>emptyList(), translateNce);
final boolean buffered = entityContent.isBuffered(); if (buffered) { entityContent.reset(); entityContent.ensureNotClosed(); headers, propertiesDelegate, entityContent.getWrappedStream(), entityContent.hasContent() ? getReaderInterceptors() : Collections.<ReaderInterceptor>emptyList(), translateNce);
final boolean buffered = entityContent.isBuffered(); if (buffered) { entityContent.reset(); entityContent.ensureNotClosed(); headers, propertiesDelegate, entityContent.getWrappedStream(), entityContent.hasContent() ? getReaderInterceptors() : Collections.<ReaderInterceptor>emptyList(), translateNce);
final boolean buffered = entityContent.isBuffered(); if (buffered) { entityContent.reset(); entityContent.ensureNotClosed(); headers, propertiesDelegate, entityContent.getWrappedStream(), entityContent.hasContent() ? getReaderInterceptors() : Collections.<ReaderInterceptor>emptyList(), translateNce);
/** * Buffer the entity stream (if not empty). * * @return {@code true} if the entity input stream was successfully buffered. * @throws javax.ws.rs.ProcessingException in case of an IO error. */ public boolean bufferEntity() throws ProcessingException { entityContent.ensureNotClosed(); try { if (entityContent.isBuffered() || !entityContent.hasContent()) { return true; } final InputStream entityStream = entityContent.getWrappedStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ReaderWriter.writeTo(entityStream, baos); } finally { // Workaround for JRFCAF-1344: the underlying stream close() implementation may be thread-unsafe // and as such the close() may result in an IOException at the socket input stream level, // if the close() gets called at once from multiple threads somehow. // We want to ignore these exceptions in the readEntity/bufferEntity operations though. ReaderWriter.safelyClose(entityStream); } entityContent.setContent(new ByteArrayInputStream(baos.toByteArray()), true); return true; } catch (IOException ex) { throw new ProcessingException(LocalizationMessages.MESSAGE_CONTENT_BUFFERING_FAILED(), ex); } }
/** * Buffer the entity stream (if not empty). * * @return {@code true} if the entity input stream was successfully buffered. * @throws javax.ws.rs.ProcessingException in case of an IO error. */ public boolean bufferEntity() throws ProcessingException { entityContent.ensureNotClosed(); try { if (entityContent.isBuffered() || !entityContent.hasContent()) { return true; } final InputStream entityStream = entityContent.getWrappedStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ReaderWriter.writeTo(entityStream, baos); } finally { // Workaround for JRFCAF-1344: the underlying stream close() implementation may be thread-unsafe // and as such the close() may result in an IOException at the socket input stream level, // if the close() gets called at once from multiple threads somehow. // We want to ignore these exceptions in the readEntity/bufferEntity operations though. ReaderWriter.safelyClose(entityStream); } entityContent.setContent(new ByteArrayInputStream(baos.toByteArray()), true); return true; } catch (IOException ex) { throw new ProcessingException(LocalizationMessages.MESSAGE_CONTENT_BUFFERING_FAILED(), ex); } }
/** * Buffer the entity stream (if not empty). * * @return {@code true} if the entity input stream was successfully buffered. * @throws javax.ws.rs.ProcessingException in case of an IO error. */ public boolean bufferEntity() throws ProcessingException { entityContent.ensureNotClosed(); try { if (entityContent.isBuffered() || !entityContent.hasContent()) { return true; } final InputStream entityStream = entityContent.getWrappedStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ReaderWriter.writeTo(entityStream, baos); } finally { // Workaround for JRFCAF-1344: the underlying stream close() implementation may be thread-unsafe // and as such the close() may result in an IOException at the socket input stream level, // if the close() gets called at once from multiple threads somehow. // We want to ignore these exceptions in the readEntity/bufferEntity operations though. ReaderWriter.safelyClose(entityStream); } entityContent.setContent(new ByteArrayInputStream(baos.toByteArray()), true); return true; } catch (IOException ex) { throw new ProcessingException(LocalizationMessages.MESSAGE_CONTENT_BUFFERING_FAILED(), ex); } }
/** * Buffer the entity stream (if not empty). * * @return {@code true} if the entity input stream was successfully buffered. * @throws javax.ws.rs.ProcessingException in case of an IO error. */ public boolean bufferEntity() throws ProcessingException { entityContent.ensureNotClosed(); try { if (entityContent.isBuffered() || !entityContent.hasContent()) { return true; } final InputStream entityStream = entityContent.getWrappedStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ReaderWriter.writeTo(entityStream, baos); } finally { // Workaround for JRFCAF-1344: the underlying stream close() implementation may be thread-unsafe // and as such the close() may result in an IOException at the socket input stream level, // if the close() gets called at once from multiple threads somehow. // We want to ignore these exceptions in the readEntity/bufferEntity operations though. ReaderWriter.safelyClose(entityStream); } entityContent.setContent(new ByteArrayInputStream(baos.toByteArray()), true); return true; } catch (IOException ex) { throw new ProcessingException(LocalizationMessages.MESSAGE_CONTENT_BUFFERING_FAILED(), ex); } }
/** * Buffer the entity stream (if not empty). * * @return {@code true} if the entity input stream was successfully buffered. * @throws javax.ws.rs.ProcessingException in case of an IO error. */ public boolean bufferEntity() throws ProcessingException { entityContent.ensureNotClosed(); try { if (entityContent.isBuffered() || !entityContent.hasContent()) { return true; } final InputStream entityStream = entityContent.getWrappedStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ReaderWriter.writeTo(entityStream, baos); } finally { // Workaround for JRFCAF-1344: the underlying stream close() implementation may be thread-unsafe // and as such the close() may result in an IOException at the socket input stream level, // if the close() gets called at once from multiple threads somehow. // We want to ignore these exceptions in the readEntity/bufferEntity operations though. ReaderWriter.safelyClose(entityStream); } entityContent.setContent(new ByteArrayInputStream(baos.toByteArray()), true); return true; } catch (IOException ex) { throw new ProcessingException(LocalizationMessages.MESSAGE_CONTENT_BUFFERING_FAILED(), ex); } }
/** * Check if there is a non-empty entity input stream is available in the * message. * <p/> * The method returns {@code true} if the entity is present, returns * {@code false} otherwise. * * @return {@code true} if there is an entity present in the message, * {@code false} otherwise. */ public boolean hasEntity() { entityContent.ensureNotClosed(); try { return !entityContent.isEmpty(); } catch (IllegalStateException ex) { // input stream has been closed. return false; } }
/** * Check if there is a non-empty entity input stream is available in the * message. * <p/> * The method returns {@code true} if the entity is present, returns * {@code false} otherwise. * * @return {@code true} if there is an entity present in the message, * {@code false} otherwise. */ public boolean hasEntity() { entityContent.ensureNotClosed(); try { return !entityContent.isEmpty(); } catch (IllegalStateException ex) { // input stream has been closed. return false; } }
/** * Check if there is a non-empty entity input stream is available in the * message. * <p/> * The method returns {@code true} if the entity is present, returns * {@code false} otherwise. * * @return {@code true} if there is an entity present in the message, * {@code false} otherwise. */ public boolean hasEntity() { entityContent.ensureNotClosed(); try { return !entityContent.isEmpty(); } catch (IllegalStateException ex) { // input stream has been closed. return false; } }
/** * Check if there is a non-empty entity input stream is available in the * message. * <p/> * The method returns {@code true} if the entity is present, returns * {@code false} otherwise. * * @return {@code true} if there is an entity present in the message, * {@code false} otherwise. */ public boolean hasEntity() { entityContent.ensureNotClosed(); try { return !entityContent.isEmpty(); } catch (IllegalStateException ex) { // input stream has been closed. return false; } }
/** * Check if there is a non-empty entity input stream is available in the * message. * <p/> * The method returns {@code true} if the entity is present, returns * {@code false} otherwise. * * @return {@code true} if there is an entity present in the message, * {@code false} otherwise. */ public boolean hasEntity() { entityContent.ensureNotClosed(); try { return !entityContent.isEmpty(); } catch (IllegalStateException ex) { // input stream has been closed. return false; } }
boolean hasContent() { return getWrappedStream() != EMPTY; }
boolean hasContent() { return getWrappedStream() != EMPTY; }
boolean hasContent() { return getWrappedStream() != EMPTY; }