Пример #1
0
 @Override
 public FullHttpResponse duplicate() {
   DefaultFullHttpResponse duplicate =
       new DefaultFullHttpResponse(protocolVersion(), status(), content().duplicate());
   duplicate.headers().set(headers());
   duplicate.trailingHeaders().set(trailingHeaders());
   return duplicate;
 }
Пример #2
0
 /**
  * Copy this object
  *
  * @param copyContent
  *     <ul>
  *       <li>{@code true} if this object's {@link #content()} should be used to copy.
  *       <li>{@code false} if {@code newContent} should be used instead.
  *     </ul>
  *
  * @param newContent
  *     <ul>
  *       <li>if {@code copyContent} is false then this will be used in the copy's content.
  *       <li>if {@code null} then a default buffer of 0 size will be selected
  *     </ul>
  *
  * @return A copy of this object
  */
 private FullHttpResponse copy(boolean copyContent, ByteBuf newContent) {
   DefaultFullHttpResponse copy =
       new DefaultFullHttpResponse(
           protocolVersion(),
           status(),
           copyContent
               ? content().copy()
               : newContent == null ? Unpooled.buffer(0) : newContent);
   copy.headers().set(headers());
   copy.trailingHeaders().set(trailingHeaders());
   return copy;
 }