public FileItemIterator getItemIterator(IHTTPSession session) throws FileUploadException, IOException { return super.getItemIterator(new NanoHttpdContext(session)); }
/** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> * compliant <code>multipart/form-data</code> stream. * * @param request The servlet request to be parsed. * * @return An iterator to instances of <code>FileItemStream</code> * parsed from the request, in the order that they were * transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * @throws IOException An I/O error occurred. This may be a network * error while communicating with the client or a problem while * storing the uploaded content. */ public FileItemIterator getItemIterator(HttpServletRequest request) throws FileUploadException, IOException { return super.getItemIterator(new ServletRequestContext(request)); }
/** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> * compliant <code>multipart/form-data</code> stream. * * @param request The portlet request to be parsed. * * @return An iterator to instances of <code>FileItemStream</code> * parsed from the request, in the order that they were * transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * @throws IOException An I/O error occurred. This may be a network * error while communicating with the client or a problem while * storing the uploaded content. */ public FileItemIterator getItemIterator(ActionRequest request) throws FileUploadException, IOException { return super.getItemIterator(new PortletRequestContext(request)); }
protected void parseRequest(MultipartFormData multipartFormData, FileUpload fileUpload, RestMultipartRequestContext requestContext) { try { FileItemIterator itemIterator = fileUpload.getItemIterator(requestContext); while (itemIterator.hasNext()) { FileItemStream stream = itemIterator.next(); multipartFormData.addPart(new FormPart(stream)); } } catch (Exception e) { throw new RestException(Status.BAD_REQUEST, e, "multipart/form-data cannot be processed"); } }
protected void parseRequest(MultipartFormData multipartFormData, FileUpload fileUpload, RestMultipartRequestContext requestContext) { try { FileItemIterator itemIterator = fileUpload.getItemIterator(requestContext); while (itemIterator.hasNext()) { FileItemStream stream = itemIterator.next(); multipartFormData.addPart(new FormPart(stream)); } } catch (Exception e) { throw new RestException(Status.BAD_REQUEST, e, "multipart/form-data cannot be processed"); } }
/** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> * compliant <code>multipart/form-data</code> stream. * * @param request The portlet request to be parsed. * * @return An iterator to instances of <code>FileItemStream</code> * parsed from the request, in the order that they were * transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * @throws IOException An I/O error occurred. This may be a network * error while communicating with the client or a problem while * storing the uploaded content. */ public FileItemIterator getItemIterator(ActionRequest request) throws FileUploadException, IOException { return super.getItemIterator(new PortletRequestContext(request)); }
/** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> * compliant <code>multipart/form-data</code> stream. * * @param request The portlet request to be parsed. * * @return An iterator to instances of <code>FileItemStream</code> * parsed from the request, in the order that they were * transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * @throws IOException An I/O error occurred. This may be a network * error while communicating with the client or a problem while * storing the uploaded content. */ public FileItemIterator getItemIterator(ActionRequest request) throws FileUploadException, IOException { return super.getItemIterator(new PortletRequestContext(request)); } }
/** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> * compliant <code>multipart/form-data</code> stream. * * @param request The servlet request to be parsed. * * @return An iterator to instances of <code>FileItemStream</code> * parsed from the request, in the order that they were * transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * @throws IOException An I/O error occurred. This may be a network * error while communicating with the client or a problem while * storing the uploaded content. */ public FileItemIterator getItemIterator(HttpServletRequest request) throws FileUploadException, IOException { return super.getItemIterator(new ServletRequestContext(request)); } }
/** * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a> * compliant <code>multipart/form-data</code> stream. * * @param request The servlet request to be parsed. * * @return An iterator to instances of <code>FileItemStream</code> * parsed from the request, in the order that they were * transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * @throws IOException An I/O error occurred. This may be a network * error while communicating with the client or a problem while * storing the uploaded content. */ public FileItemIterator getItemIterator(HttpServletRequest request) throws FileUploadException, IOException { return super.getItemIterator(new ServletRequestContext(request)); }
protected void parseRequest(MultipartFormData multipartFormData, FileUpload fileUpload, RestMultipartRequestContext requestContext) { try { FileItemIterator itemIterator = fileUpload.getItemIterator(requestContext); while (itemIterator.hasNext()) { FileItemStream stream = itemIterator.next(); multipartFormData.addPart(new FormPart(stream)); } } catch (Exception e) { throw new RestException(Status.BAD_REQUEST, e, "multipart/form-data cannot be processed"); } }
void extractParameters(Request req, Map<String, List<String>> formFields, Map<String, MultipartFile> fileFields) { try { ThundrRequestContext context = new ThundrRequestContext(req); FileItemIterator itemIterator = upload.getItemIterator(context); while (itemIterator.hasNext()) { FileItemStream item = itemIterator.next(); InputStream stream = item.openStream(); String fieldName = item.getFieldName(); if (item.isFormField()) { List<String> existing = formFields.get(fieldName); if (existing == null) { existing = new LinkedList<String>(); formFields.put(fieldName, existing); } existing.add(Streams.readString(stream)); } else { MultipartFile file = new MultipartFile(item.getName(), Streams.readBytes(stream), item.getContentType()); fileFields.put(fieldName, file); } // stream.close(); } } catch (MalformedStreamException e) { Logger.warn("Recieved a malformed multipart stream - data may be missing or unbound, continuing with the request anyway. Error message: %s", e.getMessage()); } catch (Exception e) { throw new BindException(e, "Failed to bind multipart form data: %s", e.getMessage()); } }
void extractParameters(Request req, Map<String, List<String>> formFields, Map<String, MultipartFile> fileFields) { try { ThundrRequestContext context = new ThundrRequestContext(req); FileItemIterator itemIterator = upload.getItemIterator(context); while (itemIterator.hasNext()) { FileItemStream item = itemIterator.next(); InputStream stream = item.openStream(); String fieldName = item.getFieldName(); if (item.isFormField()) { List<String> existing = formFields.get(fieldName); if (existing == null) { existing = new LinkedList<String>(); formFields.put(fieldName, existing); } existing.add(Streams.readString(stream)); } else { MultipartFile file = new MultipartFile(item.getName(), Streams.readBytes(stream), item.getContentType()); fileFields.put(fieldName, file); } // stream.close(); } } catch (MalformedStreamException e) { Logger.warn("Recieved a malformed multipart stream - data may be missing or unbound, continuing with the request anyway. Error message: %s", e.getMessage()); } catch (Exception e) { throw new BindException(e, "Failed to bind multipart form data: %s", e.getMessage()); } }
FileItemIterator fileItemIterator; try { fileItemIterator = fu.getItemIterator(new MessageBodyReaderContext(entityStream, mediaType)); while(fileItemIterator.hasNext()){ FileItemStream fis = fileItemIterator.next();
FileItemIterator fileItemIterator; try { fileItemIterator = fu.getItemIterator(new MessageBodyReaderContext(entityStream, mediaType)); while(fileItemIterator.hasNext()){ FileItemStream fis = fileItemIterator.next();
log.debug(" - multiple (alternate) ContentParts"); FileItemIterator contentPartIterator = fu.getItemIterator( new MessageBodyReaderContext( content.openStream(), partContentType));
log.debug(" - multiple (alternate) ContentParts"); FileItemIterator contentPartIterator = fu.getItemIterator( new MessageBodyReaderContext( content.openStream(), partContentType));
.getItemIterator(new ServletRequestContext(request));
.getItemIterator(new PortletRequestContext(request));