Escolar Documentos
Profissional Documentos
Cultura Documentos
Aims:
To set up your user account on the universities Apache webserver
To create HTML 5 pages using text editor
To develop an understanding of the client-server environment and the processes we will be using
throughout the semester to load pages to the Apache webserver and view them through a browser
Install and use a web developer extension in Firefox
Validate HTML pages locally on your computer and on a server
View the HTTP headers for Web requests and responses and understand their content.
Gain the skills and knowledge towards completing Assignment 1.
See the Quick Start Guide, or the Setting Up Your Mercury Account under Server Access Guides
on Blackboard side menu and read through the instructions.
A web account is needed to load, test and run your web pages (HTML, CSS, JS) and server-side scripts (PHP).
For this purpose every student is assigned a Web server account on the Apache server at
mercury.ict.swin.edu.au.
Using PuTTY, a SSH (Secure Shell) client, (available on most lab computers under
Start>Programs>Network), log in to the mercury web server with username, s<your 7-digit or 10-digit
Swinburne ID>, (for example, s1234567) and your password, which is initially set as your date of birth in
<ddmmyy> format.
For first time users, the web server, mercury, will ask you to change this password, and when successful, it will
then trigger a script that will setup and configure your user space on the server.
Go to Transferring files to/from Mercury under Server Access Guides on Blackboard and read
through the instructions.
To test our Web pages, we need to first place them on the mercury server. We can use WinSCP a Secure
Copy and Paste file transfer client (available on all lab computers under Start>Programs>Network).
Lab 2 - Version: July 2015 Page 1 of 8
COS10011/60004/60007 Creating Web Applications Lab 2 - 2015
Using WinSCP, log in to the web server, mercury, with the host name mercury.ict.swin.edu.au, user name
s<your 7-digit Swinburne ID> and current password.
After a successful log in, you will be able to see the unit folder. It will be named according to your unit either
cos10011 (for undergraduates) or cos60004 or cos60007 (for postgraduates). Note that the cos is in
lower case as unix filenames are case sensitive.
Note that Apache web servers, such as mercury, are case sensitive, thus it is recommended that you use
lower case and avoid non-alphanumeric characters such as space when naming folders.
HINT: Code editors like NotePad++ highlight the different parts of your text according to what language is
being used. For example, in an HTML file NotePad++ highlights element tags blue, attribute names red,
comments green, content text black, and so on. The editor knows what language the file is being written in by
looking at the extension e.g. .htm, .js, .c , .php, etc. These colours not only make the text easier to read, but
can help you pick up keyword spelling errors and other syntax errors.
So you need to save the file with its extension before you start typing.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="description" content="Creating Web Applications" />
<meta name="keywords" content="HTML, CSS, JavaScript" />
<meta name="author" content="put your name here" />
<title>My First HTML 5 webpage</title>
</head>
<body>
<!-- First HTML5 Example -->
<h1>Creating Web Applications - Lab 2</h1>
<p>Can I use .htm instead of .html as my file extension?<br />
<em> Yes.</em></p>
<p>Are folder and file names case sensitive on Apache servers?<br />
<em> Yes.</em> <strong>Best to use only lower case.</strong></p>
</body>
</html>
To be able to run your Web pages, you must place the files into ~/<your_unit_code>/www/htdocs folder on
mercury or any subfolders you create.
Using WinSCP, drag and drop (or copy and paste) your file myhtml.htm from your local machine to the
htdocs/lab02 folder on the server.
Go to Viewing files in Mercury under Server Access Guides on Blackboard and read through the
instructions.
To view the pages through http, use Firefox and type in the following address,
http://mercury.ict.swin.edu.au/<your_unit_code>/<username>/<folder/.../filename>
The <username> is s< your 7-digit or 10-digit Swinburne ID >. For example
http://mercury.ict.swin.edu.au/<your_unit_code>/s1234567/lab02/myhtml.htm
When the authorization request dialog pops up, use your SIMS username and password to confirm access.
Note that the path to the htdocs folder on the server is mapped to a different path in the URL.
Notes:
Step 1 is only done once. Unless you need to reset your mercury password.
Steps 2 and 3 are performed every time you start a HTML/CSS/JavaScript development session.
Steps 4 to 6 are performed repeatedly in sequence when creating, testing and debugging your
HTML/CSS/JavaScript and PHP codes.
Problems:
For access problems, such as forgotten password or invalid account, contact the ITS Service Desk on
9214 5000 or ServiceDesk@swin.edu.au and inform them of your situation.
For problems in completing steps 2 to 6:
o refer to the Server Access Guides on Blackboard
o ask your tutor for help
o or visit the programming help desk
o or go to the online guides at https://csg.ict.swin.edu.au/livecsg/help/Doc_mercury_student
Title tag
Horizontal rule
(dont forget to
make it XML
Heading 2
compliant!)
Paragraphs with
inline <strong>
elements
Heading 2
Unordered
list
Once your page is validated show it to your tutor so your work can be marked
off as complete.
Note: Validators may not identify all the errors in the file, and they may not correctly identify the line
where the error occurs. Errors can be cascading. For instance, forgetting to close a tag on one line
means the parser does not correctly understand subsequent line of markup.
Once you have fixed the errors on your copy of the file, show it to your tutor so
your work can be marked off as complete.
-
Firefox is open source software, and many useful Add-ons/ Extensions can be installed into the basic
browser. In particular, the Web Developer Extension tools are useful.
Note: On your lab computer, the Web Developer addin / toolbar might already be installed .
On the other hand, you might have to install this extension each time you log-in.
To Install this Add-on / Extension:
Start Firefox
Select Tools / Add-ons from the top menubar,
Select Get Add-ons link from within the Add-ons dialogue box
Search for Web Developer in the Search all add-ons
Scroll down the search results page to find Web Developer by Chris Pederick.
Click on it, then install it
Once loaded, Firefox needs to be closed and restarted, for the Add-on to be visible.
Note: As we have already seen, most recent versions of Firefox already have the different
built-in Tools/Web Developer menu item.
Chris Pedericks will show up as Tools/Web Developer Extensions
You can also get to this extension directly at:
https://addons.mozilla.org/en-US/firefox/addon/web-developer/
Once installed, the Web Developer Add-on, is accessed from the Web Developer Extension toolbar,
and through drop-down menu items.
Explore this Web Developer Extension toolbar, especially Tools which provides links:
to the W3C HTML validators; to the W3C CSS validator; and to some useful Web Accessibility tools.
[Note: You can also Edit Tools changing the validator options, and adding more tools yourself.
In particular, it is useful to change the default CSS validator to CSS3 and show warnings, but we will
come to this later.]
To hide the toolbar, use View/Toolbars, and deselect/select Web Developer Toolbar.
To Disable this Add-on/Extension, select Tools/Add-ons from the Firefox menubar, select Extensions, find
the Web Developer Add-on and select Disable or Options or Remove.
To Uninstall an Add-on/Extension, select Tools/Add-ons from the Firefox menubar, select Extensions and
for the particular Add-on, then select Remove.
Refresh / reload the Web page you created in Task 4. Note the request and response headers that appear at the
top of the page. (You should also be able to see the Response Headers under Tools / Page Info.)
3. Request Header
1. What version of HTTP is the listed in the header? ..
2. What HTTP method is being used? ..
3. What type of user agent sent the request? ..
4. What MIME types will this user-agent accept?
.....
5. What MIME types does this user-agent prefer? (Hint: Look at q=0.x entries in the header and search
Google on HTTP header relative quality factor.
..
6. What do you think the entry Connection: keep alive means?
.
4. Response Headers
1. What HTTP response code was returned? .
2. What does this code mean? ..
3. What type of server generated the response?
4. What do you think the entry Connection: close means?
.
5. Click the Clear button on the LiveHTTPHeaders window. In the Firefox URL box, change the
capitalisation of the requested file to Outline.htm and resend. What HTTP response code is returned
now? What does this mean?
..
5. Try other websites
Load http://swin.edu.au and follow the trail as the page is redirected to www.swin.edu.au and then
www.swinburne.edu.au
6. Try using Tools / Web Developer / Web Console / Network
Load www.swinburne.edu.au and again you should see the list of resources that make up this web page.
Select the main html page in this list, and a new panel will open to the right. Open the Headers tab and
view the HTTP request and response headers. Open the Timings tab and you can see more details about
the time for the DNS resolution, connecting, sending, waiting, and receiving. Also see the Cookies tab.
Similarly, for other resources that make up this web page, you can view the headers, timings, and so on.