PAJES 3.0.21

org.pajes.servlet
Class UploadFileRequest

java.lang.Object
  extended by org.pajes.servlet.UploadFileRequest

public class UploadFileRequest
extends java.lang.Object

Handles a request stream that contains files to be uploaded.

Note that if a request contains files to be upload, the getParameter(java.lang.String), getParameterNames() and getParameterValues(java.lang.String) methods of this class should be used, rather than the equivalent methods of the ServletRequest object.


Constructor Summary
UploadFileRequest(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, int maxSize)
          Constructs a new UploadFileRequest to save any uploaded files to the specified directory.
 
Method Summary
 java.lang.String getParameter(java.lang.String name)
          Returns the value of a request parameter as a String, or null if the parameter does not exist.
 java.util.Enumeration<java.lang.String> getParameterNames()
          Returns an Enumeration of String objects containing the names of the parameters contained in this request.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist.
 UploadedFile getUploadedFile(java.lang.String sourceFileName)
          Returns the specified uploaded file instance.
 java.util.Enumeration<java.lang.String> getUploadedFileNames()
          Returns an Enumeration of String objects containing the names of the files uploaded in this request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UploadFileRequest

public UploadFileRequest(javax.servlet.ServletContext context,
                         javax.servlet.http.HttpServletRequest request,
                         int maxSize)
                  throws UploadFileRequestException
Constructs a new UploadFileRequest to save any uploaded files to the specified directory.

Parameters:
context - the servlet context.
request - the servlet request instance.
maxSize - the maximum file posting size (in bytes).
Throws:
UploadFileRequestException - if the Content-Length of the request exceeds the maximum posting size, or the Content-Type header does not contain the boundary, or the save directory is not a directory or is not writable.
Method Detail

getParameter

public java.lang.String getParameter(java.lang.String name)
Returns the value of a request parameter as a String, or null if the parameter does not exist. Request parameters are extra information sent with the request.

You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use getParameterValues(java.lang.String).

If you use this method with a multivalued parameter, the servlet engine determines the return value.

Parameters:
name - a String specifying the name of the parameter
Returns:
a String representing the single value of the parameter
See Also:
getParameterValues(java.lang.String)

getParameterNames

public java.util.Enumeration<java.lang.String> getParameterNames()
Returns an Enumeration of String objects containing the names of the parameters contained in this request. If the request has no parameters or if the input stream is empty, returns an empty Enumeration. The input stream is empty when all the data returned by #getInputStream has been read.

Returns:
an Enumeration of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist. For example, in an HTTP servlet, this method returns an array of String objects containing the values of a query string or posted form.

If the parameter has a single value, the array has a length of 1.

Parameters:
name - a String containing the name of the parameter whose value is requested
Returns:
an array of String objects containing the parameter's values
See Also:
getParameter(java.lang.String)

getUploadedFile

public UploadedFile getUploadedFile(java.lang.String sourceFileName)
Returns the specified uploaded file instance.

Parameters:
sourceFileName - the file name of the uploaded file to be retrieved.
Returns:
the uploaded file definition.
See Also:
getUploadedFileNames()

getUploadedFileNames

public java.util.Enumeration<java.lang.String> getUploadedFileNames()
Returns an Enumeration of String objects containing the names of the files uploaded in this request. If the request has no uploaded files, returns an empty Enumeration.

Returns:
an Enumeration of String objects, each String containing the source file name of an uploaded file; or an empty Enumeration if the request has no uploaded files.
See Also:
getUploadedFile(java.lang.String)

PAJES 3.0.21

Copyright © 1998-2007 Viridian Pty Limited. All Rights Reserved.