package com.sun; import java.io.*; import java.util.Properties; import java.net.*; import java.security.KeyStore; import javax.net.*; import javax.net.ssl.*; public class WebTest{ public static void main(String args[]) throws Exception{ System.out.println("Starting WebTest.."); try { //doPOST(); //first get updated list from update_since.cgi and then get in xml format by sending to xml.cgi //https://glassfish.dev.java.net/issues/xml.cgi?id=133%2C134 getUpdatedSince(); //doFirst(); }catch(Throwable e){ e.printStackTrace(); } } private static void doPOST(){ try{ // Construct data //String data = URLEncoder.encode("id", "UTF-8") + "=" + URLEncoder.encode("133", "UTF-8"); String data = URLEncoder.encode("loginID", "UTF-8") + "=" + URLEncoder.encode("ds122787", "UTF-8"); data += "&" + URLEncoder.encode("password", "UTF-8") + "=" + URLEncoder.encode("puram123", "UTF-8"); // Send data init(); //URL url = new URL("https://glassfish.dev.java.net/issues/xml.cgi"); URL url = new URL("https://www.dev.java.net/servlets/TLogin"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); // Get the response BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = rd.readLine()) != null) { System.out.println(line); } wr.close(); rd.close(); }catch(Throwable e){ e.printStackTrace(); } } private static void doFirst(){ try{ init(); URL url=new URL("https://glassfish.dev.java.net/servlets/ProjectIssues"); //https://glassfish.dev.java.net/issues/enter_bug.cgi?issue_type=DEFECT URLConnection conn = url.openConnection(); InputStream is = conn.getInputStream(); BufferedReader input = new BufferedReader(new InputStreamReader(is)); while(input.readLine()!=null) System.out.println(input.readLine()); }catch(Throwable e){ e.printStackTrace(); } } private static void init(){ System.getProperties().put( "proxySet", "true" ); System.getProperties().put( "proxyHost", "webcache.central.sun.com" ); System.getProperties().put( "proxyPort", "8080" ); } private static void doGET(){ try{ System.getProperties().put( "proxySet", "true" ); System.getProperties().put( "proxyHost", "webcache.central.sun.com" ); System.getProperties().put( "proxyPort", "8080" ); URL url=new URL("https://glassfish.dev.java.net/issues/show_bug.cgi?id=133"); //https://glassfish.dev.java.net/issues/buglist.cgi?issue_type=DEFECT&component=glassfish&subcomponent=other&issue_status=NEW&issue_status=STARTED&issue_status=REOPENED&version=9.0pe&email1=ds122787&emailtype1=exact&emailassigned_to1=1&email2=&emailtype2=exact&emailreporter2=1&issueidtype=include&issue_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&issue_file_loc=&issue_file_loc_type=substring&status_whiteboard=&status_whiteboard_type=substring&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&namedcmd=glassfish_bugs&newqueryname=&order=Issue+Number&Submit+query=Submit+query URLConnection conn = url.openConnection(); InputStream is = conn.getInputStream(); BufferedReader input = new BufferedReader(new InputStreamReader(is)); while(input.readLine()!=null) System.out.println(input.readLine()); is.close(); }catch(Throwable e){ e.printStackTrace(); } } private static void getUpdatedSince(){ try{ /** https://glassfish.dev.java.net/issues/updated_since.cgi?ts=YYYY-MM-DD%20HH:MM:SS * https://glassfish.dev.java.net/issues/updated_since.cgi?ts=YYYY-MM-DD%20HH:MM * https://glassfish.dev.java.net/issues/updated_since.cgi?ts=YYYY-MM-DD * https://glassfish.dev.java.net/issues/updated_since.cgi?ts=YYYY-MM*/ System.getProperties().put( "proxySet", "true" ); System.getProperties().put( "proxyHost", "webcache.central.sun.com" ); System.getProperties().put( "proxyPort", "8080" ); //URL url=new URL("https://glassfish.dev.java.net/issues/updated_since.cgi?ts=2006-01-19"); URL url=new URL("https://glassfish.dev.java.net/issues/xmlupdate.cgi?ts=2006-01-25"); //https://glassfish.dev.java.net/issues/xmlupdate.cgi?ts=YYYY-MM-DD%20HH:MM:SS //https://glassfish.dev.java.net/issues/xmlupdate.cgi?ts=YYYY-MM-DD%20HH:MM URLConnection conn = url.openConnection(); InputStream is = conn.getInputStream(); BufferedReader input = new BufferedReader(new InputStreamReader(is)); while(input.readLine()!=null) System.out.println(input.readLine()); is.close(); }catch(Throwable e){ e.printStackTrace(); } } }