0

I'm submitting html form from java applet by setting the hidden element to bytes converted to BASE64 read from local filepath.

DataInputStream dataInputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(filePath)));
    dataInputStream.readFully(bytes);
String base64_str = Base64Utils.base64Encode(bytes);
JSObject mainForm = (JSObject)browserWindow.eval("document.myform");
JSObject Field = (JSObject)mainForm.getMember(FieldName);
Field.setMember("value", base64_str);

Here when file being read is around 1.5Mb it works okay, but above that exception java.lang.OutOfMemoryError is issued.

I am using HTML to submit file to use the browser session and to avoid steps to upload the file which is being preprocessed within applet first.

What is the maximum limit I can read the file into string and set hidden field? How do I increase the memory of the applet?

rtan
  • 55
  • 8
  • I am not sure about this ,but this might help you [http://stackoverflow.com/questions/102003/how-can-i-start-an-java-applet-with-more-memory][1] [1]: http://stackoverflow.com/questions/102003/how-can-i-start-an-java-applet-with-more-memory – Sunil Kumar Sep 23 '14 at 04:45
  • @rtan are you using session object for uploading the file? – Vishrant Sep 23 '14 at 04:53
  • Session is created when user logged in and then the page with applet is displayed. No additional session within applet is created as applet does not communicate with server but through form element. – rtan Sep 23 '14 at 07:21

0 Answers0