Ejemplo n.º 1
0
 /* (non-Javadoc)
  * This method is overridden in order to write the optional recordId|carenetId to the request output.
  *
  * @see oauth.signpost.basic.DefaultOAuthProvider#sendRequest(oauth.signpost.http.HttpRequest)
  */
 protected HttpResponse sendRequest(HttpRequest request) throws IOException {
   HttpURLConnection connection = (HttpURLConnection) request.unwrap();
   // if a shared recordId is defined, it has to be written in the request output
   if (this.sharedRecordId != null) {
     // write the recordId to the request output
     String indivoRecordId;
     if (this.sharedRecordId.isCarenet()) indivoRecordId = PARAM_INDIVO_CARENET_ID;
     else indivoRecordId = PARAM_INDIVO_RECORD_ID;
     indivoRecordId += "=" + this.sharedRecordId.getId();
     connection.setRequestProperty(
         TransportManager.PROPERTY_CONTENT_TYPE, TransportManager.CONTENT_TYPE_TEXT_PLAIN);
     connection.setDoOutput(true);
     OutputStream os = connection.getOutputStream();
     os.write(indivoRecordId.getBytes());
     os.close();
   }
   connection.connect();
   return new HttpURLConnectionResponseAdapter(connection);
 }
 @Override
 protected HttpResponse sendRequest(HttpRequest request) throws Exception {
   Response response = okHttpClient.newCall((Request) request.unwrap()).execute();
   return new OkHttpResponseAdapter(response);
 }