URL url = new URL(complURL);
String userInfo = url.getUserInfo();
if (userInfo == null || userInfo.split(":").length != 2)
throw new RemoteWorkspaceInitializationException(
"Fail remote initializetion : the user name or password not not specified : " + dataSourceUrl);
String userName = userInfo.split(":")[0];
String password = userInfo.split(":")[1];
HTTPConnection connection = new HTTPConnection(url);
connection.removeModule(CookieModule.class);
String realmName = getRealm(complURL);
connection.addBasicAuthorization(realmName, userName, password);
HTTPResponse resp = connection.Get(url.getFile());
result = resp.getText();
AuthorizationInfo.removeAuthorization(url.getHost(), url.getPort(), "Basic", realmName);
if (resp.getStatusCode() != HTTP_OK)
throw new RemoteWorkspaceInitializationException("Fail remote initializetion : " + result);
}
catch (ModuleException e)
{
throw new RemoteWorkspaceInitializationException(e.getMessage(), e);
}
catch (ParseException e)
{
throw new RemoteWorkspaceInitializationException(e.getMessage(), e);
}
catch (IOException e)
{
throw new RemoteWorkspaceInitializationException(e.getMessage(), e);
}
return result;
}