sysstatwebservice-handout - CS3214 Fall 2011 Project 6 -...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS3214 Fall 2011 Project 6 - “The sysstatd Web Service” Due Date: Thursday, Dec 8, 11:59pm (Late days may be used.) This project can be done in groups of 2 students. 1 Introduction This assignment introduces you to the principles of internetwork communication using the HTTP and TCP protocols, which form two of the most widely used protocols in to- day’s Internet. In addition, the assignment will give you some insights into how to con- struct web services that are based on the popular REST [3, 4] architectural style, and show an example of how to implement a multi-threaded server. 2 Functionality In this part of the assignment, you will implement a basic HTTP web server that provides access to web services and files. The web server should implement persistent connections as per the HTTP/1.1 [2] protocol. 2.1 System Status Web Service The system status web service is a basic HTTP web service that publishes a Linux system’s status as reported by the kernel via the / proc file system. The web service must provide this information in JSON [1] format. The web service shall respond to requests for at least the following resources: Service URL Example JSON Output Based On /loadavg { "total threads": "174", "loadavg": ["0.00", "0.00", "0.03"], "running threads": "1" } /proc/loadavg /meminfo { "SwapTotal": "5799928", "SwapFree": "5793240", "MemFree": "2434304", ... } /proc/meminfo In addition, you must support query arguments as per RFC 2616, Section 3.2.2. You must support a ’callback’ argument. If given, you must return proper syntax for a JavaScript function call in which the value of the field appears as function name and the JSON object appears as argument. You should check that the argument provided to the ’callback’ field consists of only alphanumeric characters, underscore ( ), and periods (.). You must ignore all additional argument=value pairs. For example, a request to /loadavg?callback=jsonp1258749550540& =1258749554624 Created by G. Back ([email protected]) 1 Revision : 1 . 9 November 20, 2011 CS3214 Fall 2011 Project 6 - “The sysstatd Web Service” would return jsonp1258749550540( { "total threads": "174", "loadavg": ["0.00", "0.00", "0.03"], "running threads": "1" } ) . (The second field is ignored.) Note that the order of the attributes within the returned JSON object (e.g., SwapTotal, SwapFree, etc.) is arbitrary. You can see a demo at and You should return appropriate error codes for requests to URLs you do not support. 2.2 Serving Files Your web server should, like a traditional web server, support serving files from a direc- tory (the ’root’) in the server’s file system. These files should appear under the /files URL. For instance, if the URL /files/widget/plugins/jqplot.barRenderer.js is visited, and the root directory is set to the parent directory (widget), the content of the file widget/plugins/jqplot.barRenderer.js should be served. You should re-should be served....
View Full Document

This note was uploaded on 12/31/2011 for the course CS 3214 taught by Professor Staff during the Fall '11 term at Virginia Tech.

Page1 / 9

sysstatwebservice-handout - CS3214 Fall 2011 Project 6 -...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online