How can i get a auth through my java code
my java code is :
public static void main(String[] args) {
try {
String urlStr="https://nsjazz.raleigh.ibm.com:8017/jazz/oslc/contexts/_6Lg3ID0CEd-HhfkZ2zavEQ/workitems.xml?oslc_cm.query=oslc_cm%3AsearchTerms%3D%22Test%20fetch%20TTT%20data%20based%20on%20Domino%20on%20Windows%22&oslc_cm.properties=dc:identifier,dc:title,rtc_cm:ownedBy{dc:title}";
URL url=new URL(urlStr);
String theUsername="luxianan@cn.ibm.com";
String thePassword="summer8765";
String userPassword=theUsername + ":" + thePassword;
String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
URLConnection uc = url.openConnection();
uc.setRequestProperty ("Authorization", "Basic " + encoding);
InputStream content=(InputStream)uc.getInputStream();
BufferedReader in=new BufferedReader(new InputStreamReader(content));
String line;
while((line=in.readLine())!=null){
System.out.println(line);
}
} catch (Exception e) {
e.printStackTrace();
}
but i could not get the page info from the url,why?
public static void main(String[] args) {
try {
String urlStr="https://nsjazz.raleigh.ibm.com:8017/jazz/oslc/contexts/_6Lg3ID0CEd-HhfkZ2zavEQ/workitems.xml?oslc_cm.query=oslc_cm%3AsearchTerms%3D%22Test%20fetch%20TTT%20data%20based%20on%20Domino%20on%20Windows%22&oslc_cm.properties=dc:identifier,dc:title,rtc_cm:ownedBy{dc:title}";
URL url=new URL(urlStr);
String theUsername="luxianan@cn.ibm.com";
String thePassword="summer8765";
String userPassword=theUsername + ":" + thePassword;
String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
URLConnection uc = url.openConnection();
uc.setRequestProperty ("Authorization", "Basic " + encoding);
InputStream content=(InputStream)uc.getInputStream();
BufferedReader in=new BufferedReader(new InputStreamReader(content));
String line;
while((line=in.readLine())!=null){
System.out.println(line);
}
} catch (Exception e) {
e.printStackTrace();
}
but i could not get the page info from the url,why?