Package org.apache.wicket.util.upload

Examples of org.apache.wicket.util.upload.FileItem


   *
   * @throws Exception
   */
  public void testGetInputStream() throws Exception
  {
    FileItem fileItem = new DiskFileItemFactory().createItem("dummyFieldName", "text/java",
      false, "FileUploadTest.java");
    // Initialize the upload
    fileItem.getOutputStream();

    // Get the internal list out
    Field inputStreamsField = FileUpload.class.getDeclaredField("inputStreamsToClose");
    inputStreamsField.setAccessible(true);

View Full Code Here


        {
          // iterate over the map and build the list of filenames

          final Entry<String, FileItem> entry = it.next();
          final String name = entry.getKey();
          final FileItem item = entry.getValue();

          if (!Strings.isEmpty(name) &&
            name.startsWith(getInputName() + MAGIC_SEPARATOR) &&
            !Strings.isEmpty(item.getName()))
          {

            // make sure the fileitem belongs to this component and
            // is not empty
View Full Code Here

  @Test
  public void getInputStream() throws Exception
  {
    IFileCleaner fileUploadCleaner = new FileCleaner();

    FileItem fileItem = new DiskFileItemFactory(fileUploadCleaner).createItem("dummyFieldName",
      "text/java", false, "FileUploadTest.java");
    // Initialize the upload
    fileItem.getOutputStream();

    // Get the internal list out
    Field inputStreamsField = FileUpload.class.getDeclaredField("inputStreamsToClose");
    inputStreamsField.setAccessible(true);
View Full Code Here

        for (Entry<String, FileItem> entry : itemNameToItem.entrySet())
        {
          // iterate over the map and build the list of filenames

          final String name = entry.getKey();
          final FileItem item = entry.getValue();

          if (!Strings.isEmpty(name) &&
            name.startsWith(getInputName() + MAGIC_SEPARATOR) &&
            !Strings.isEmpty(item.getName()))
          {

            // make sure the fileitem belongs to this component and
            // is not empty
View Full Code Here

    // If we successfully installed a multipart request
    if (request instanceof IMultipartWebRequest)
    {
      // Get the item for the path
      final FileItem item = ((IMultipartWebRequest)request).getFile(getInputName());

      // Only update the model when there is a file (larger than zero
      // bytes)
      if (item != null && item.getSize() > 0)
      {
        if (fileUpload == null)
        {
          fileUpload = new FileUpload(item);
        }
View Full Code Here

        {
          // iterate over the map and build the list of filenames

          final Entry<String, FileItem> entry = it.next();
          final String name = entry.getKey();
          final FileItem item = entry.getValue();

          if (!Strings.isEmpty(name) &&
            name.startsWith(getInputName() + MAGIC_SEPARATOR) &&
            !Strings.isEmpty(item.getName()))
          {

            // make sure the fileitem belongs to this component and
            // is not empty
View Full Code Here

        {
          // iterate over the map and build the list of filenames

          final Entry<String, FileItem> entry = it.next();
          final String name = entry.getKey();
          final FileItem item = entry.getValue();

          if (!Strings.isEmpty(name) &&
            name.startsWith(getInputName() + MAGIC_SEPARATOR) &&
            !Strings.isEmpty(item.getName()))
          {

            // make sure the fileitem belongs to this component and
            // is not empty
View Full Code Here

      String contentType = method.getResponseHeader("Content-Type").getValue();
      String name = url.getPath();
      boolean isFormField = true;

      DiskFileItemFactory factory = new DiskFileItemFactory();
      FileItem fileItem = factory.createItem(fieldName, contentType, isFormField, name);
      IOUtils.copy(method.getResponseBodyAsStream(), fileItem.getOutputStream());

      return new PulledFileUpload(url, fileItem);
    } catch (MalformedURLException e) {
      ConversionException ex = new ConversionException("Can't convert " + value + " into a URL.", e);
      ex.setConverter(this);
View Full Code Here

        {
          // iterate over the map and build the list of filenames

          final Entry entry = (Entry)it.next();
          final String name = (String)entry.getKey();
          final FileItem item = (FileItem)entry.getValue();

          if (!Strings.isEmpty(name) &&
              name.startsWith(getInputName() + MAGIC_SEPARATOR) &&
              !Strings.isEmpty(item.getName()))
          {

            // make sure the fileitem belongs to this component and
            // is not empty
View Full Code Here

        {
          // iterate over the map and build the list of filenames

          final Entry entry = (Entry)it.next();
          final String name = (String)entry.getKey();
          final FileItem item = (FileItem)entry.getValue();

          if (!Strings.isEmpty(name) && name.startsWith(getInputName() + MAGIC_SEPARATOR)
              && !Strings.isEmpty(item.getName()))
          {

            // make sure the fileitem belongs to this component and
            // is not empty
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.upload.FileItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.