Join date: May 14, 2022


Crysis 2 Trainer [2022]




Crysis 2 Category:Crytek games Category:Video game add-ons Category:Video game expansion packs Category:Video game trainers Category:Windows gamesQ: Java - How to use the HttpURLConnection and get the page content I am using this API in Java and would like to get the response as a page content, but I cannot find out how. In this case, I have a URL and I need to parse it. Any advice? public static String getTextFromURL(String url) throws IOException { URL u = new URL(url); HttpURLConnection connection = (HttpURLConnection) u.openConnection(); connection.connect(); // here I would like to get the content of the page InputStream is = connection.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(is)); String line; StringBuffer result = new StringBuffer(); while ((line = in.readLine())!= null) { result.append(line); } return result.toString(); } A: You have two choices: Use HTTP 1.1 instead of HTTP 1.0, it is easier to parse the response headers and you don't have to write your own string concatenation (simply add the two headers on each line) Use a library to parse the response The client doesn't need to send HTTP headers for this, only the browser does, so you only need to send a request to the url. You can either use a HttpClient that sends a web request and has a convenient way to parse the response or use the native Java sockets API (org.apache.http.




Crysis 2 Trainer [2022]

More actions