例を見つけました
try {
String data = "YOUR REQUEST BODY HERE";
//
CredentialsProvider credProvider = new BasicCredentialsProvider();
credProvider.setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
new UsernamePasswordCredentials("YOUR USER NAME HERE", "YOUR PASSWORD HERE"));
//
DefaultHttpClient http = new DefaultHttpClient();
http.setCredentialsProvider(credProvider);
//
HttpPut put = new HttpPut("YOUR HTTPS URL HERE");
try {
put.setEntity(new StringEntity(data, "UTF8"));
} catch (UnsupportedEncodingException e) {
Log.e(TAG, "UnsupportedEncoding: ", e);
}
put.addHeader("Content-type","SET CONTENT TYPE HERE IF YOU NEED TO");
HttpResponse response = http.execute(put);
Log.d(TAG, "This is what we get back:"+response.getStatusLine().toString()+", "+response.getEntity().toString());
} catch (ClientProtocolException e) {
//
Log.d(TAG, "Client protocol exception", e);
} catch (IOException e) {
//
Log.d(TAG, "IOException", e);
}
ただし、認証の形式で文字列を送信する必要があります。<Login>@<ID>:<Passsword>
これを行う方法?