/** * This method is used to create a body consumer to read the body * from the pipeline. This will examine the HTTP header associated * with the body to determine how to consume the data. This will * provide an empty consumer if no specific delimiter was provided. * * @param length this is the length of the body to be consumed * * @return this returns the consumer used to consume the body */ public BodyConsumer getInstance(long length) { byte[] boundary = getBoundary(segment); if(isUpload(segment)) { return new FileUploadConsumer(allocator, boundary, length); } if(isChunked(segment)) { return new ChunkedConsumer(allocator); } if(isFixed(segment)) { return new FixedConsumer(allocator, length); } return new EmptyConsumer(); }
/** * This method is used to create a body consumer to read the body * from the pipeline. This will examine the HTTP header associated * with the body to determine how to consume the data. This will * provide an empty consumer if no specific delimiter was provided. * * @return this returns the consumer used to consume the body */ public BodyConsumer getInstance() { long length = getContentLength(); if(length < 0) { return getInstance(8192); } return getInstance(length); }
/** * This is determined finished when the body has been consumed. * If only the header has been consumed then the body will be * created using the header information, the body is then read * from the cursor, which may read nothing for an empty body. * * @return this returns true if the entity has been built */ public boolean isFinished() { if(header.isFinished()) { if(body == null) { CharSequence sequence = header.getHeader(); trace.trace(HEADER_FINISHED, sequence); body = factory.getInstance(); } return body.isFinished(); } return false; }
/** * Constructor for the <code>EntityConsumer</code> object. This * is used to build an entity from the constituent parts. Once * all of the parts have been consumed they are available from * the exposed methods of this consumed instance. * * @param allocator this is used to allocate the memory used * @param channel this is the channel used to send a response */ public EntityConsumer(Allocator allocator, Channel channel) { this.header = new RequestConsumer(); this.expect = new Expectation(channel); this.factory = new ConsumerFactory(allocator, header); this.trace = channel.getTrace(); }
/** * This is determined finished when the body has been consumed. * If only the header has been consumed then the body will be * created using the header information, the body is then read * from the cursor, which may read nothing for an empty body. * * @return this returns true if the entity has been built */ public boolean isFinished() { if(header.isFinished()) { if(body == null) { CharSequence sequence = header.getHeader(); trace.trace(HEADER_FINISHED, sequence); body = factory.getInstance(); } return body.isFinished(); } return false; }
/** * Constructor for the <code>EntityConsumer</code> object. This * is used to build an entity from the constituent parts. Once * all of the parts have been consumed they are available from * the exposed methods of this consumed instance. * * @param allocator this is used to allocate the memory used * @param channel this is the channel used to send a response */ public EntityConsumer(Allocator allocator, Channel channel) { this.header = new RequestConsumer(); this.dispatcher = new ContinueDispatcher(channel); this.factory = new ConsumerFactory(allocator, header); this.trace = channel.getTrace(); }
/** * This method is used to create a body consumer to read the body * from the pipeline. This will examine the HTTP header associated * with the body to determine how to consume the data. This will * provide an empty consumer if no specific delimiter was provided. * * @param length this is the length of the body to be consumed * * @return this returns the consumer used to consume the body */ public BodyConsumer getInstance(long length) { byte[] boundary = getBoundary(segment); if(isUpload(segment)) { return new FileUploadConsumer(allocator, boundary, length); } if(isChunked(segment)) { return new ChunkedConsumer(allocator); } if(isFixed(segment)) { return new FixedLengthConsumer(allocator, length); } return new EmptyConsumer(); }
/** * This method is used to create a body consumer to read the body * from the pipeline. This will examine the HTTP header associated * with the body to determine how to consume the data. This will * provide an empty consumer if no specific delimiter was provided. * * @return this returns the consumer used to consume the body */ public BodyConsumer getInstance() { long length = getContentLength(); if(length < 0) { return getInstance(8192); } return getInstance(length); }
/** * This is determined finished when the body has been consumed. * If only the header has been consumed then the body will be * created using the header information, the body is then read * from the cursor, which may read nothing for an empty body. * * @return this returns true if the entity has been built */ public boolean isFinished() { if(header.isFinished()) { if(body == null) { CharSequence sequence = header.getHeader(); trace.trace(HEADER_FINISHED, sequence); body = factory.getInstance(); } return body.isFinished(); } return false; }
/** * Constructor for the <code>EntityConsumer</code> object. This * is used to build an entity from the constituent parts. Once * all of the parts have been consumed they are available from * the exposed methods of this consumed instance. * * @param allocator this is used to allocate the memory used * @param channel this is the channel used to send a response */ public EntityConsumer(Allocator allocator, Channel channel) { this.header = new RequestConsumer(); this.dispatcher = new ContinueDispatcher(channel); this.factory = new ConsumerFactory(allocator, header); this.trace = channel.getTrace(); }
/** * This method is used to create a body consumer to read the body * from the pipeline. This will examine the HTTP header associated * with the body to determine how to consume the data. This will * provide an empty consumer if no specific delimiter was provided. * * @param length this is the length of the body to be consumed * * @return this returns the consumer used to consume the body */ public BodyConsumer getInstance(long length) { byte[] boundary = getBoundary(segment); if(isUpload(segment)) { return new FileUploadConsumer(allocator, boundary, length); } if(isChunked(segment)) { return new ChunkedConsumer(allocator); } if(isFixed(segment)) { return new FixedLengthConsumer(allocator, length); } return new EmptyConsumer(); }
/** * This method is used to create a body consumer to read the body * from the pipeline. This will examine the HTTP header associated * with the body to determine how to consume the data. This will * provide an empty consumer if no specific delimiter was provided. * * @return this returns the consumer used to consume the body */ public BodyConsumer getInstance() { long length = getContentLength(); if(length < 0) { return getInstance(8192); } return getInstance(length); }
body = factory.getInstance(); body = factory.getInstance();
body = factory.getInstance(); body = factory.getInstance();
body = factory.getInstance(); body = factory.getInstance();