org.apache.tomcat.util.http.fileupload.disk.DiskFileItem Java Examples

The following examples show how to use org.apache.tomcat.util.http.fileupload.disk.DiskFileItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationPart.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public String getHeader(String name) {
    if (fileItem instanceof DiskFileItem) {
        return ((DiskFileItem) fileItem).getHeaders().getHeader(name);
    }
    return null;
}
 
Example #2
Source File: ApplicationPart.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public Collection<String> getHeaderNames() {
    if (fileItem instanceof DiskFileItem) {
        LinkedHashSet<String> headerNames = new LinkedHashSet<>();
        Iterator<String> iter =
            ((DiskFileItem) fileItem).getHeaders().getHeaderNames();
        while (iter.hasNext()) {
            headerNames.add(iter.next());
        }
        return headerNames;
    }
    return Collections.emptyList();
}
 
Example #3
Source File: ApplicationPart.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public Collection<String> getHeaders(String name) {
    if (fileItem instanceof DiskFileItem) {
        LinkedHashSet<String> headers = new LinkedHashSet<>();
        Iterator<String> iter =
            ((DiskFileItem) fileItem).getHeaders().getHeaders(name);
        while (iter.hasNext()) {
            headers.add(iter.next());
        }
        return headers;
    }
    return Collections.emptyList();
}
 
Example #4
Source File: ApplicationPart.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public String getHeader(String name) {
    if (fileItem instanceof DiskFileItem) {
        return ((DiskFileItem) fileItem).getHeaders().getHeader(name);
    }
    return null;
}
 
Example #5
Source File: ApplicationPart.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<String> getHeaderNames() {
    if (fileItem instanceof DiskFileItem) {
        HashSet<String> headerNames = new HashSet<String>();
        Iterator<String> iter =
            ((DiskFileItem) fileItem).getHeaders().getHeaderNames();
        while (iter.hasNext()) {
            headerNames.add(iter.next());
        }
        return headerNames;
    }
    return Collections.emptyList();
}
 
Example #6
Source File: ApplicationPart.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<String> getHeaders(String name) {
    if (fileItem instanceof DiskFileItem) {
        HashSet<String> headers = new HashSet<String>();
        Iterator<String> iter =
            ((DiskFileItem) fileItem).getHeaders().getHeaders(name);
        while (iter.hasNext()) {
            headers.add(iter.next());
        }
        return headers;
    }
    return Collections.emptyList();
}
 
Example #7
Source File: WxMultipartFile.java    From FastBootWeixin with Apache License 2.0 5 votes vote down vote up
/**
 * Determine whether the multipart content is still available.
 * If a temporary file has been moved, the content is no longer available.
 */
protected boolean isAvailable() {
    // If in memory, it's available.
    if (this.fileItem.isInMemory()) {
        return true;
    }
    // Check actual existence of temporary file.
    if (this.fileItem instanceof DiskFileItem) {
        return ((DiskFileItem) this.fileItem).getStoreLocation().exists();
    }
    // Check whether current file size is different than original one.
    return (this.fileItem.getSize() == this.size);
}
 
Example #8
Source File: WxMultipartFile.java    From FastBootWeixin with Apache License 2.0 5 votes vote down vote up
/**
 * Return a description for the storage location of the multipart content.
 * Tries to be as specific as possible: mentions the file location in case
 * of a temporary file.
 */
public String getStorageDescription() {
    if (this.fileItem.isInMemory()) {
        return "in memory";
    } else if (this.fileItem instanceof DiskFileItem) {
        return "at [" + ((DiskFileItem) this.fileItem).getStoreLocation().getAbsolutePath() + "]";
    } else {
        return "on disk";
    }
}
 
Example #9
Source File: ApplicationPart.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public String getHeader(String name) {
    if (fileItem instanceof DiskFileItem) {
        return ((DiskFileItem) fileItem).getHeaders().getHeader(name);
    }
    return null;
}
 
Example #10
Source File: ApplicationPart.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<String> getHeaderNames() {
    if (fileItem instanceof DiskFileItem) {
        HashSet<String> headerNames = new HashSet<String>();
        Iterator<String> iter =
            ((DiskFileItem) fileItem).getHeaders().getHeaderNames();
        while (iter.hasNext()) {
            headerNames.add(iter.next());
        }
        return headerNames;
    }
    return Collections.emptyList();
}
 
Example #11
Source File: ApplicationPart.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<String> getHeaders(String name) {
    if (fileItem instanceof DiskFileItem) {
        HashSet<String> headers = new HashSet<String>();
        Iterator<String> iter =
            ((DiskFileItem) fileItem).getHeaders().getHeaders(name);
        while (iter.hasNext()) {
            headers.add(iter.next());
        }
        return headers;
    }
    return Collections.emptyList();
}