/** * 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 A map of <code>FileItem</code> instances parsed from the request. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * * @since 1.3 */ public Map<String, List<FileItem>> parseParameterMap(ActionRequest request) throws FileUploadException { return parseParameterMap(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 A list of <code>FileItem</code> instances parsed from the * request, in the order that they were transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. */ public List<FileItem> parseRequest(ActionRequest request) throws FileUploadException { return parseRequest(new PortletRequestContext(request)); }
/** * Returns a string representation of this object. * * @return a string representation of this object. */ @Override public String toString() { return format("ContentLength=%s, ContentType=%s", Long.valueOf(this.contentLength()), this.getContentType()); }
/** * Return a list of {@link FileUpload} implementations for parameterized tests. * @return a list of {@link FileUpload} implementations */ public static List<FileUpload> fileUploadImplementations() { return Arrays.asList( new ServletFileUpload(new DiskFileItemFactory()), new PortletFileUpload(new DiskFileItemFactory())); } }
public boolean isMultipart(ActionRequest request) { return (request != null && PortletFileUpload.isMultipartContent(request)); }
/** * Utility method that determines whether the request contains multipart * content. * * @param request The portlet request to be evaluated. Must be non-null. * * @return <code>true</code> if the request is multipart; * <code>false</code> otherwise. */ public static final boolean isMultipartContent(ActionRequest request) { return FileUploadBase.isMultipartContent( new PortletRequestContext(request)); }
"-----1234--\r\n"; byte[] bytes = text.getBytes("US-ASCII"); ActionRequest request = new MockPortletActionRequest(bytes, Constants.CONTENT_TYPE); Map<String, List<FileItem>> mappedParameters = upload.parseParameterMap(request); assertTrue(mappedParameters.containsKey("file")); assertEquals(1, mappedParameters.get("file").size());
/** * Returns a string representation of this object. * * @return a string representation of this object. */ public String toString() { return "ContentLength=" + this.getContentLength() + ", ContentType=" + this.getContentType(); }
/** * 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 A list of <code>FileItem</code> instances parsed from the * request, in the order that they were transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. */ public List /* FileItem */ parseRequest(ActionRequest request) throws FileUploadException { return parseRequest(new PortletRequestContext(request)); }
@Before public void setUp() { upload = new PortletFileUpload(new DiskFileItemFactory()); }
public static boolean isMultipartContent(Object request) { if (request instanceof ActionRequest) { return PortletFileUpload.isMultipartContent((ActionRequest)request); } else { return false; } }
/** * 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 A map of <code>FileItem</code> instances parsed from the request. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. * * @since 1.3 */ public Map<String, List<FileItem>> parseParameterMap(ActionRequest request) throws FileUploadException { return parseParameterMap(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 portlet request to be parsed. * * @return A list of <code>FileItem</code> instances parsed from the * request, in the order that they were transmitted. * * @throws FileUploadException if there are problems reading/parsing * the request or storing files. */ public List<FileItem> parseRequest(ActionRequest request) throws FileUploadException { return parseRequest(new PortletRequestContext(request)); }
/** * Initialize the underlying {@code org.apache.commons.fileupload.portlet.PortletFileUpload} * instance. Can be overridden to use a custom subclass, e.g. for testing purposes. * @return the new PortletFileUpload instance */ @Override protected FileUpload newFileUpload(FileItemFactory fileItemFactory) { return new PortletFileUpload(fileItemFactory); }
@Override public boolean isMultipart(ActionRequest request) { return (request != null && PortletFileUpload.isMultipartContent(request)); }
/** * Utility method that determines whether the request contains multipart * content. * * @param request The portlet request to be evaluated. Must be non-null. * * @return <code>true</code> if the request is multipart; * <code>false</code> otherwise. */ public static final boolean isMultipartContent(ActionRequest request) { return FileUploadBase.isMultipartContent( new PortletRequestContext(request)); }
/** * Initialize the underlying <code>org.apache.commons.fileupload.portlet.PortletFileUpload</code> * instance. Can be overridden to use a custom subclass, e.g. for testing purposes. * @return the new PortletFileUpload instance */ @Override protected FileUpload newFileUpload(FileItemFactory fileItemFactory) { return new PortletFileUpload(fileItemFactory); }
/** * Utility method that determines whether the request contains multipart * content. * * @param request The portlet request to be evaluated. Must be non-null. * * @return <code>true</code> if the request is multipart; * <code>false</code> otherwise. */ public static final boolean isMultipartContent(ActionRequest request) { return FileUploadBase.isMultipartContent( 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)); }