Ejemplo n.º 1
0
 Response doSend() throws IOException {
   connection.setRequestMethod(this.verb.name());
   if (connectTimeout != null) {
     connection.setConnectTimeout(connectTimeout.intValue());
   }
   if (readTimeout != null) {
     connection.setReadTimeout(readTimeout.intValue());
   }
   if (boundary != null) {
     connection.setRequestProperty(CONTENT_TYPE, "multipart/form-data; boundary=" + boundary);
   }
   addHeaders(connection);
   if (verb.equals(Verb.PUT) || verb.equals(Verb.POST)) {
     addBody(connection, getByteBodyContents());
   }
   return new Response(connection);
 }
Ejemplo n.º 2
0
 Response doSend(RequestTuner tuner) throws IOException
 {
   connection.setRequestMethod(this.verb.name());
   if (connectTimeout != null) 
   {
     connection.setConnectTimeout(connectTimeout.intValue());
   }
   if (readTimeout != null)
   {
     connection.setReadTimeout(readTimeout.intValue());
   }
   tuner.tune(this);
   addHeaders(connection);
   if (verb.equals(Verb.PUT) || verb.equals(Verb.POST))
   {
     addBody(connection, getByteBodyContents());
   }
   return new Response(connection);
 }