It's all about the answers!

Ask a question

How can i get a auth through my java code


lu xianan (111) | asked Aug 24 '10, 4:05 a.m.
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?

Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.