Class AjaxFileUploadBehavior
- java.lang.Object
-
- org.apache.wicket.behavior.Behavior
-
- org.apache.wicket.behavior.AbstractAjaxBehavior
-
- org.hippoecm.frontend.plugins.jquery.upload.behaviors.AjaxFileUploadBehavior
-
- All Implemented Interfaces:
Serializable
,org.apache.wicket.IComponentAwareEventSink
,org.apache.wicket.IRequestListener
,org.apache.wicket.markup.html.IComponentAwareHeaderContributor
,org.apache.wicket.util.io.IClusterable
public abstract class AjaxFileUploadBehavior extends org.apache.wicket.behavior.AbstractAjaxBehavior
The file upload behavior to handle uploads sent by ajax requests. The component container can override the following events:- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
APPLICATION_JSON
static String
JQUERY_FILEUPLOAD_ERROR
static String
JQUERY_FILEUPLOAD_FILES
static String
JQUERY_FILEUPLOAD_NAME
static String
JQUERY_FILEUPLOAD_SIZE
-
Constructor Summary
Constructors Constructor Description AjaxFileUploadBehavior(org.apache.wicket.markup.html.WebMarkupContainer container)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
onAfterUpload(org.apache.commons.fileupload.FileItem file, FileUploadInfo fileUploadInfo)
protected void
onBeforeUpload(FileUploadInfo fileUploadInfo)
Event is fired before processing the uploaded file.void
onRequest()
protected void
onResponse(org.apache.wicket.protocol.http.servlet.ServletWebRequest request, Map<String,FileUploadInfo> uploadedFiles)
protected void
onUploadError(FileUploadInfo fileUploadInfo)
protected org.apache.wicket.markup.html.form.upload.FileUpload
preProcess(org.apache.commons.fileupload.FileItem fileItem, org.apache.wicket.markup.html.form.upload.FileUpload originalFileUpload)
protected abstract void
process(org.apache.wicket.markup.html.form.upload.FileUpload fileUpload)
protected void
setResponse(org.apache.wicket.protocol.http.servlet.ServletWebRequest request, Map<String,FileUploadInfo> uploadedFiles)
protected void
validate(org.apache.wicket.markup.html.form.upload.FileUpload fileUpload)
protected boolean
wantsHtml(org.apache.wicket.protocol.http.servlet.ServletWebRequest request)
Decides what should be the response's content type depending on the 'Accept' request header.-
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior
afterRender, bind, getCallbackUrl, getComponent, onBind, onComponentRendered, onComponentTag, onComponentTag, onUnbind, unbind
-
Methods inherited from class org.apache.wicket.behavior.Behavior
beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onConfigure, onEvent, onException, onRemove, onTag, renderHead
-
-
-
-
Field Detail
-
APPLICATION_JSON
public static final String APPLICATION_JSON
- See Also:
- Constant Field Values
-
JQUERY_FILEUPLOAD_FILES
public static final String JQUERY_FILEUPLOAD_FILES
- See Also:
- Constant Field Values
-
JQUERY_FILEUPLOAD_NAME
public static final String JQUERY_FILEUPLOAD_NAME
- See Also:
- Constant Field Values
-
JQUERY_FILEUPLOAD_SIZE
public static final String JQUERY_FILEUPLOAD_SIZE
- See Also:
- Constant Field Values
-
JQUERY_FILEUPLOAD_ERROR
public static final String JQUERY_FILEUPLOAD_ERROR
- See Also:
- Constant Field Values
-
-
Method Detail
-
onRequest
public void onRequest()
-
onBeforeUpload
protected void onBeforeUpload(FileUploadInfo fileUploadInfo)
Event is fired before processing the uploaded file.
-
onUploadError
protected void onUploadError(FileUploadInfo fileUploadInfo)
-
validate
protected void validate(org.apache.wicket.markup.html.form.upload.FileUpload fileUpload) throws FileUploadViolationException
- Throws:
FileUploadViolationException
-
preProcess
protected org.apache.wicket.markup.html.form.upload.FileUpload preProcess(org.apache.commons.fileupload.FileItem fileItem, org.apache.wicket.markup.html.form.upload.FileUpload originalFileUpload) throws Exception
- Throws:
Exception
-
process
protected abstract void process(org.apache.wicket.markup.html.form.upload.FileUpload fileUpload) throws FileUploadViolationException
- Throws:
FileUploadViolationException
-
setResponse
protected void setResponse(org.apache.wicket.protocol.http.servlet.ServletWebRequest request, Map<String,FileUploadInfo> uploadedFiles)
-
wantsHtml
protected boolean wantsHtml(org.apache.wicket.protocol.http.servlet.ServletWebRequest request)
Decides what should be the response's content type depending on the 'Accept' request header. HTML5 browsers work with "application/json", older ones use IFrame to make the upload and the response should be HTML. Read http://blueimp.github.com/jQuery-File-Upload/ docs for more info.- Parameters:
request
-
-
onAfterUpload
protected void onAfterUpload(org.apache.commons.fileupload.FileItem file, FileUploadInfo fileUploadInfo)
-
onResponse
protected void onResponse(org.apache.wicket.protocol.http.servlet.ServletWebRequest request, Map<String,FileUploadInfo> uploadedFiles)
-
-