/** if http method is POST or PUT, when the business process finish, it must close piped stream */ void releaseInputStreamData() { try { if (getContentLength() > 0) { if (bodyPipedStream != null) { bodyPipedStream.close(); } if (multipartFormData != null) { multipartFormData.close(); } } } catch (Throwable t) { log.error("release input stream error", t); } }
@Override public Collection<Part> getParts() throws IOException, ServletException { if (multipartFormData == null) { ServletInputStream input = null; try { input = getInputStream(); PartImpl.tempdir = config.getTempdir(); multipartFormData = new MultipartFormData( MultipartFormDataParser.parse(input, getHeader("Content-Type"), characterEncoding)); } finally { input.close(); } } return multipartFormData.getParts(); }
@Override public Part getPart(String name) throws IOException, ServletException { if (multipartFormData == null) getParts(); return multipartFormData.getPart(name); }