Question: Write a Java program that serves as a primitive web browser. For this assignment it merely needs to input a server name and display the

Write a Java program that serves as a primitive web browser. For this assignment it merely needs to input a server name and display the HTML that is sent by the web server. A web server normally listens on port 80. Upon connection the server expects to be sent a string that identifies what web page to receive (use / for the root) and what protocol is used. The next line is the Host and then a blank line. For example, to get the default page on Wikipedia the Java program would connect to port 80 and send:

GET / HTTP/1.1
Host: www.wikipedia.org
(blank line)


The Wikipedia server would then send back the HTML for the site which your program should display in text. For a more challenging program, parse and render the HTML in a human-friendly format instead of printing out the raw HTML.

Step by Step Solution

3.23 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public class Browser public static void mainString args Stri... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java An Introduction to Problem Solving and Progra Questions!