1 5 package com.oreilly.servlet; 6 7 import java.io.*; 8 import java.util.*; 9 import javax.servlet.*; 10 import javax.servlet.http.*; 11 12 22 public class MultipartWrapper extends HttpServletRequestWrapper { 23 24 MultipartRequest mreq = null; 25 26 public MultipartWrapper(HttpServletRequest req, String dir) 27 throws IOException { 28 super(req); 29 mreq = new MultipartRequest(req, dir); 30 } 31 32 public Enumeration getParameterNames() { 34 return mreq.getParameterNames(); 35 } 36 public String getParameter(String name) { 37 return mreq.getParameter(name); 38 } 39 public String [] getParameterValues(String name) { 40 return mreq.getParameterValues(name); 41 } 42 public Map getParameterMap() { 43 Map map = new HashMap(); 44 Enumeration paramenum = getParameterNames(); 45 while (paramenum.hasMoreElements()) { 46 String name = (String ) paramenum.nextElement(); 47 map.put(name, mreq.getParameterValues(name)); 48 } 49 return map; 50 } 51 52 public Enumeration getFileNames() { 54 return mreq.getFileNames(); 55 } 56 public String getFilesystemName(String name) { 57 return mreq.getFilesystemName(name); 58 } 59 public String getContentType(String name) { 60 return mreq.getContentType(name); 61 } 62 public File getFile(String name) { 63 return mreq.getFile(name); 64 } 65 } 66 | Popular Tags |