org.apache.struts2.dispatcher.multipart
类 MultiPartRequestWrapper

java.lang.Object
  继承者 javax.servlet.ServletRequestWrapper
      继承者 javax.servlet.http.HttpServletRequestWrapper
          继承者 org.apache.struts2.dispatcher.StrutsRequestWrapper
              继承者 org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper
所有已实现的接口:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class MultiPartRequestWrapper
extends StrutsRequestWrapper

Parse a multipart request and provide a wrapper around the request. The parsing implementation used depends on the struts.multipart.parser setting. It should be set to a class which extends MultiPartRequest.

The struts.multipart.parser property should be set to jakarta for the Jakarta implementation, pell for the Pell implementation and cos for the Jason Hunter implementation.

The files are uploaded when the object is instantiated. If there are any errors they are logged using addError(String). An action handling a multipart form should first check hasErrors() before doing any other processing.

An alternate implementation, PellMultiPartRequest, is provided as a plugin.


字段摘要
 
从接口 javax.servlet.http.HttpServletRequest 继承的字段
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
构造方法摘要
MultiPartRequestWrapper(MultiPartRequest multiPartRequest, javax.servlet.http.HttpServletRequest request, String saveDir, com.opensymphony.xwork2.LocaleProvider provider)
          Process file downloads and log any errors.
 
方法摘要
 void cleanUp()
           
 String[] getContentTypes(String name)
          Get an array of content encoding for the specified input field name or null if no content type was specified.
 Collection<String> getErrors()
          Returns a collection of any errors generated when parsing the multipart request.
 String[] getFileNames(String fieldName)
          Get a String array of the file names for uploaded files
 Enumeration<String> getFileParameterNames()
          Get an enumeration of the parameter names for uploaded files
 File[] getFiles(String fieldName)
          Get a File[] for the given input field name.
 String[] getFileSystemNames(String fieldName)
          Get the filename(s) of the file(s) uploaded for the given input field name.
 String getParameter(String name)
           
 Map getParameterMap()
           
 Enumeration getParameterNames()
           
 String[] getParameterValues(String name)
           
 boolean hasErrors()
          Returns true if any errors occured when parsing the HTTP multipart request, false otherwise.
 
从类 org.apache.struts2.dispatcher.StrutsRequestWrapper 继承的方法
getAttribute
 
从类 javax.servlet.http.HttpServletRequestWrapper 继承的方法
authenticate, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole, login, logout
 
从类 javax.servlet.ServletRequestWrapper 继承的方法
getAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 javax.servlet.ServletRequest 继承的方法
getAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
 

构造方法详细信息

MultiPartRequestWrapper

public MultiPartRequestWrapper(MultiPartRequest multiPartRequest,
                               javax.servlet.http.HttpServletRequest request,
                               String saveDir,
                               com.opensymphony.xwork2.LocaleProvider provider)
Process file downloads and log any errors.

参数:
multiPartRequest - Our MultiPartRequest object
request - Our HttpServletRequest object
saveDir - Target directory for any files that we save
provider -
方法详细信息

getFileParameterNames

public Enumeration<String> getFileParameterNames()
Get an enumeration of the parameter names for uploaded files

返回:
enumeration of parameter names for uploaded files

getContentTypes

public String[] getContentTypes(String name)
Get an array of content encoding for the specified input field name or null if no content type was specified.

参数:
name - input field name
返回:
an array of content encoding for the specified input field name

getFiles

public File[] getFiles(String fieldName)
Get a File[] for the given input field name.

参数:
fieldName - input field name
返回:
a File[] object for files associated with the specified input field name

getFileNames

public String[] getFileNames(String fieldName)
Get a String array of the file names for uploaded files

参数:
fieldName - Field to check for file names.
返回:
a String[] of file names for uploaded files

getFileSystemNames

public String[] getFileSystemNames(String fieldName)
Get the filename(s) of the file(s) uploaded for the given input field name. Returns null if the file is not found.

参数:
fieldName - input field name
返回:
the filename(s) of the file(s) uploaded for the given input field name or null if name not found.

getParameter

public String getParameter(String name)
指定者:
接口 javax.servlet.ServletRequest 中的 getParameter
覆盖:
javax.servlet.ServletRequestWrapper 中的 getParameter
另请参见:
ServletRequest.getParameter(String)

getParameterMap

public Map getParameterMap()
指定者:
接口 javax.servlet.ServletRequest 中的 getParameterMap
覆盖:
javax.servlet.ServletRequestWrapper 中的 getParameterMap
另请参见:
ServletRequest.getParameterMap()

getParameterNames

public Enumeration getParameterNames()
指定者:
接口 javax.servlet.ServletRequest 中的 getParameterNames
覆盖:
javax.servlet.ServletRequestWrapper 中的 getParameterNames
另请参见:
ServletRequest.getParameterNames()

getParameterValues

public String[] getParameterValues(String name)
指定者:
接口 javax.servlet.ServletRequest 中的 getParameterValues
覆盖:
javax.servlet.ServletRequestWrapper 中的 getParameterValues
另请参见:
ServletRequest.getParameterValues(String)

hasErrors

public boolean hasErrors()
Returns true if any errors occured when parsing the HTTP multipart request, false otherwise.

返回:
true if any errors occured when parsing the HTTP multipart request, false otherwise.

getErrors

public Collection<String> getErrors()
Returns a collection of any errors generated when parsing the multipart request.

返回:
the error Collection.

cleanUp

public void cleanUp()