| java.lang.Object org.apache.cocoon.servlet.multipart.Part
All known Subclasses: org.apache.cocoon.servlet.multipart.PartOnDisk, org.apache.cocoon.servlet.multipart.PartInMemory, org.apache.cocoon.servlet.multipart.RejectedPart,
Part | abstract public class Part implements Disposable(Code) | | This abstract class represents a file part parsed from a http post stream. The concrete
class,
PartOnDisk or
PartInMemory that is used depends on the upload configuration
in web.xml .
If uploaded data size exceeds the maximum allowed upload size (also specified in web.xml ),
then an
RejectedPart is used, from which no data can be obtained, but which gives some
information on the rejected uploads.
author: Jeroen ter Voorde version: $Id: Part.java 433543 2006-08-22 06:22:54Z crossley $ |
Constructor Summary | |
protected | Part(Map headers) |
Method Summary | |
public void | copyToFile(String filename) Convenience method to copy a part to a file. | public void | copyToSource(ModifiableSource source) Convenience method to copy a part to a modifiable source. | abstract public void | dispose() Dispose any resources held by this part, such as a file or memory buffer. | public boolean | disposeWithRequest() Do we want any temporary resource held by this part to be cleaned up when processing of
the request that created it is finished? Default is true . | abstract public String | getFileName() | public Map | getHeaders() | abstract public InputStream | getInputStream() | public String | getMimeType() | abstract public int | getSize() | public String | getUploadName() | public boolean | isRejected() Is this part a rejected part? Provided as an alternative to instanceof RejectedPart
in places where it's not convenient such as flowscript. | public void | setDisposeWithRequest(boolean dispose) Set the value of the disposeWithRequest flag (default is true ). |
headers | protected Map headers(Code) | | Field headers
|
copyToFile | public void copyToFile(String filename) throws IOException(Code) | | Convenience method to copy a part to a file.
Parameters: filename - name of the file to write to throws: IOException - since: 2.1.8 |
copyToSource | public void copyToSource(ModifiableSource source) throws IOException(Code) | | Convenience method to copy a part to a modifiable source.
Parameters: source - the modifiable source to write to throws: IOException - since: 2.1.8 |
dispose | abstract public void dispose()(Code) | | Dispose any resources held by this part, such as a file or memory buffer.
Disposal occurs in all cases when the part is garbage collected, but calling it explicitely
allows to cleanup resources more quickly.
|
disposeWithRequest | public boolean disposeWithRequest()(Code) | | Do we want any temporary resource held by this part to be cleaned up when processing of
the request that created it is finished? Default is true .
true if the part should be disposed with the request. |
getFileName | abstract public String getFileName()(Code) | | Returns the filename
|
getHeaders | public Map getHeaders()(Code) | | Returns the part headers
|
getMimeType | public String getMimeType()(Code) | | Returns the mime type (or null if unknown)
|
getSize | abstract public int getSize()(Code) | | Returns the length of the file content
|
getUploadName | public String getUploadName()(Code) | | Returns the original filename
|
isRejected | public boolean isRejected()(Code) | | Is this part a rejected part? Provided as an alternative to instanceof RejectedPart
in places where it's not convenient such as flowscript.
true if this part was rejected |
setDisposeWithRequest | public void setDisposeWithRequest(boolean dispose)(Code) | | Set the value of the disposeWithRequest flag (default is true ).
Parameters: dispose - true if the part should be disposed after request processing |
|
|