Package org.apache.commons.fileupload

Examples of org.apache.commons.fileupload.FileItemStream.openStream()


           
            FileItemIterator iter = upload.getItemIterator(request);
            while (iter.hasNext()) {
                FileItemStream item = iter.next();
                String fieldName = item.getFieldName();
                InputStream stream = item.openStream();
                if (item.isFormField())
                {
                    // Graph name.
                    String value = Streams.asString(stream, "UTF-8") ;
                    if ( fieldName.equals(HttpNames.paramGraph) )
View Full Code Here


            List<UploadContext> uploadContexts = new ArrayList<UploadContext>(7);
            List<NamedString> formParameters = new ArrayList<NamedString>(7);
            while (iter.hasNext())
            {
               FileItemStream item = iter.next();
               InputStream stream = item.openStream();
               if (!item.isFormField())
               {
                  String contentType = item.getContentType();
                  if (debug)
                  {
View Full Code Here

    } catch (FileUploadException fue) {
      output.println("Bad servlet next!");
      System.out.println("Bad out next!");
      fue.printStackTrace();
    }
    InputStream in = item.openStream();
    //output.println(in.toString());
    BufferedReader input = new BufferedReader(new InputStreamReader(in));
   
    //output.println(input.toString());
    //String line;
View Full Code Here

          log.warning("Got a form field: " + item.getFieldName());
        } else {
          log.warning("Got an uploaded file: " + item.getFieldName() + ", name = " + item.getName());

          // System.out.println("got " + item.getContentType() + " " + item.getName());
          store.createPlugin(new PluginDescription(item.getName(), ""), item.openStream());
        }
      }
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
View Full Code Here

    PrintWriter outp = res.getWriter();

    FileItemIterator iterator = upload.getItemIterator(req);
    while (iterator.hasNext()) {
      FileItemStream item = iterator.next();
      InputStream stream = item.openStream();

      if (!item.isFormField()) {
      Validator validator = new Validator();

      Model model =
View Full Code Here

              FileItem fileItem = fileFactory.createItem(item.getFieldName(),
                      item.getContentType(), item.isFormField(),
                      overrideFilename, authenticated.getScreenName());
              LOG.finest("Writing to file: "+((GEDCOMFileItem)fileItem).getFullPath());
              try {
                  Streams.copy(item.openStream(), fileItem.getOutputStream(),
                          true);
              } catch (IOException e) {
                  throw new IOException(
                          "Processing of " + FileUploadBase.MULTIPART_FORM_DATA
                          + " request failed. " + e.getMessage());
View Full Code Here

        try {
            iterator = upload.getItemIterator(request);

            while (iterator.hasNext()) {
                final FileItemStream item = iterator.next();
                final InputStream stream = item.openStream();

                final JSONObject preference = preferenceUtils.getPreference();
                if (null == preference) {
                    response.sendError(HttpServletResponse.SC_NOT_FOUND);
                    return;
View Full Code Here

                     item.getContentType(), item.isFormField(),
                     item.getName())
             );
             try {
               MessageDigestInputStream in = new MessageDigestInputStream(
                   item.openStream(), algorithm);
                 Streams.copy(in, fileItem.getOutputStream(), true);
                
                 fileItem.setDigest(in.getDigest());
             } catch (FileUploadIOException e) {
                 throw (FileUploadException) e.getCause();
View Full Code Here

            FileItemIterator iter = upload.getItemIterator(request);

            while (iter.hasNext()) {
                FileItemStream item = iter.next();
                String name = item.getFieldName();
                InputStream itemStream = new BufferedInputStream(item.openStream());

                if (item.isFormField()) {
                    InputStreamReader reader = new InputStreamReader(itemStream, "UTF-8");

                    try {
View Full Code Here

            while (it.hasNext()) {
                FileItemStream item = it.next();
                if (item.isFormField()) {
                    InputStream input = null;
                    try {
                        input = item.openStream();
                        String fieldName = item.getFieldName();
                        String encode = request.getCharacterEncoding();
                        String fieldValue = encode==null ? Streams.asString(input) : Streams.asString(input, encode);
                        addFormItem(fieldName, fieldValue);
                    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.