When an HTTP server sends the contents of a document to a client in a response body, it uses the Content-Length header line to specify the byte length of the body. For static documents, the byte length is provided by the file system. But for dynamically generated Web pages, such as those generated by a CGI script, the length must be determined at run time, on the fly.
a)For a dynamically generated Web page, how can the server come up with the content length specified in the Content-Length header? Remember that header lines appear before the body in a HTTP RESPONSE.
b)Look up how HTTP/1.1 address this problem and summarize what you found.
Open a directory on your PC to obtain the files in the servletssimple folder. Compile HelloWorld.java and Counter2.java. Then file them into the designated servlets class directory. (On the Apache Tomcat Server, the default servlet class directory is TOMCAT_HOMEwebappsexamplesWEB-INFclasses.)
a)User the browser to run the HelloWorld servlet.
b)To see that servlets can be run on a server host other than your localhost, use the browser on your system to run the HelloWorld servlet on your instructors system or your neighbors system.
c)Compile the Counter1.java file, and install the resulting class file Counter1.class to the < servlet class file directory>. Then browse to it using the
d)Open another browser and browse to the Counter1 servlet. Describe and explain the counter value displayed by the browser.