protected PutMethod executePut(String uri, String string, String mediaType, String userName, String password)
throws Exception
{
HttpClient httpClient = new HttpClient();
httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(userName, password));
httpClient.getParams().setAuthenticationPreemptive(true);
PutMethod putMethod = new PutMethod(uri);
RequestEntity entity = new StringRequestEntity(string, mediaType, "UTF-8");
putMethod.setRequestEntity(entity);