Expand my Community achievements bar.

Problems adding to fill, using file upload with a HttpServlet

Avatar

Level 2
Hello, <br /><br />I have a hard time trying to get the addToFill to work. <br /><br />Here the basic flow of problem:<br />I use a fill to get a list of files that have been uploaded to our file server. When adding a new file using the FileReference object on the front end, I point to a HttpServlet in the same WEB-INF where the assemblers are located, basically the same JVM.<br /><br />I am using the com.oreilly.servlet.multipart (cos.jar) code to handle the upload. The upload works very satisfactory.<br /><br />I would like to make the new uploaded file (when uploading is completed) appear in the fill list. Therefore I send in the POST header the fill credentials.<br /><br />In my HTTP servlet in the doPost I added the following lines of code:<br /><br />>long fileId = filePart.writeTo(output);<br />com.company.File file = com.company.File.makeNewInstance();<br />file.fileId = fileId;<br />DataServiceTransaction dtx = DataServiceTransaction.begin(false);<br />ArrayList<String> params = new ArrayList<String>();<br />params.add(parameters.get("category").toString());<br />params.add(parameters.get("genericId").toString());<br />params.add("false");<br />dtx.addItemToFill("file.destination", (List)params, 0, file);<br />dtx.commit();<br /><br />On the front end definition of the DataService I explicitely set the autoSyncEnabled to true.<br /><br />The result is that the newly uploaded fill is not added to the datagrid where the fill connects to. But when I refresh the fill manually, the new file does show up.<br /><br />Is there anything I do wrong?<br /><br />For completeness, I would like to add that the fill parameters as mentioned in the code above completely match the Assemblers fill method.<br /><br />Thanks for any help, <br /><br />-Rogier Doekes
0 Replies