28 lines
820 B
Java
28 lines
820 B
Java
import java.io.BufferedReader;
|
|
import java.io.InputStream;
|
|
import java.io.InputStreamReader;
|
|
import java.net.URL;
|
|
import java.net.URLConnection;
|
|
import java.util.Map;
|
|
|
|
public class Start {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
String urlStr = System.getProperty("url", "https://stash");
|
|
URL url = new URL(urlStr);
|
|
URLConnection conn = url.openConnection();
|
|
conn.connect();
|
|
@SuppressWarnings("rawtypes")
|
|
Map headerFields = conn.getHeaderFields();
|
|
System.out.println("Headerfields: " + headerFields);
|
|
|
|
InputStream in = conn.getInputStream();
|
|
System.out.println("Connection :" + conn);
|
|
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
|
|
|
while (reader.ready()) {
|
|
System.out.println(reader.readLine());
|
|
}
|
|
}
|
|
} |