CGS4825 Assignment 2
Section 01: Due 2/3 at 11:59 pm.
Section 02: Due 2/4 at 11:59 pm.
Create a new web app named hw2.
-
Create a link in the ROOT/index.html to the root of this context.
-
Use the secure web.xml file. Edit it for your user name.
-
Copy the downey.jar file into the
lib directory of this web app.
-
Edit the .cshrc file on ocelot, and add a path to the classes
directory of this web app. Also add a path to the downey.jar file.
Then run the command
source ~/.cshrc
-
Once you have created the web app structure, add the web app to your
host using your manager.
-
Under
Deploy
, type hw2 into the WAR or
Directory URL
edit box, then click Deploy.
-
After the page reloads, you should see a new application for hw2.
Stop
, Reload
and
Undeploy
should be underlined.
-
If
Start
is underlined, then you have an error in your
web app structure. Recheck the structure, then try to start it again.
-
Add an index.html in the root directory of the new web app.
-
Include all the tags for a well-defined web page.
-
Include a title.
-
Include your name.
-
Add a heading to the page.
-
Add a link to your servlet for this assignment. Use a relative link.
-
Add a servlet that will generate a dynamic web page as described below.
-
Place your servlet in a package of
your-user-name
-
Your servlet should be accessible from your Tomcat host port 8080 through
the URL
http://studentXX.cgs4825.cs.fiu.edu:8080/hw2/servlet/your-user-name.servlet-name
-
Your servlet will generate a dynamic HTML page that tests some of the request
headers.
-
Include all the HTML tags for a standard HTML page.
-
Use the bold and italic tags as indicated in the messages below.
-
Display one of these messages depending on the request header accept
-
"The accept header is not present", if the accept header is
null.
-
"image/png is in the accept header" if the accept header
contains image/png.
-
"image/png is not in the accept header" if the
accept header does not contain image/png.
-
Display one of these messages depending on the request header
user-agent
-
"The user-agent header is not present", if the user-agent header
is not there.
-
"MSIE is in the user-agent header", if the user-agent
contains MSIE.
-
"MSIE is not in the user-agent header", it the
user-agent header does not contain MSIE.
-
Display one of these messages depending on the request header
accept-language
-
"The accept-language header is not present", if the
accept-language header is not there.
-
"fr is in the accept-language header", if the
accept-language contains fr.
-
"fr is not in the accept-language header", it the
accept-language header does not contain fr.
-
Display one of these messages depending on the request header
authorization
-
"The authorization header is not present", if the authorization
header is null.
-
"basic is in the authorization header" if the
authorization header contains basic.
-
"basic is not in the authorization header" if the
accept header does not contain basic.
-
Implement the downey.hw2.Hw2Interface interface. Use the method in
this interface to test each header. This interface is included in the
downey.jar. View the JavaDoc for this jar
file: Documenation.
-
Test your servlet on
-
IE
-
Mozilla or Firefox
-
Test locally using Webclient from the textbook. Create a local web app that
does not require a password to access. Use Webclient to set the headers.
-
I have an example running
at
http://student01.cgs4825.cs.fiu.edu/~tdowne99
You will need to enter your ocelot username and Tomcat password in order
to access this site.