public interface HTMLIFrameFileUpload extends ItsNatUserData
When this instance is created by calling ItsNatHTMLIFrame.getHTMLIFrameFileUpload(HTMLInputElement)
or ItsNatHTMLIFrame.getHTMLIFrameFileUpload(ClientDocument,HTMLInputElement)
,
JavaScript code is generated to create a temporary form to submit the file specified in
the <input type=file>
element to the <iframe>
as target. Because this code is sent
in the end of the request, developers can register some listener calling addItsNatServletRequestListener(ItsNatServletRequestListener)
to receive and process the file uploading request.
In spite of developers have absolute freedom to process the file upload request, the method
processFileUploadRequest(ItsNatServletRequest,ItsNatServletResponse)
can be optionally called,
this method executes the typical header parsing and exposes the file being uploaded as an input stream.
The thread dispatching the file upload listeners does not synchronize the ItsNatDocument
object, therefore any access to the ItsNatDocument
or dependent objects must be synchronized before.
When file upload processing ends (when listeners have been executed) this object is automatically disposed and cannot be reused
(explicit call to dispose()
is not needed).
ItsNatUserData
methods are thread safe.
ItsNat provides a default implementation of this interface.
ItsNatHTMLIFrame
Modifier and Type | Method and Description |
---|---|
void |
addItsNatServletRequestListener(ItsNatServletRequestListener listener)
Registers a new request listener to be executed when the file upload request is received.
|
void |
dispose()
Disposes this component.
|
ClientDocument |
getClientDocument()
Returns the client document which originated this file upload request.
|
org.w3c.dom.html.HTMLInputElement |
getHTMLInputElement()
Returns the input type=file element being used for file upload.
|
ItsNatHTMLIFrame |
getItsNatHTMLIFrame()
Returns the parent iframe component which created this instance.
|
boolean |
isDisposed()
Informs whether this component was disposed.
|
FileUploadRequest |
processFileUploadRequest(ItsNatServletRequest request,
ItsNatServletResponse response)
This method can be optionally called when a file upload request listener is being executed
to parse request headers and expose the file being uploaded as an input stream.
|
void |
removeItsNatServletRequestListener(ItsNatServletRequestListener listener)
Unregisters the specified file upload request listener.
|
containsUserValueName, getUserValue, getUserValueNames, removeUserValue, setUserValue
ItsNatHTMLIFrame getItsNatHTMLIFrame()
org.w3c.dom.html.HTMLInputElement getHTMLInputElement()
ClientDocument getClientDocument()
void addItsNatServletRequestListener(ItsNatServletRequestListener listener)
listener
- the listener to register.void removeItsNatServletRequestListener(ItsNatServletRequestListener listener)
listener
- the request listener to remove.addItsNatServletRequestListener(ItsNatServletRequestListener)
FileUploadRequest processFileUploadRequest(ItsNatServletRequest request, ItsNatServletResponse response)
request
- the ItsNat servlet request.response
- the ItsNat servlet response.addItsNatServletRequestListener(ItsNatServletRequestListener)
boolean isDisposed()
This method is thread safe and can be called directly from the thread reading the file being uploaded.
dispose()
void dispose()
If disposed before the file upload request is received, this request is ignored and listeners are not executed.
Because this method synchronizes the ItsNatDocument
it can be called
directly from the thread reading the file being uploaded.
isDisposed()
Copyright © 2007 Innowhere Software Services S.L. All Rights Reserved.