Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code> // Enable HTTP parameters HttpParams sslparams = new BasicHttpParams(); HttpProtocolParams.setVersion(sslparams, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(sslparams, HTTP.UTF_8); // Register the HTTP and HTTPS Protocols. For HTTPS, register our custom SSL Factory object. SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); registry.register(new Scheme("https",sslFactory, 443)); // Create a new connection manager using the newly created registry and then create a new HTTP client // using this connection manager ClientConnectionManager ccm = new ThreadSafeClientConnManager(sslparams, registry); httpclient = new DefaultHttpClient(ccm,sslparams); HttpPost httppost = new HttpPost(url); /*httppost.setEntity(new UrlEncodedFormEntity(nameValue)); httppost.setEntity(new InputStreamEntity(new FileInputStream(file), file.length())); httppost.setHeader("Content-Type", "application/x-www-form-urlencoded");*/ MultipartEntity entity = new MultipartEntity(); //entity.addPart("fileName",); entity.addPart("file", new InputStreamBody(new FileInputStream(file), ContentType.APPLICATION_OCTET_STREAM)); entity.addPart("UserID", new StringBody(parameter.getUsreId())); entity.addPart("UserName",new StringBody(parameter.getUserName())); entity.addPart("HostName", new StringBody(parameter.getHostName())); entity.addPart("ProtectionType", new StringBody(parameter.getProtectionType())); entity.addPart("FolderPath", new StringBody(parameter.getFolderPath())); entity.addPart("osid", new StringBody(parameter.getOsId())); //entity.addPart("file", new FileBody(file,ContentType.MULTIPART_FORM_DATA)); httppost.setEntity(entity); //httppost.setEntity(new StringEntity(file)); //httppost.setHeader("Content-Type", "text/xml"); HttpParams httpparams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpparams, 15000); HttpConnectionParams.setSoTimeout(httpparams, 30000); httppost.setParams(httpparams); HttpResponse response = httpclient.execute(httppost); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload