Could somebody confirm that the smart service HTTP File Upload uses by default a

Could somebody confirm that the smart service HTTP File Upload uses by default as the content type of POST requests "multipart/form-data"?
If that is so, how could I change the content-type to "application/x-www-form-urlencoded"? Passing it as a part of a header parameter seems to be ignored.
In fact, all I want to do is the equivalent of the following Java code (that is, the only thing written into the body of the request are the bytes of the file):

File fileToUpload = new File("test.doc");
                              
String url = "localhost:8080/les-services/HttpContentHandler.ashx?token=" +
                                                  authenticationToken + "&contextID=" + contextID + "&fileName=test.doc" +
                                                  "&fileSize=" + fileToUpload.length();                                                            
                              
                    URL obj = new URL(url);
                    con = (HttpURLConnection) obj.openConnection();
                                         
                    con.setDoOutput(true);
                    con.setRequestProperty("User-Agent", "Mozilla/5.0");
                    con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");          
                              
                    PrintWriter wr = new...

OriginalPostID-151025

OriginalPostID-151025

  Discussion posts and replies are publicly visible

Parents
  • I am still not clear on what my problem is. What I think is that the server handler takes everything written on the request body as the contents of the file so I end up with header information on the uploaded file and thus it is corrupted. Since the handler takes all the required parameters from the URI, I do not need to write anything on the request body besides the file bytes. But the smart service does not give me this flexibility, it appears, which of course I have with pure Java code.
Reply
  • I am still not clear on what my problem is. What I think is that the server handler takes everything written on the request body as the contents of the file so I end up with header information on the uploaded file and thus it is corrupted. Since the handler takes all the required parameters from the URI, I do not need to write anything on the request body besides the file bytes. But the smart service does not give me this flexibility, it appears, which of course I have with pure Java code.
Children
No Data