@Override public void parseRequestParameters( final Map<String, String> params, final Map<String, com.bradmcevoy.http.FileItem> files) throws RequestParseException { try { if (isMultiPart()) { parseQueryString(params, req.getQueryString()); @SuppressWarnings("unchecked") final List<FileItem> items = new ServletFileUpload().parseRequest(req); for (final FileItem item : items) { if (item.isFormField()) params.put(item.getFieldName(), item.getString()); else files.put(item.getFieldName(), new FileItemWrapper(item)); } } else { final Enumeration<String> en = req.getParameterNames(); while (en.hasMoreElements()) { final String nm = en.nextElement(); final String val = req.getParameter(nm); params.put(nm, val); } } } catch (final FileUploadException ex) { throw new RequestParseException("FileUploadException", ex); } catch (final Throwable ex) { throw new RequestParseException(ex.getMessage(), ex); } }
@Override public Map<String, String> getHeaders() { final Map<String, String> map = new HashMap<>(); final Enumeration<String> en = req.getHeaderNames(); while (en.hasMoreElements()) { final String name = en.nextElement(); final String val = req.getHeader(name); map.put(name, val); } return map; }