1 15 package org.apache.tapestry.multipart; 16 17 import java.util.Collections ; 18 import java.util.Enumeration ; 19 import java.util.Map ; 20 21 import javax.servlet.http.HttpServletRequest ; 22 import javax.servlet.http.HttpServletRequestWrapper ; 23 24 import org.apache.hivemind.util.Defense; 25 26 33 public class UploadFormParametersWrapper extends HttpServletRequestWrapper 34 { 35 38 private Map _parameterMap; 39 40 44 public UploadFormParametersWrapper(HttpServletRequest request, Map parameterMap) 45 { 46 super(request); 47 48 Defense.notNull(parameterMap, "parameterMap"); 49 50 _parameterMap = Collections.unmodifiableMap(parameterMap); 51 } 52 53 public String getParameter(String name) 54 { 55 String [] values = getParameterValues(name); 56 57 return (values == null || values.length == 0) ? null : values[0]; 58 } 59 60 public Map getParameterMap() 61 { 62 return _parameterMap; 63 } 64 65 public Enumeration getParameterNames() 66 { 67 return Collections.enumeration(_parameterMap.keySet()); 68 } 69 70 public String [] getParameterValues(String name) 71 { 72 return (String []) _parameterMap.get(name); 73 } 74 75 public String toString() 76 { 77 return "<UploadFormPartWrapper for " + getRequest() + ">"; 78 } 79 } | Popular Tags |