Class TempFileHolder
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.filestorage.TempFileHolder
-
- All Implemented Interfaces:
EventListener,javax.servlet.http.HttpSessionBindingListener
public class TempFileHolder extends Object implements javax.servlet.http.HttpSessionBindingListener
Attaches an uploaded file to the session with a listener, so the file will be deleted if- The session times out.
- The session is invalidated.
- The server is shut down.
- Another file is attached to the session with the same attribute name.
remove.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidattach(javax.servlet.http.HttpSession session, String attributeName, FileInfo fileInfo)Create a holding the givenFileInfo, and attach it to the session with the given attribute name.static FileInforemove(javax.servlet.http.HttpSession session, String attributeName)Get the which is stored as an attribute on this session, extract theFileInfofrom it, and remove it from the session.voidvalueBound(javax.servlet.http.HttpSessionBindingEvent event)When attached to the session, do nothing.voidvalueUnbound(javax.servlet.http.HttpSessionBindingEvent event)When removed from the session, if thefileInfois not empty, delete the file.
-
-
-
Method Detail
-
attach
public static void attach(javax.servlet.http.HttpSession session, String attributeName, FileInfo fileInfo)Create a holding the givenFileInfo, and attach it to the session with the given attribute name. If an attribute with this name already exists, it is replaced.
-
remove
public static FileInfo remove(javax.servlet.http.HttpSession session, String attributeName)
Get the which is stored as an attribute on this session, extract theFileInfofrom it, and remove it from the session. If there is no such attribute, of if it is not a , return null.
-
valueBound
public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
When attached to the session, do nothing.- Specified by:
valueBoundin interfacejavax.servlet.http.HttpSessionBindingListener
-
valueUnbound
public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
When removed from the session, if thefileInfois not empty, delete the file. If you had wanted this file, you should have calledremove.- Specified by:
valueUnboundin interfacejavax.servlet.http.HttpSessionBindingListener
-
-