Package rife.engine
Class UploadedFile
java.lang.Object
rife.engine.UploadedFile
- All Implemented Interfaces:
AutoCloseable
,Cloneable
An
UploadedFile
instance is created by the web engine when
files are uploaded through a multipart request.
The uploaded files can be retrieved through the
ElementSupport#getUploadedFile
method and its siblings. The
web engine does its best to dispose of the temporary file at a convenient
time, but the file is not guaranteed to persist after the request. If you
want to make sure that the file is deleted, you should call File.delete()
yourself when you're finished with the uploaded file.
- Since:
- 1.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
void
close()
Close the uploaded file and remove any temporary resources that were created.Retrieves the content type of the file.getFile()
Retrieves the temporary file on the server that was created for the upload.getName()
Retrieves the name of the file that was selected on the client when uploading.void
setSizeExceeded
(boolean exceeded) Indicates whether the maximum file size was exceeded during upload.void
setTempFile
(File tempFile) Register a particular file as being the temporary file used for storage.boolean
Indicates whether the uploaded file exceeded the fileRifeConfig.EngineConfig.getFileUploadSizeLimit()
upload size limit}.
-
Constructor Details
-
UploadedFile
Create a new instance.This is an internal method, not intended to be used outside RIFE2.
- Parameters:
filename
- the file name that was uploadedcontentType
- the content type of the file- Since:
- 1.0
-
-
Method Details
-
close
public void close()Close the uploaded file and remove any temporary resources that were created.- Specified by:
close
in interfaceAutoCloseable
- Since:
- 1.0
-
setTempFile
Register a particular file as being the temporary file used for storage.This is an internal method, not intended to be used outside RIFE2.
- Parameters:
tempFile
- the temporary file that is being used- Since:
- 1.0
-
setSizeExceeded
public void setSizeExceeded(boolean exceeded) Indicates whether the maximum file size was exceeded during upload.This is an internal method, not intended to be used outside RIFE2.
- Parameters:
exceeded
-true
if the maximum upload size was exceeded;false
otherwise- Since:
- 1.0
-
getContentType
Retrieves the content type of the file.- Returns:
- the content type of the uploaded file
- Since:
- 1.0
-
getName
Retrieves the name of the file that was selected on the client when uploading.- Returns:
- the name of the original file that was uploaded
- Since:
- 1.0
-
getFile
Retrieves the temporary file on the server that was created for the upload.- Returns:
- the temporary uploaded file
- Since:
- 1.0
-
wasSizeExceeded
public boolean wasSizeExceeded()Indicates whether the uploaded file exceeded the fileRifeConfig.EngineConfig.getFileUploadSizeLimit()
upload size limit}.If the limit was exceeded, the temporary file will be
null
and deleted from the server.- Returns:
true
if the upload file size limit was exceeded; orfalse
otherwise- Since:
- 1.0
-
clone
-