2 Replies Latest reply on Dec 2, 2011 1:05 AM by silni

    How to handle external POST data?

    mikko_lehtinen

      I'm trying to receive uploaded file coming from external page in my Seam app:



      HttpServletRequest = request(HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
      
      log.info("req:" +request.getContentLength() + "," + request.getInputStream().read());
      



      The problem is that request.getInputStream().read() always returns -1, parameters contentLength and such I can read fine from the request. Any ideas?


      This is the form data:


      <html>
      <body>
      <form method="POST" enctype="multipart/form-data" name="image_upload_form" action="http://myserver/myMethod">
      <p><input type="file" name="image_file" size="20"></p>
      <p><input type="submit" value="Upload Image" name="action"></p>
      </form>
      </body>
      </html>