wicket.protocol.http.servlet
Class MultipartServletWebRequest

java.lang.Object
  extended by wicket.Request
      extended by wicket.protocol.http.WebRequest
          extended by wicket.protocol.http.servlet.ServletWebRequest
              extended by wicket.protocol.http.servlet.MultipartServletWebRequest
All Implemented Interfaces:
IMultipartWebRequest

public class MultipartServletWebRequest
extends ServletWebRequest
implements IMultipartWebRequest

Servlet specific WebRequest subclass for multipart content uploads.

Author:
Jonathan Locke, Eelco Hillenius, Cameron Braid, Ate Douma, Igor Vaynberg (ivaynberg)

Constructor Summary
MultipartServletWebRequest(javax.servlet.http.HttpServletRequest request, Bytes maxSize)
          Constructor
 
Method Summary
 FileItem getFile(java.lang.String fieldName)
          Gets the file that was uploaded using the given field name.
 java.util.Map getFiles()
           
 java.lang.String getParameter(java.lang.String key)
          Gets the request parameter with the given key.
 java.util.Map getParameterMap()
          Gets the request parameters.
 java.lang.String[] getParameters(java.lang.String key)
          Gets the request parameters with the given key.
protected  void onUploadCompleted()
          Upload completed callback
protected  void onUploadStarted(int totalBytes)
          Upload start callback
protected  void onUploadUpdate(int bytesUploaded, int total)
          Upload status update callback
protected  boolean wantUploadProgressUpdates()
          Subclasses that want to receive upload notifiactions should return true
 
Methods inherited from class wicket.protocol.http.servlet.ServletWebRequest
getContextPath, getHttpServletRequest, getLocale, getPath, getRelativeURL, getServletPath, isAjax, newMultipartWebRequest, toString
 
Methods inherited from class wicket.protocol.http.WebRequest
getCookies, getURL
 
Methods inherited from class wicket.Request
decodeURL, getPage, getRequestParameters, setPage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultipartServletWebRequest

public MultipartServletWebRequest(javax.servlet.http.HttpServletRequest request,
                                  Bytes maxSize)
                           throws FileUploadException
Constructor

Parameters:
maxSize - the maximum size this request may be
request - the servlet request
Throws:
FileUploadException - Thrown if something goes wrong with upload
Method Detail

getFiles

public java.util.Map getFiles()
Specified by:
getFiles in interface IMultipartWebRequest
Returns:
Returns the files.

getFile

public FileItem getFile(java.lang.String fieldName)
Gets the file that was uploaded using the given field name.

Specified by:
getFile in interface IMultipartWebRequest
Parameters:
fieldName - the field name that was used for the upload
Returns:
the upload with the given field name

getParameter

public java.lang.String getParameter(java.lang.String key)
Description copied from class: ServletWebRequest
Gets the request parameter with the given key.

Overrides:
getParameter in class ServletWebRequest
Parameters:
key - Parameter name
Returns:
Parameter value
See Also:
WebRequest.getParameter(java.lang.String)

getParameterMap

public java.util.Map getParameterMap()
Description copied from class: ServletWebRequest
Gets the request parameters.

Overrides:
getParameterMap in class ServletWebRequest
Returns:
Map of parameters
See Also:
WebRequest.getParameterMap()

getParameters

public java.lang.String[] getParameters(java.lang.String key)
Description copied from class: ServletWebRequest
Gets the request parameters with the given key.

Overrides:
getParameters in class ServletWebRequest
Parameters:
key - Parameter name
Returns:
Parameter values
See Also:
WebRequest.getParameters(java.lang.String)

wantUploadProgressUpdates

protected boolean wantUploadProgressUpdates()
Subclasses that want to receive upload notifiactions should return true

Returns:
true if upload status update event should be invoked

onUploadStarted

protected void onUploadStarted(int totalBytes)
Upload start callback

Parameters:
totalBytes -

onUploadUpdate

protected void onUploadUpdate(int bytesUploaded,
                              int total)
Upload status update callback

Parameters:
bytesUploaded -
total -

onUploadCompleted

protected void onUploadCompleted()
Upload completed callback



Copyright © 2004-2007 Wicket developers. All Rights Reserved.