/** * Clean all {@link HttpData}s for the current request. */ @Override public void cleanFiles() { checkDestroyed(); factory.cleanRequestHttpData(request); }
/** * Clean all HttpDatas (on Disk) for the current request. */ @Override public void cleanFiles() { checkDestroyed(); factory.cleanRequestHttpData(request); }
/** * Remove the given FileUpload from the list of FileUploads to clean */ @Override public void removeHttpDataFromClean(InterfaceHttpData data) { checkDestroyed(); factory.removeHttpDataFromClean(request, data); } }
@Override public void setContent(InputStream inputStream) throws IOException { if (attribute instanceof MemoryAttribute) { // change to Disk even if we don't know the size attribute = new DiskAttribute(attribute.getName(), attribute.definedLength()); attribute.setMaxSize(maxSize); } attribute.setContent(inputStream); }
public MixedFileUpload(String name, String filename, String contentType, String contentTransferEncoding, Charset charset, long size, long limitSize) { this.limitSize = limitSize; if (size > this.limitSize) { fileUpload = new DiskFileUpload(name, filename, contentType, contentTransferEncoding, charset, size); } else { fileUpload = new MemoryFileUpload(name, filename, contentType, contentTransferEncoding, charset, size); } definedSize = size; }
public DiskFileUpload(String name, String filename, String contentType, String contentTransferEncoding, Charset charset, long size) { super(name, charset, size); setFilename(filename); setContentType(contentType); setContentTransferEncoding(contentTransferEncoding); }
/** * Remove the given FileUpload from the list of FileUploads to clean */ @Override public void removeHttpDataFromClean(InterfaceHttpData data) { checkDestroyed(); factory.removeHttpDataFromClean(request, data); }
@Override public FileUpload retain(int increment) { fileUpload.retain(increment); return this; }
@Override public FileUpload retain() { super.retain(); return this; }
@Override public byte[] get() throws IOException { if (file == null) { return EmptyArrays.EMPTY_BYTES; } return readFrom(file); }
@Override public Attribute touch(Object hint) { attribute.touch(hint); return this; }
@Override public FileUpload touch(Object hint) { super.touch(hint); return this; } }
@Override public FileUpload touch() { fileUpload.touch(); return this; }
/** * Init the delimiter for Mixed Part (Mixed). */ private void initMixedMultipart() { multipartMixedBoundary = getNewMultipartDelimiter(); }
@Override public FullHttpRequest setProtocolVersion(HttpVersion version) { super.setProtocolVersion(version); return this; }
/** * True if this request is a Multipart request * * @return True if this request is a Multipart request */ @Override public boolean isMultipart() { checkDestroyed(); return false; }
@Override public void setContent(ByteBuf buffer) throws IOException { checkSize(buffer.readableBytes()); if (buffer.readableBytes() > limitSize) { if (attribute instanceof MemoryAttribute) { // change to Disk attribute = new DiskAttribute(attribute.getName(), attribute.definedLength()); attribute.setMaxSize(maxSize); } } attribute.setContent(buffer); }
@Override public FileUpload retain(int increment) { super.retain(increment); return this; }
@Override public void setContent(File file) throws IOException { checkSize(file.length()); if (file.length() > limitSize) { if (attribute instanceof MemoryAttribute) { // change to Disk attribute = new DiskAttribute(attribute.getName(), attribute.definedLength()); attribute.setMaxSize(maxSize); } } attribute.setContent(file); }