|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.servlet.multipart.Part
public abstract class Part
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.
Field Summary | |
---|---|
protected Map |
headers
Field headers |
Constructor Summary | |
---|---|
protected |
Part(Map headers)
|
Method Summary | |
---|---|
void |
copyToFile(String filename)
Convenience method to copy a part to a file. |
void |
copyToSource(ModifiableSource source)
Convenience method to copy a part to a modifiable source. |
abstract void |
dispose()
Dispose any resources held by this part, such as a file or memory buffer. |
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? |
abstract String |
getFileName()
Returns the filename |
Map |
getHeaders()
Returns the part headers |
abstract InputStream |
getInputStream()
Returns an InputStream containing the file data |
String |
getMimeType()
Returns the mime type (or null if unknown) |
abstract int |
getSize()
Returns the length of the file content |
String |
getUploadName()
Returns the original filename |
boolean |
isRejected()
Is this part a rejected part? |
void |
setDisposeWithRequest(boolean dispose)
Set the value of the disposeWithRequest flag (default is true ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map headers
Constructor Detail |
---|
protected Part(Map headers)
Method Detail |
---|
public Map getHeaders()
public abstract String getFileName()
public String getUploadName()
public abstract int getSize()
public boolean isRejected()
instanceof RejectedPart
in places where it's not convenient such as flowscript.
true
if this part was rejectedpublic String getMimeType()
public boolean disposeWithRequest()
true
.
true
if the part should be disposed with the request.public void setDisposeWithRequest(boolean dispose)
disposeWithRequest
flag (default is true
).
dispose
- true
if the part should be disposed after request processingpublic abstract InputStream getInputStream() throws IOException
IOException
public void copyToSource(ModifiableSource source) throws IOException
source
- the modifiable source to write to
IOException
public void copyToFile(String filename) throws IOException
filename
- name of the file to write to
IOException
public abstract void dispose()
Disposal occurs in all cases when the part is garbage collected, but calling it explicitely allows to cleanup resources more quickly.
dispose
in interface Disposable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |