Assignment: Client server java program to Run- Tutor-marked Exercise: Proxy Server
Overview
A proxy server is a network server that acts as a proxy for some other real server. Many websites with a firewall have a proxy server to provide a legitimate means to go through the network barrier. The proxy server thus is a mediator between the server and the clients. It forwards a client's request to the server and relays the server's reply to the original client. Therefore, to the client, the proxy looks like the server. To the real server, the proxy looks like a client.
For this assignment, you must implement an Internet resource retriever to act as a client and to make requests to a server, including the basic Web server you have implemented. The basic Web server's task is to deliver resources to the client. The client requests a particular resource by writing an HTTP GET (or similar) request. On receiving a legitimate request in the form of a URL path, the server should return the contents of the corresponding file so that the client can read the response from the server via the proxy server. When networking facilities are available, the basic Web server (or any other server) can be executed on one machine and the client can be executed on another to make requests to the server. When networking facilities are not available, both the basic Web server and the client may be executed on the same machine. The client may refer to the server host by the standard name localhost.
Requirements
Tutor-marked Exercise (TME) 1 requires that you develop three programs: one for a client, one for a basic Web server, and one for a proxy server.
A proxy server is a special-purpose HTTP server; it is the core application for this project. The proxy server has two socket connections. It "listens" for communication from clients through one and launches requests to specific Web servers through the other. In this exercise you should use a thread in the proxy server so that it is able to send and receive messages simultaneously to and from the server/client.
A basic Web server can deal with requests for resources from a client. It is necessary to have a Web server return messages to a client such as 404 - not found; 403 - bad request; etc., as appropriate. If the resource requested is available, which means that the resource can be found on the disk of the Web server, the Web server needs to read the resource and write the data to the socket. For example, a Web server may find an HTML file or a JPEG (image) file on its disk and transfer the data to the socket.
The client basically needs access to the function that allows the user to input the resource URL that identifies the resource s/he wants to access. However, the client has to access the resource by sending a request to the proxy server, and then the client must receive the resource from the proxy server. No matter what kind of data the client receives, the client only needs to print it on the screen. Note that where the response from a server is an HTML file, a typical Web browser will render it according to HTML semantics. This functionality is not considered in this exercise.
Note: Your tutor may use resource URLs other than those for the basic Web server (e.g., Java tutorial Web pages and public FTP files).
To test your basic Web server's function you can simply use an HTML file named testfile.html and a JPG file name testfile.jpg with Microsoft Internet Explorer or Mozilla Firefox.
Deliverables
Your assignment must be zipped into one file and uploaded using the Assignment Drop Box feature of Moodle. The file must include
• all source files.
• a complete test plan.