0 Replies Latest reply on Dec 9, 2015 8:35 AM by magnoferreira

    How to get binary data from request?

    magnoferreira

      I have to customize ckeditor fileupload to a Seam 2.2.2 application due to a interface upgrade.

      I'm trying to do the simplest way but I'm missing something.

      First the editor plugin gives us a form exactly like this:

       

      <form enctype="multipart/form-data" method="POST" dir="ltr" lang="pt-br"

      action="/mile/filebrowserUploadUrl.seam?CKEditor=insertStructuredDocument%3AsummaryStructuredDocument&amp;CKEditorFuncNum=1&amp;langCode=pt-br">

      <label id="cke_290_label" for="cke_291_fileInput_input" style="display:none">Send</label>

      <input id="cke_291_fileInput_input" type="file" name="upload" size="38">

      </form>

       

      At the filebrowserUploadUrl I call a seam object to parse the request but I'm unable to do it.

      I tryed with apache fileUpload:

       

        DiskFileItemFactory factory = new DiskFileItemFactory();

        File repository = (File) request.getAttribute("javax.servlet.context.tempdir");

        factory.setRepository(repository);

        ServletFileUpload upload = new ServletFileUpload(factory);

        try  {

        List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);

        List<FileItem> items = upload.parseRequest(request);

       

      but the list is always empty,

      And also this way which didn't return what I expect

       

      HttpServletRequest request = ServletContexts.instance().getRequest();

        String encoding = "ISO-8859-1";

        String upload = request.getParameter("upload");

        byte[] uploadData = upload.getBytes(encoding);

       

      Somebody can help me?

      in time: I'm using Jboss eap 5.0.1